Is it possible to enumrate all the system's DirectShow filters?
-
I've tried the code on MSDN but that doesen't give me any filters. I was told it may be because i hadn't performed a
RenderFile
action on the IGraphBuilder. But isn't there another way of just enumerating all the available filters on the system? Here's my code, when it comes to thepEnum->Next
procedure for the first time, it returns S_FALSE which means that the number of filters requested couldn't be found.IGraphBuilder *pGraph = NULL;
IEnumFilters *pEnum = NULL;
IBaseFilter *pFilter = NULL;
ULONG cFetched;CoInitialize(NULL);
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder,(void**)&pGraph);
pGraph->EnumFilters(&pEnum);while((err = pEnum->Next(1, &pFilter, &cFetched)) == S_OK)
{
FILTER_INFO fiFilterInfo;
char szFilterName[256];pFilter->QueryFilterInfo(&fiFilterInfo); WideCharToMultiByte(CP\_ACP, 0, fiFilterInfo.achName, -1, szFilterName, 256, 0, 0); SendMessage(GetDlgItem(ghWnd, IDC\_FILTERS), LB\_INSERTSTRING, -1, (LPARAM)szFilterName); fiFilterInfo.pGraph->Release(); pFilter->Release();
}
pEnum->Release();
pGraph->Release();
CoUninitialize();So i'm asking if there's a way to enumerate all the available filters on the system. All help appreciated :) -Rune Svendsen
-
I've tried the code on MSDN but that doesen't give me any filters. I was told it may be because i hadn't performed a
RenderFile
action on the IGraphBuilder. But isn't there another way of just enumerating all the available filters on the system? Here's my code, when it comes to thepEnum->Next
procedure for the first time, it returns S_FALSE which means that the number of filters requested couldn't be found.IGraphBuilder *pGraph = NULL;
IEnumFilters *pEnum = NULL;
IBaseFilter *pFilter = NULL;
ULONG cFetched;CoInitialize(NULL);
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder,(void**)&pGraph);
pGraph->EnumFilters(&pEnum);while((err = pEnum->Next(1, &pFilter, &cFetched)) == S_OK)
{
FILTER_INFO fiFilterInfo;
char szFilterName[256];pFilter->QueryFilterInfo(&fiFilterInfo); WideCharToMultiByte(CP\_ACP, 0, fiFilterInfo.achName, -1, szFilterName, 256, 0, 0); SendMessage(GetDlgItem(ghWnd, IDC\_FILTERS), LB\_INSERTSTRING, -1, (LPARAM)szFilterName); fiFilterInfo.pGraph->Release(); pFilter->Release();
}
pEnum->Release();
pGraph->Release();
CoUninitialize();So i'm asking if there's a way to enumerate all the available filters on the system. All help appreciated :) -Rune Svendsen
The code you've got lists the filters of an empty
IGraphBuilder
(that is, none).RenderFile
fills thatIGraphBuilder
with the filters necessary to render a given file. As for enumerating all the filters present in the system, check MSDN article Using the System Device Enumerator[^] (provides samples). Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
The code you've got lists the filters of an empty
IGraphBuilder
(that is, none).RenderFile
fills thatIGraphBuilder
with the filters necessary to render a given file. As for enumerating all the filters present in the system, check MSDN article Using the System Device Enumerator[^] (provides samples). Joaquín M López Muñoz Telefónica, Investigación y DesarrolloThankyou. Do you know how i add a filter to IFilterGraph if i only know the name of the filter? -Rune Svendsen