
11-06-2003, 09:03 AM
|
|
Newcomer
|
|
Join Date: Nov 2003
Posts: 4
|
|
DirectShow objects don't render live filter graph
|
I've constructed a simple filter graph using the DirectX Graph editor. The editor renders live video stream from my Logitech camera okay.
But when I try to use it in my VB form, using the renderfile method as directed at the MSDN site (see below), I get an Automation Error.
My VB project is basically a copy of the MSDN DirectShow example for rendering AVI files with VB6. This works fine.
Do I need a more complex filter graph with compression filters, etc.? My graph only has two filters - capture and render - but it works fine in the DirectX editor.
Text from MSDN:
Instantiating the Filter Graph
You can use the filter graph manager to render existing files of the following types.
.avi (Audio-Video Interleaved)
.mov (Apple® QuickTime®)
.mpg (Motion Picture Experts Group)
In addition, you can use the filter graph manager to render an existing filter graph by specifying the file that contains that graph as a parameter to the RenderFile method.
Because the filters in a filter graph are dependent on the type of file being rendered, the sample application does not instantiate a filter graph until the user selects a file. The code that handles this selection is embedded in the procedure that opens the file, mnu_FileOpen. This code displays the Show Open common dialog box and stores the selected file name in a g_strFileName variable. After this, the code verifies that the correct file type was chosen. Quartz.dll issues an error message if it is passed a file extension other than .mpg, .avi, or .mov.
After the g_strFileName variable is set, the application instantiates the filter graph manager and creates the filter graph object. The filter graph manager is instantiated when the Visual Basic keyword New is used to create the AUTOMATION object. The filter graph object is created when the IMediaControl::RenderFile method is called, as shown in the following example.
'Instantiate a filter graph for the requested
'file format.
Set g_objMediaControl = New FileGraphManager
g_objMediaControl.RenderFile (g_strFileName)
|
|