When you run GraphEdit, you'll see a screen similar to the one above. Click on the Toolbar button that I've circled above and a dialogue box will open for you to select another application's Filter Graph. Assuming no other media application is running, there will be no Filter Graphs in the list:
Ok, run our little Delphi project and select a media file to play. While it is running, open GraphEdit's Select a remote filter graph to view dialogue box again and, this time, there should be one to select - this is the Filter Graph that has been created by our Delphi project. The picture below shows the Filter Graph being displayed graphically in GraphEdit:
The box at the left shows the name of the file I chose to play (testavi.avi) and the box on the right shows the name of the renderer filter in our project (VideoWindow1) but the rest of the graph was created automatically by the FilterGraph1.RenderFile() method.
With GraphEdit as the active window, type Ctrl H to disconnect GraphEdit from the Filter Graph and select a different file-type for our project to play. To be completely different, I chose an MP3 file for the example below:
Notice that the "Default DirectSound Device" has been automatically chosen as the renderer filter and our VideoWindow1, which we specified in the Delphi project, is languishing unconnected and unused at the left of the Graph. Intelligent Connect and the RenderFile method use the file extension and the format of the file's header to determine the media type and select the appropriate filters for the Filter Graph and, in this case, determined that the VideoWindow was not required. Nevertheless, it is still part of the Filter Graph - it's just that it's input pin isn't connected to anything.
If we were designing an audio-only project, we could of course, have left the VideoWindow out of the code for our original Filter Graph but then, if we tried to play a video file, an untidy "floating" ActiveMovie window would have opened anyway - as we saw in our very first project. Type Ctrl H to disconnect GraphEdit from the Filter Graph.
GraphEdit can do much more than simply display existing Filter Graphs. Graphs can actually be designed and built by placing filters in the GraphEdit window and connecting the input and output pins. But, for now, we've seen how it can display existing Filter Graphs which have been built by other applications. This can be particularly useful in more complicated graphs in which things aren't working as we'd expected. Sometimes, Intelligent Connect doesn't connect the filters in the way we want so we have to build a graph manually. GraphEdit comes into its own then for testing graphs before we write a single line of code for them.
Live SourcesRendering files is such a common occurrence that the RenderFile method is provided for us. However, selecting a live source - such as a webcam or a microphone - is a little more complicated as we'll see in the next section.
Just as a final comment in this section, you'll remember that we needed to set FilterGraph1.GraphEdit to True for our Filter Graph to show in GraphEdit (try setting it to False to prove it!). Some applications set this property to False - deliberately or otherwise - which, unfortunately, means we may not always be able to see which filters other applications are using in their Filter Graphs.