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. What's wrong with this way of enumerating filters?

What's wrong with this way of enumerating filters?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestionannouncement
5 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 looked at the MSDN example, but the pEnum->Next function returns S_FALSE which means that the number of filters that were requested to be enumerated, wasn't enumerated.

    IGraphBuilder *pGraph = NULL;
    IEnumFilters *pEnum = NULL;
    IBaseFilter *pFilter = NULL;
    ULONG cFetched;
    HRESULT err;

    CoInitialize(NULL);
    err = 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();
    }

    All help is apprecaited! Thanks all :) -Rune Svendsen

    J 1 Reply Last reply
    0
    • R Redeemer dk

      I've looked at the MSDN example, but the pEnum->Next function returns S_FALSE which means that the number of filters that were requested to be enumerated, wasn't enumerated.

      IGraphBuilder *pGraph = NULL;
      IEnumFilters *pEnum = NULL;
      IBaseFilter *pFilter = NULL;
      ULONG cFetched;
      HRESULT err;

      CoInitialize(NULL);
      err = 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();
      }

      All help is apprecaited! Thanks all :) -Rune Svendsen

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

      Try calling pEnum->Reset(); before enumerating. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

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

        Try calling pEnum->Reset(); before enumerating. 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

        Didn't work :( thanks anyway man. -Rune SVendsen

        J 1 Reply Last reply
        0
        • R Redeemer dk

          Didn't work :( thanks anyway man. -Rune SVendsen

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

          Wait... Seems you're constructing an IGraphBuilder and then enumerating its filters, but an empty IGraphBuilder won't have any. Try using for instance IGraphBuilder::RenderFile on some .avi prior to enumeration. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

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

            Wait... Seems you're constructing an IGraphBuilder and then enumerating its filters, but an empty IGraphBuilder won't have any. Try using for instance IGraphBuilder::RenderFile on some .avi prior to enumeration. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

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

            Thankyou i'll try that. But do you know if there's a way to enumerate all the available filters on the current machine? -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