Can't make IAMStreamConfig.SetFormat() to work with LifeCam Studio

后端 未结 2 524
夕颜
夕颜 2020-12-10 18:51

I\'m brand new to DirectShow and am working on adding a video stream to my application. I\'ve looked into many solutions out there (TouchLess, DirectShow.net, etc.) and end

相关标签:
2条回答
  • 2020-12-10 19:22

    You put it into right place - after it's already in the graph by AddFilter, but yet before its output pin is connected. If you have successful HRESULT, then you could be expecting changed format, but there might be exceptions, such as for example this media type was not accepted by downstream filter and they started negotiating from the start.

    You're not showing your ConfigureSampleGrabber here, so it might be the case that this media type you want is not accepted by sample grabber making filter graph to try alternate media types and/or intermediate filters (such as decoders).

    There are a few things you can actually do.

    1. For troubleshooting you might want to:

      1. add the filter graph to ROT, or instead just install DirectShow Spy to have the same done for you automatically
      2. add a MessageBox in your code right after your SetCaptureFormat
      3. while the message box is still on the screen, use GraphEdit (GraphStudio) to inspect your filter graph and to see what media types it enumerates on its output pin; typically the first media type will be the one used for real connection, so your successfull HRESULT in SetFormat basically assumes the media type is now on top of this list
    2. To force the media type, you might want to use IFilterGraph::ConnectDirect with the configured pin, it's immediate neighbor downstream pin and media type of your interest.

    Hope this helps.

    0 讨论(0)
  • 2020-12-10 19:23

    Steve, you should not rebuild the camera (from moniker) in SetCaptureFormat but use the g_pIBaseFilterCam.

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