C++/VB - Using custom ASF parser filter in DirectShow

Asked By rishi_bs
03-Jul-08 05:10 AM
Hi all,

I have to use a custom ASF parser along with the Async Source filter/
Async URL filter. But it looks like that Dshow by default chooses
Window media source filter which act as source as well as parser. So,
I have not been able to connect my ASF parser filter in the graph.

Does anybody have any idea of how to bypass the Windows media source
filter?
Can I connect my ASF parser filter using manual graph building like
use of addsourcefilter, adddilter, connect methods ?

Thanks and regards,
Rishi
IFileSourceFilter
(1)
CoCreateInstance
(1)
IGraphBuilder
(1)
DirectShow
(1)
AddFilter
(1)
Window
(1)
Dshow
(1)
Async
(1)
  Alessandro Angeli replied...
01-Jul-08 06:58 AM
From: "rishi_bs"


1. CoCreateInstance(<reader>)
2. IGraphBuilder::AddFilter(<reader>)
3. <reader>.IFileSourceFilter::Load()
4. <create_parser>
5. IGraphBuilder::AddFilter(<parser>)
6. IGraphBuilder::Render(<reader.output_pin>)


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
  rishi_bs replied...
03-Jul-08 05:10 AM
Alessandro,

It worked for me. I could connect my Parser filter into the filter
graph:)
Thanks for the help.
Create New Account
help
multiple video depending on some interactive context. I am preloading all video media (building the IGraphBuilder using my own render to texture filter), this operation is : - create GraphBuilder - create customallocator - add customallocator - create IFileSourceFilter - Define sourcefile - Add IFileSourceFilter - Get outputpin - IGraphBuilder-> Render( outputpin) - Render first frame and rewind - Pause everything is great until a certain number SPLITTER So what happens : the graph can not connect anymore the output pin of the IFileSourceFilter interface of the ASyncReader to the input pin of the AVISplitter. . . Is there a maximum file . . . . From: "Nicolas Bernard" I will assume you meant: create a CLSID_FilterGraph and use its IGraphBuilder interface. I will assume you meant: create the VMR (which one, VMR7 or VMR9?), add I cannot figure out what you meant here. If the step above meant you invoked IFileSourceFilter::Load() before adding the source filter to the graph, then you need to first add have since you are trying to connect its pin. Always the 36th? - - / / Alessandro Angeli / / MVP :: DirectShow / MediaFoundation / / mvpnews at riseoftheants dot com / / http: / / www.riseoftheants.com / mmx / faq.htm Sorry not
it doesn't support mms: / / stream. At least, not very well supported. I tried us addFilter (CLSID_WMAsfReader) before RenderFile, but it doesn't work. So, should I give up RenderFile and here is my source code (based on sdk sample): int _tmain(int argc, _TCHAR* argv[]) { IGraphBuilder *pGraph = NULL; IMediaControl *pControl = NULL; IMediaEvent *pEvent = NULL; / / Initialize the COM library. HRESULT hr = CoInitialize initialize COM library"); return 0; } / / Create the Filter Graph Manager and query for interfaces. hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void * *)&pGraph); if (FAILED(hr)) { printf("ERROR - Could not create the Filter Graph Manager."); return 0; } IBaseFilter* pSrcFilter; IFileSourceFilter* pReader; hr = ::CoCreateInstance( CLSID_WMAsfReader, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (LPVOID *)&pSrcFilter ); if(FAILED(hr)) { return hr; } / / Add Capture filter to our graph. hr = pGraph-> AddFilter( pSrcFilter, L"ASF Reader" ); if(FAILED(hr)) { return hr; } hr = pGraph-> QueryInterface(IID_IMediaControl, (void * *)&pControl pEvent-> Release(); pGraph-> Release(); CoUninitialize(); return 0; } Win32 DirectX Video Discussions MsgWaitForMultipleObjects (1) CComQIPtr (1) IFileSourceFilter (1) WMSourceFilter (1) IMediaEventEx (1) WMAsfReader (1) CoCreateInstance (1) AddSourceFilter (1) Try using IFileSourceFilter::Load after this and then render the output pins
afx_msg void OnSize( UINT, int, int); public: HRESULT Initialize(LPCTSTR); void CleanUp(); void ResizeVideoWindow(); private: IGraphBuilder* m_pGraph; IBaseFilter* m_pBaseFilter; IFileSourceFilter* m_pSource; IAsyncReader* m_pAsyncReader; IMediaControl* m_pControl; IMediaEventEx* m_pEvent; IVideoWindow* m_pVideoWindow; / / For full screen window. public: afx_msg initialize COM library; return(-1); } / / Create the filter graph manager and query for interfaces. hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void * *)&m_pGraph); if (FAILED(hr)){ / / "ERROR - Could not create the Filter void * *)&m_pControl); if (FAILED(hr)){ / / "ERROR - Could not create media control."; CleanUp(); return(-1); } / * / / hr = CoCreateInstance(CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void * *)&m_pBaseFilter); if (FAILED(hr)){ / / ERROR - Could not create media control event.; CleanUp(); return(-1); } / / add filter. hr = m_pGraph-> AddFilter(m_pBaseFilter, NULL); if (FAILED(hr)){ / / ERROR - Could not create media control event.; CleanUp(); return(-1 remind yourself to link in strmiids.lib, just tell the compiler directly: - - / / Alessandro Angeli / / MVP :: DirectShow / MediaFoundation / / mvpnews at riseoftheants dot com / / http: / / www.riseoftheants.com / mmx / faq.htm I want So you want to read the file yourself into your own buffer, and then get DirectShow to play the file from that buffer. Is that right? In that case, you need