Microsoft Windows CE 3.0  

CSourceStream Class

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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 CSourceclass derived object to provide the filter-level object.

The CSourceStreamclass creates a worker thread to push data downstream when the filter enters a paused or running state. The thread first calls the CSourceStream::OnThreadCreatemember function. If this succeeds, it will loop, calling the CSourceStream::FillBuffermember function until the CSourceStream::Inactivemember function stops it. As the thread quits, it calls the CSourceStream::OnThreadDestroymember function. If OnThreadCreatefails, OnThreadDestroyis called, and the active member function will fail.

To use the CSourceStreamclass, supporting a single media type, carry out the following steps.

Override the CSourceStream::GetMediaTypemember function to report the supported output format.

Override the CSourceStream::FillBuffermember function with a means of filling out each IMediaSampleobject with data.

To use the CSourceStreamclass, supporting multiple media types, carry out the following steps.

Override the CSourceStream::CheckMediaTypeand CSourceStream::GetMediaTypemember functions to report the supported media types (for more information, see the CBaseMediaFilterclass).

Override the CSourceStream::FillBuffermember function with a means of filling out each IMediaSampleobject 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

Active Called by the CBaseMediaFilterclass to start the worker thread.
CheckRequest Determines if a command is waiting for the thread.
CSourceStream Constructs a CSourceStreamobject.
Exit Called by the CSourceStream::Inactivemember function to exit the worker thread.
GetRequest Retrieves the next command for the thread.
Inactive Called by the CBaseMediaFiltermember function to shut down the worker thread.
Init Called by the CSourceStream::Activemember function to initialize the worker thread.
Pause Pauses the stream of the worker thread. This will acquire all necessary resources.
Run Starts the worker thread generation of a media sample stream.
Stop Stops the stream.

Overridable Member Functions

CheckMediaType Determines if a specific media type is supported. Override this member function if you use multiple types.
DoBufferProcessingLoop Loops, collecting a buffer and calling the CSourceStream::FillBufferprocessing function.
FillBuffer Override this member function to fill the stream buffer during the creation of a media sample.
GetMediaType 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.
OnThreadCreate Called as the worker thread is created; override this member function for special processing.
OnThreadDestroy Called during the destruction of a worker thread; override this member function for special processing.
OnThreadStartPlay Called at the start of processing Pause or Run command; override this member function for special processing.
ThreadProc Override this member function to create a custom thread procedure.

Implemented IPin Methods

QueryId Retrieves an identifier for the pin.