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

穿精又带淫゛_ 提交于 2019-11-28 11:30:39

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.

bntr

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!