Articles Technology Blog News Company

Menus, options, code generation

File menu:
  • New - open a new empty graph window, other graph windows remain accessible.
  • Open - load a graph from .grf file and open in a new window.
  • Connect to running - open a new window with a graph from another process registered in ROT (Running Objects Table). See ***.
  • Disconnect from running - disconnect and close the window with remote graph.
  • Render file - select a file and build a graph in current graph window that plays the selected file.
  • Render URL - same with an URL instead of a local file.
  • Save (As) - save the current graph to a .grf file.
  • Generate Code - generate C++ or C# code that builds the current graph in your app.
  • Save graph as image - make a PNG image with current graph.
Options menu is trivial: there is an on/off option for reference clock of current graph (described in graph editing part) and items invoking Preferences and Code templates windows.

Preferences:
  • AutoArrange filters - after connecting filters and some other operations arrange filters in the graph window automatically.
  • Suggest URLs for sources and sinks - when adding a filter to a graph, if this filter supports IFileSourceFilter or IFileSinkFilter interface then a file open/save dialog pops up asking what file to open or write. However sometimes this should be not a file but URL, so file dialog is not adequate there. When this option is on, if you press Cancel in the file open/save dialog then another window will pop up offering to enter some URL or choose one of previously used.

Code generation:
GraphEditPlus can generate source code in C++ and C# for building the graph you created in it. However this code can look and behave differently depending on your choices in following settings. First, there are two ways to connect any two filters: one may use intelligent connect where the code passes both filters to RenderStream() method and lets it find appropriate pins automatically. This is simple but can lead to inserting some additional intermediate filters between the two to help with data conversion. Another way to connect filters is direct connect where generated code will first find proper pins by their name and them pass them to a method for direct connection. So the options in this window are:

  • find pins and connect directly - use direct connect, finding pins by name.
  • use RenderStream - intelligent connect.

Another choice is about creating filters outside the basic DirectShow filters category: capture sources, video compressors, audio effects etc. These filters should not be created simply by their CLSID like ordinary DirectShow filters. Instead they may be created by enumerating their category or by their moniker string (display name). The second option is simpler but not too reliable - on a different machine display name for a similar filter might be different. Creating them by name is the preferred method, although it means a linear search every time such filter is inserted.

All these code generation variants and other code snippets from which overall source code gets built are configurable in "Code templates" window, so if you don't like how error handling is performed in generated code or how some other things are done, you can modify those snippets once and this will affect all future generated code.