Asked By Erakis
04-Feb-10 06:13 PM

Hi,
I open a MPEG-4 file using GraphEdit.
The filter chosen by the graph to render (vid??o and sound) on screen are :
--------------------------------------------------------------------
MPEG-4File --> ffdshow video decoder --> Video Renderer
--> ffdshow audio decoder --> AC3Filter --> DirectSoundDevice
--------------------------------------------------------------------
But when I am loading the same file in my application using the RenderFile
function of IGrahBuilder, i get the following error : E_NOINTERFACE
Here is the way I am loading the graph
--------------------------------------------------------------------
// Result of function calls
HRESULT hr;
// Create GraphBuilder
FAIL_RET( g_GraphBuilder.CoCreateInstance(CLSID_FilterGraph) );
// Create VMR9 interface
FAIL_RET( g_Filter.CoCreateInstance(CLSID_VideoMixingRenderer9, NULL,
CLSCTX_INPROC_SERVER) );
// Create VMR9 configuration interface
CComPtr<IVMRFilterConfig9> filterConfig;
FAIL_RET( g_Filter->QueryInterface(IID_IVMRFilterConfig9,
reinterpret_cast<void**>(&filterConfig)) );
// Set VMR9 rendering mode to Renderless because we have an
// allocator that will handle the drawing
FAIL_RET( filterConfig->SetRenderingMode( VMR9Mode_Renderless ) );
// Set number of streams to 1 because we will not mix any other video
FAIL_RET( filterConfig->SetNumberOfStreams(1) );
// Create the Alllocator presenter that will output media on the main window
FAIL_RET( SetAllocatorPresenter( g_Filter, window ) );
// Add VMR9 filter to Graph
FAIL_RET( g_GraphBuilder->AddFilter(g_Filter, L"Video Mixing Renderer 9") );
// Get MediaControl interface (Uses for playing, pausing, and stopping the
graph)
FAIL_RET( g_GraphBuilder->QueryInterface(IID_IMediaControl,
reinterpret_cast<void**>(&g_MediaControl)) );
// Get MediaSeeking interface (Uses for seeking through the graph)
FAIL_RET( g_GraphBuilder->QueryInterface(IID_IMediaSeeking,
reinterpret_cast<void**>(&g_MediaSeeking)) );
// Get MediaEvent interface (To know when the media has been completly read)
FAIL_RET( g_GraphBuilder->QueryInterface(IID_IMediaEvent,
reinterpret_cast<void**>(&g_MediaEvent)) );
// Ask to graph to render the file
// (Intelligent connect will choose the righ filters (codecs) to output the
media)
FAIL_RET( g_GraphBuilder->RenderFile(g_szMainMovieFilePath, NULL ));
--------------------------------------------------------------------
I thought if it worked in GraphEdit, the method RenderFile was guaranteed to
work on my application and that it gave the same grah at the end ?
If the only solution is to build the graph manually, is it someone could
help me start or give me a help on this ?