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.
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 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 loops, 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 fails.

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

Member function Description

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.

Overrideable Member Functions

Member function Description

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

Method Description

QueryId

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