Microsoft DirectX 8.0 |
Sets and retrieves properties on media samples. This interface inherits the IMediaSample interface. The IMediaSample interface requires separate method calls for each sample property. The IMediaSample2 interface adds methods that set or retrieve multiple properties at once.
Media samples are not guaranteed to support IMediaSample2. However, if an allocator does create samples that support IMediaSample2, all of the samples it generates must support the interface.
Methods in Vtable Order
IUnknown methods Description QueryInterface Retrieves 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 Retrieves the size of the buffer. GetTime Retrieves the stream times at which this sample should begin and finish. SetTime Sets the stream time when this sample should begin and finish. IsSyncPoint Determines if the beginning of this sample is a synchronization point. SetSyncPoint Specifies whether the beginning of this sample is a synchronization point. IsPreroll Determines if this sample is a preroll sample. SetPreroll Specifies whether this sample is a preroll sample. GetActualDataLength Retrieves the length of the valid data in the buffer. SetActualDataLength Sets the length of the valid data in the buffer. GetMediaType Retrieves the media type, if the media type differs from the previous sample. SetMediaType Sets the media type for the sample. IsDiscontinuity Determines if this sample represents a break in the data stream. SetDiscontinuity Specifies whether this sample represents a break in the data stream. GetMediaTime Retrieves the media times for this sample. SetMediaTime Sets the media times for this sample. IMediaSample2 methods Description GetProperties Retrieves the properties of a media sample. SetProperties Sets the properties of a media sample.
Retrieves the properties of a media sample.
Syntax
HRESULT GetProperties( DWORD cbProperties, BYTE *pbProperties );
Parameters
- cbProperties
- [in] Length of property data to retrieve, in bytes.
- pbProperties
- [out] Pointer to a buffer of size cbProperties.
Return Value
Returns an HRESULT value. Possible values include the following.
S_OK Success. E_POINTER NULL pointer argument.
Remarks
The retrieved data conforms to the format of the AM_SAMPLE2_PROPERTIES structure. You can retrieve a subset of the sample properties by setting cbProperties to a value less than the size of the AM_SAMPLE2_PROPERTIES structure.
For efficiency, the pMediaType member returned in AM_SAMPLE2_PROPERTIES is a pointer to the data stored in the media sample, not a copy of that data. The pointer may become invalid after the sample is passed to another filter, or after the input pin's IMemInputPin::Receive method has completed. Also, do not free the pointer or delete the media type.
Sets the properties of a media sample.
Syntax
HRESULT SetProperties( DWORD cbProperties, const BYTE *pbProperties );
Parameters
- cbProperties
- [in] Length of property data to set, in bytes.
- pbProperties
- [in] Pointer to a buffer of size cbProperties.
Return Value
Returns an HRESULT value. Possible values include the following.
S_OK Success. E_INVALIDARG Invalid argument. E_OUTOFMEMORY Insufficient memory. E_POINTER NULL pointer argument.
Remarks
The data contained in pbProperties must conform to the format of the AM_SAMPLE2_PROPERTIES structure. You can specify a subset of the sample properties by setting cbProperties to a value less than the size of the AM_SAMPLE2_PROPERTIES structure.