IMediaSample2 Interface
A version of this page is also available for
4/8/2010
This interface derives from the IMediaSample interface. It enables you to set and to retrieve sample properties such as start and stop time that are defined in AM_SAMPLE2_PROPERTIES, and sample flags defined in the AM_SAMPLE_PROPERTY_FLAGS structure.
When to Implement
Implement this interface when you implement an allocator that creates media samples. The CMediaSample class in the DirectShow class library implements this interface.
When to Use
Use this interface when you want to retrieve properties from a media sample that are available through this interface and through the IMediaSample interface or if you want to retrieve multiple sample properties in one call.
Not all media samples will support IMediaSample2, so use the IUnknown::QueryInterface method to get a pointer to the sample's IMediaSample2 interface and check for failure.
If an allocator generates samples, then either all of the media samples must support IMediaSample2 or none of them will.
Methods in Vtable Order
The following tables show the methods that appear in the Vtable beneath the standard COM methods inherited from IUnknown.
IMediaSample method | Description |
---|---|
Retrieves a read/write pointer to this buffer's memory. |
|
Returns the size, in bytes, of the buffer data area. |
|
Retrieves the stream times at which this sample should begin and finish. |
|
Sets the stream times at which this sample should begin and finish. |
|
Determines if the beginning of a sample is a synchronization point. |
|
Sets the synchronization point. |
|
Indicates a preroll property. If TRUE, this sample is for preroll only and should not be displayed. |
|
Sets the preroll property. If TRUE, this sample is for preroll only and should not be displayed. |
|
Retrieves the data length of the sample. |
|
Sets the data length of the sample. |
|
Retrieves the media type of the sample. |
|
Sets the media type of the sample. |
|
Indicates a discontinuity property. If S_OK is returned, sample is not contiguous with previous sample. |
|
Sets the discontinuity property. Set to TRUE if sample is new after a seek or dropped sample. |
|
Retrieves the media time stamps for the sample. |
|
Sets the media time stamps for the sample. |
IMediaSample2 method | Description |
---|---|
Retrieves the properties of a media sample. |
|
Sets the properties of a media sample. |
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 |