Adding Filter by Class ID
-
Hi all, Can anyone tell me how to add a filter by Class ID and relate it with IBaseFilter Interface. I mean I have the filter Class ID from the graphedit application not something like CLSID_FilterName.Can anyone help me with this? Thank You. With regards
Raja Bose
-
Hi all, Can anyone tell me how to add a filter by Class ID and relate it with IBaseFilter Interface. I mean I have the filter Class ID from the graphedit application not something like CLSID_FilterName.Can anyone help me with this? Thank You. With regards
Raja Bose
write the following code IGraphBuilder* g_pGraphBuilder; IBaseFilter *MyFilter; HRESULT hr hr=AddFilterByCLSID(g_pGraphBuilder,CLSID_VideoRenderer,NULL,&VideoRendrer); where the function is HRESULT AddFilterByCLSID( IGraphBuilder *pGraph, // Pointer to the Filter Graph Manager. const GUID& clsid, // CLSID of the filter to create. LPCWSTR wszName, // A name for the filter. IBaseFilter **ppF) // Receives a pointer to the filter. { if (!pGraph || ! ppF) return E_POINTER; *ppF = 0; IBaseFilter *pF = 0; HRESULT hr = CoCreateInstance(clsid, 0, CLSCTX_INPROC_SERVER, IID_IBaseFilter, reinterpret_cast(&pF)); if (SUCCEEDED(hr)) { hr = pGraph->AddFilter(pF, wszName); if (SUCCEEDED(hr)) *ppF = pF; else pF->Release(); } return hr; }
RajeshGupta
-
write the following code IGraphBuilder* g_pGraphBuilder; IBaseFilter *MyFilter; HRESULT hr hr=AddFilterByCLSID(g_pGraphBuilder,CLSID_VideoRenderer,NULL,&VideoRendrer); where the function is HRESULT AddFilterByCLSID( IGraphBuilder *pGraph, // Pointer to the Filter Graph Manager. const GUID& clsid, // CLSID of the filter to create. LPCWSTR wszName, // A name for the filter. IBaseFilter **ppF) // Receives a pointer to the filter. { if (!pGraph || ! ppF) return E_POINTER; *ppF = 0; IBaseFilter *pF = 0; HRESULT hr = CoCreateInstance(clsid, 0, CLSCTX_INPROC_SERVER, IID_IBaseFilter, reinterpret_cast(&pF)); if (SUCCEEDED(hr)) { hr = pGraph->AddFilter(pF, wszName); if (SUCCEEDED(hr)) *ppF = pF; else pF->Release(); } return hr; }
RajeshGupta
Hi Rajesh, Thank you very much for replying, As you said in the following case IGraphBuilder* g_pGraphBuilder; IBaseFilter *MyFilter; HRESULT hr hr=AddFilterByCLSID(g_pGraphBuilder,CLSID_VideoRenderer,NULL,&VideoRendrer); CLSID_VideoRenderer this one is not known to me. The classid like 2345-2445-3245-543456 (for example CLSID_VideoRenderer = 2345-2445-3245-543456)which I got from DxFilterSpy.exe is known to me. So can you tell me how do I add this Classid in my application and relate it to my base class filter Awaiting for your reply Thank You With regards
Raja Bose
-
Hi Rajesh, Thank you very much for replying, As you said in the following case IGraphBuilder* g_pGraphBuilder; IBaseFilter *MyFilter; HRESULT hr hr=AddFilterByCLSID(g_pGraphBuilder,CLSID_VideoRenderer,NULL,&VideoRendrer); CLSID_VideoRenderer this one is not known to me. The classid like 2345-2445-3245-543456 (for example CLSID_VideoRenderer = 2345-2445-3245-543456)which I got from DxFilterSpy.exe is known to me. So can you tell me how do I add this Classid in my application and relate it to my base class filter Awaiting for your reply Thank You With regards
Raja Bose