Microsoft Windows CE 3.0  

IMediaSample Interface

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.

The IMediaSampleinterface provides shared memory buffer functionality, holds some properties about the data, and holds a pointer to the data itself. It is used by connected pins to transport media samples from one pin to another.

The IMediaSample2interface extends the functionality of this interface to allow you to set and to retrieve media sample properties.

When to Implement

Implement this interface if you are providing an allocator (buffer) to be used for transporting media samples between filters. This interface is implemented by the CMediaSampleclass in the Microsoft DirectShow class library.

When to Use

Filters use methods on this interface to set properties and pass data to another filter. Downstream filters use methods on this interface to read the media sample's data and properties. Filters can modify the data in a media sample in place or can make a copy of the sample, modify the copy, and pass it on.

Methods in Vtable Order

IUnknown methods Description
QueryInterface Returns pointers to supported interfaces.
AddRef Increments the reference count.
Release Decrements the reference count.
IMediaSample methods Description
GetPointer Retrieves a read/write pointer to this buffer's memory.
GetSize Returns the size, in bytes, of the buffer data area.
GetTime Retrieves the stream times at which this sample should begin and finish.
SetTime Sets the stream times at which this sample should begin and finish.
IsSyncPoint Determines if the beginning of a sample is a synchronization point.
SetSyncPoint Sets the synchronization point.
IsPreroll Indicates a preroll property. If TRUE, this sample is for preroll only and should not be displayed.
SetPreroll Sets the preroll property. If TRUE, this sample is for preroll only and should not be displayed.
GetActualDataLength Retrieves the data length of the sample.
SetActualDataLength Sets the data length of the sample.
GetMediaType Retrieves the media type of the sample.
SetMediaType Sets the media type of the sample.
IsDiscontinuity Indicates a discontinuity property. If S_OK is returned, sample is not contiguous with previous sample.
SetDiscontinuity Sets the discontinuity property. Set to TRUE if sample is new after a seek or dropped sample.
GetMediaTime Retrieves the media time stamps for the sample.
SetMediaTime Sets the media time stamps for the sample.