Share via


IMediaSample Interface

This interface 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 IMediaSample2 interface 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 CMediaSample class in the 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

The following table shows the methods that appear in the Vtable beneath the standard COM methods inherited from IUnknown.

Method 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.

Requirements

DirectShow applications and DirectShow filters have different include file and link library requirements. See Setting Up the Build Environment for more information.

OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.

See Also

DirectShow Interfaces

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.