These two classes looks similar to me,
can you remind me the great difference between these two classes so that I can judge which class a specific interface belongs to without refering to the document??
These two classes looks similar to me,
can you remind me the great difference between these two classes so that I can judge which class a specific interface belongs to without refering to the document??
As by the definition in the MSDN :
The CSource class is a base class for implementing source filters. A filter derived from CSource contains one or more output pins derived from the CSourceStream class. Each output pin creates a worker thread that pushes media samples downstream.
CSource is the actual implementation of a filter, while CSourceStream implements an output pin. These two classes must always be used with one another, but the short answer is: they're different parts of a source filter.
If you look at the documentation of CSourceStream, you'll see that it inherits from CBaseOutputPin, and also CAMThread. CAMThread is a class that implements the "streaming thread" for the output pin (in DirectShow, each source filter's output pin traditionally should have its own thread on which it delivers samples).
One other weird thing about CSourceStream/CSource is a reference to the output pin simply redirects to the filter's reference counting (so although these are two separate objects in your project, they share the same reference count).
Typically, I do not use CSourceStream because the implementation is not so great. Lately I've been using CBaseOutputPin, and creating my own streaming thread (often using Qt's QThread). CSourceStream itself is...poorly coded and can easily be simplified. Instead of CSource/CSourceStream, I'd consider using CBaseFilter/CBaseOutputPin and your own threading library of choice.