DirectShow - Order of invocation of IAMStreamConfig::SetFormat and ICaptureGraphBuilder2::RenderStream creates issues in some video cameras

和自甴很熟 提交于 2019-12-04 06:21:30

问题


I have to configure my video camera display resolution before capturing and processing the data. Initially I did it as follows.

  1. Created all necessary interfaces.

  2. Added camera and renderer filters

  3. Did RenderStream with Capture and Preview PIN Categories.

  4. Then did the looping through AM_MEDIA_TYPE structures and setting the params.

This worked for a lot of cameras, but a few cameras failed. Then I changed the order of 3 and 4 given above. That is, I did the setting of params before the RenderStream. This time, the error cases went through, but a few On board cameras in SONY VAIO laptop etc seem to fail.

Now, my questions are

  1. Which is the optimal and correct method of getting and setting AM_MEDIA_TYPE parameters and running the graph?

  2. If there are different cameras, if I get an indication of which order is the best for a particular camera by going through the camera's DirectShow interfaces, that will also serve my purpose.

Please help me in this at the earliest,

Thanks and regards,

Shiju


回答1:


IAMStreamConfig::SetFormat needs to be used to set capture format before the pin is connected and rendered. This way the downstream subchain of filters is built with proper media types.



来源:https://stackoverflow.com/questions/9834902/directshow-order-of-invocation-of-iamstreamconfigsetformat-and-icapturegraph

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