I am currently developing an application that uses DirectShow. The application should support many different webcams that probably have a lot of different output pin ColorSpace configurations (RGB, YUV, I420, etc).
When encoding i will always be using the same encoding filter and mux + file writer - however i won't know how to connect the Output pin on the Source filter to the input pin on the encoding filter, because it will depend on the source filter's output ColorSpace.
Examples:
And so on.. meaning there could be lots of different filter configurations up until the encoder.
My question is now, is it perfectly okay to use Intelligent Connect()
instead of ConnectDirect()
to connect the Source filter to the encoder filter?
Or would I have to check the media type of the source output pin each time, and manually build the graph up depending on the Color Space (RGB,YUV..) of the source output pin?
Is there an easy way to do that, that I might not know about - seems like there could be and endless amount of possibilities to connect the source filter to the encoder..
Thanks for your help.
Using Connect
and Intelligent Connect is fine. Basically it means that you request pins to be connected "somehow", and "the best way possible".
However because there might be many options, different environments, hardware and configurations in many situations you want to connect the predictable way you know (esp. when it comes to encoding, not decoding).
A good strategy is to Connect
(and ConnectDirect
) to individual filters you are aware of and you are sure that you want exactly them, and leaving Intelligent Connect for connections you are okay with the system supplied filter chains, esp. when it comes to decoding and where Windows is supposed to pick available decoder for you.
Also when Intelligent Connect is in question, it makes rarely a difference whether you Connect
or ConnectDirect
. Either way the filters connect using the media type, and sometimes they might re-agree media type on the go. More important is whether you connect to known filter, or you let Intelligent Connect supply you with a filter required for connection. Incorrectly picked filter, or at all filter with bad registration that crashes process instead of connecting the pipeline, is more often the real headache.