IMediaSample interface (strmif.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The IMediaSample interface sets and retrieves properties on media samples. A media sample is a COM object that contains a block of media data. Media samples support the use of shared memory buffers among filters.

Typically, applications do not call methods on this interface. Filters use this interface to set properties on samples, and deliver the samples to a downstream filter. The downstream filter uses the interface to retrieve the properties and read the data. The filter can modify the data in place, or it can copy the sample, modify the copy, and pass the copy downstream.

The IMediaSample2 interface inherits this interface.

Inheritance

The IMediaSample interface inherits from the IUnknown interface. IMediaSample also has these types of members:

Methods

The IMediaSample interface has these methods.

 
IMediaSample::GetActualDataLength

The GetActualDataLength method retrieves the length of the valid data in the buffer.
IMediaSample::GetMediaTime

The GetMediaTime method retrieves the media times for this sample.
IMediaSample::GetMediaType

The GetMediaType method retrieves the media type, if the media type differs from the previous sample.
IMediaSample::GetPointer

The GetPointer method retrieves a read/write pointer to the media sample's buffer.
IMediaSample::GetSize

The GetSize method retrieves the size of the buffer.
IMediaSample::GetTime

The GetTime method retrieves the stream times at which this sample should begin and finish.
IMediaSample::IsDiscontinuity

The IsDiscontinuity method determines if this sample represents a break in the data stream.
IMediaSample::IsPreroll

The IsPreroll method determines if this sample is a preroll sample. A preroll sample should not be displayed.
IMediaSample::IsSyncPoint

The IsSyncPoint method determines if the beginning of this sample is a synchronization point.
IMediaSample::SetActualDataLength

The SetActualDataLength method sets the length of the valid data in the buffer.
IMediaSample::SetDiscontinuity

The SetDiscontinuity method specifies whether this sample represents a break in the data stream.
IMediaSample::SetMediaTime

The SetMediaTime method sets the media times for this sample.
IMediaSample::SetMediaType

The SetMediaType method sets the media type for the sample.
IMediaSample::SetPreroll

The SetPreroll method specifies whether this sample is a preroll sample.
IMediaSample::SetSyncPoint

The SetSyncPoint method specifies whether the beginning of this sample is a synchronization point.
IMediaSample::SetTime

The SetTime method sets the stream times when this sample should begin and finish.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header strmif.h (include Dshow.h)