Search code examples
c++directshow

Fork Direct Show Tee Filter


I need an 'Infinite Pin Tee filter' which allows to enable/disable delivery to specific pin instance.

At first point, I tought take "Inifinite Pin Tee Filter" example from Windows SDK as base point and start to fork the code from this base. But this force me to copy a lot of "unecessary" code.

Other option is inherit from Direct show Pin Tee filter and only overwirte the necessary methods.

  • Add new property "IsEnabled" to pin.
  • Overwrite Receive(IMediaSample *pSample) to check new "IsEnabled" property.
  • Write an interfice to interact from filter.

Is this second option really viable? Apart of code duplication,What are the strengths and weaknesses of both options?


Solution

  • InfTee Filter Sample does not look overly complicated and is a good starting point. The other option you mentioned does not cover scenario of "end of stream" delivery, stopped to paused transition specific, attempts to avoid unnecessary data copying. Trying to patch up those you will end up with code comparable with InfTee sample anyway.

    Your another real alternate option is to build a really simple "one in, one out" filter which delivers or not media samples depending on its IsEnabled property. This lets you use stock InfTee as is, and add a few instances of your own blocking filter to its output, to implement the data cutaway logic. Both approaches make sense.