DirectShow - Order of invocation of IAMStreamConfi

2020-05-03 11:09发布

问题:

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.



标签: directshow