Pins avaiable in graphstudio not there in code

前端 未结 1 823
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-23 13:34

I am using a source filter of a webcam. When I use the filter in graphstudio it has two output pins. However in code the call to IEnumPins->next always returns S_FALSE. I also l

1条回答
  •  野的像风
    2021-01-23 14:25

    This is an indication that your code deals with another filter or has bugs otherwise. You normally don't "create" pins, especially on video device backed source filter. Typical reasons are: (a) you are effectively creating a different filter, (b) direct bug in your code, (c) 32/64-bit issue with different filters in the two environments. There can hardly be anything else. Stepping and inspecting your code thoroughly, adding debug output should take you to the solution.

    UPDATE. Video capture devices like this cannot be instantiated using CoCreateInstance. You have to create them using monikers. typically through enumeration, as described on MSDN (with source code snippet): Selecting a Capture Device.

    The code below is incorrect, FYI this GUID is declared in SDK as CLSID_Proxy.

     static const GUID CLSID_Webcam =
    { 0x17CCA71B, 0xECD7, 0x11D0, { 0xB9, 0x08, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96 } };
    hr = CoCreateInstance(CLSID_Webcam, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&source);
    

    0 讨论(0)
提交回复
热议问题