Partager via


Custom filter interfaces

Recently I was asked this question:

[Paraphrased] I have written a filter, and the filter has only one pin. This pin has some members, which I want to set or get through the filter interface. However, the pin is inherited from CSourceStream and CSourceSeeking. How can I implement an interface for the pin?

This topic has some information about supporting custom interfaces in a filter:

https://msdn2.microsoft.com/en-us/library/ms787698.aspx

Basically, you add DECLARE_IUNKNOWN to you class declaration, and then override CUnknown::NonDelegatingQueryInterface to return a pointer to your interface. The code shown in this topic is for a filter interface, but it's the same principle for pins.

Also, see:

https://msdn2.microsoft.com/en-us/library/ms787849.aspx for information about CUnknown.

The EZRGB24 sample in the SDK shows an example of how to do this at the filter level.


This posting is provided "AS IS" with no warranties, and confers no rights.