CSourceStream Class
A version of this page is also available for
4/8/2010
Derive from this class to provide a class that creates the data stream from one of the output pins. It should be used with an object that is derived from the CSource class derived object to provide the filter-level object.
The CSourceStream class creates a worker thread to push data downstream when the filter enters a paused or running state.
The thread first calls the CSourceStream::OnThreadCreate member function. If this succeeds, it loops, calling the CSourceStream::FillBuffer member function until the CSourceStream::Inactive member function stops it.
As the thread quits, it calls the CSourceStream::OnThreadDestroy member function.
If OnThreadCreate fails, OnThreadDestroy is called, and the active member function fails.
To use the CSourceStream class, supporting a single media type, carry out the following steps.
Override the CSourceStream::GetMediaType member function to report the supported output format.
Override the CSourceStream::FillBuffer member function with a means of filling out each IMediaSample object with data.
To use the CSourceStream class, supporting multiple media types, carry out the following steps.
Override the CSourceStream::CheckMediaType and CSourceStream::GetMediaType member functions to report the supported media types (for more information, see the CBaseMediaFilter class).
Override the CSourceStream::FillBuffer member function with a means of filling out each IMediaSample object with data.
See the files in the Samples\Multimedia\DShow\Src\Ball subdirectory in the DirectX Media Software Development Kit (SDK) for an example of a pin supporting multiple types.
If you want more complex management of your worker thread, you can override most of the associated member functions. See Samples\Multimedia\DShow\Src\Vidcap in the DirectX Media SDK for an example.
Member Functions
Member function | Description |
---|---|
Called by the CBaseMediaFilter class to start the worker thread. |
|
Determines if a command is waiting for the thread. |
|
Constructs a CSourceStream object. |
|
Called by the CSourceStream::Inactive member function to exit the worker thread. |
|
Retrieves the next command for the thread. |
|
Called by the CBaseMediaFilter member function to shut down the worker thread. |
|
Called by the CSourceStream::Active member function to initialize the worker thread. |
|
Pauses the stream of the worker thread. This will acquire all necessary resources. |
|
Starts the worker thread generation of a media sample stream. |
|
Stops the stream. |
Overrideable Member Functions
Member function | Description |
---|---|
Determines if a specific media type is supported. Override this member function if you use multiple types. |
|
Loops, collecting a buffer and calling the CSourceStream::FillBuffer processing function. |
|
Override this member function to fill the stream buffer during the creation of a media sample. |
|
Retrieves the media type or types that this pin supports; override the appropriate version of this member function to support one or multiple media types. |
|
Called as the worker thread is created; override this member function for special processing. |
|
Called during the destruction of a worker thread; override this member function for special processing. |
|
Called at the start of processing Pause or Run command; override this member function for special processing. |
|
Override this member function to create a custom thread procedure. |
Implemented IPin Methods
Method | Description |
---|---|
Retrieves an identifier for the pin. |
Requirements
Windows Embedded CE | Windows CE 2.12 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |
Note | Microsoft DirectShow applications and DirectShow filters have different include file and Library requirements For more information, see Setting Up the Build Environment |