Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Is it possible to enumrate all the system's DirectShow filters?

Is it possible to enumrate all the system's DirectShow filters?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Redeemer dk
    wrote on last edited by
    #1

    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 the pEnum->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

    J 1 Reply Last reply
    0
    • R Redeemer dk

      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 the pEnum->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

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      The code you've got lists the filters of an empty IGraphBuilder (that is, none). RenderFile fills that IGraphBuilder 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

      R 1 Reply Last reply
      0
      • J Joaquin M Lopez Munoz

        The code you've got lists the filters of an empty IGraphBuilder (that is, none). RenderFile fills that IGraphBuilder 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

        R Offline
        R Offline
        Redeemer dk
        wrote on last edited by
        #3

        Thankyou. Do you know how i add a filter to IFilterGraph if i only know the name of the filter? -Rune Svendsen

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups