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.
A version of this page is also available for
4/8/2010

This class represents a buffer object that supports the IMediaSampleinterface. It represents a buffer in memory, together with some associated properties stored as protected data members.

The constructor is passed as a pointer to the buffer with its length in bytes; other properties are normally set and accessed through implemented IMediaSampleinterface methods.

These properties describe various attributes of the media sample, such as the sample's media type, start and end time, and options.

The options can include whether the media sample is a sync point, a preroll sample, or discontinuous with other samples.

All member functions in this class that return HRESULTand accept a pointer as a parameter return E_POINTER when passed a null pointer.

Protected Data Members

Member Description

m_cbBuffer

Size of the buffer.

m_dwFlags

Sample property flags as follows:

  • Sample_Discontinuity: Set if start of a new segment.

  • Sample_MediaTimeValid: Set if the media time is valid.

  • Sample_Preroll: Set if sample is a preroll sample.

  • Sample_StopValid: Set if the stop time is valid.

  • Sample_SyncPoint: Set if sample is a synchronization point.

  • Sample_TimeValid: Set if the time is valid.

  • Sample_TypeChanged: Set if the type has changed.

m_End

Sample end time.

m_lActual

Actual length of data in this sample.

m_MediaEnd

Media end (offset from m_MediaStart).

m_MediaStart

Media start position.

m_pAllocator

Pointer to the IMemAllocatorobject associated with this object.

m_pBuffer

Pointer to the complete buffer.

m_pMediaType

Pointer to a structure containing the media type of the sample.

m_pNext

Pointer to the next CMediaSampleobject in the free list.

m_Start

Sample start time.

Member Functions

Member function Description

CMediaSample

Constructs a CMediaSampleobject.

SetPointer

Sets the buffer pointer and length.

Implemented IUnknown Methods

Method Description

QueryInterface

Retrieves pointers to supported interfaces.

AddRef

Increments the reference count.

Release

Decrements the reference count.

Implemented IMediaSample Methods

Method Description

GetActualDataLength

Retrieves the data length of the sample.

GetMediaTime

Retrieves the media time extents of the sample.

GetMediaType

Retrieves the media type of the CMediaSampleobject.

GetPointer

Retrieves a read/write pointer to the memory of this buffer.

GetSize

Returns the size, in bytes, of the buffer data area.

GetTime

Sets the media time extents for this sample.

IsDiscontinuity

Determines if there is discontinuity in the data stream.

IsPreroll

Indicates a preroll property.

If TRUE, this sample is for preroll only and should not be displayed.

IsSyncPoint

Determines if the beginning of a sample is a synchronization point.

SetActualDataLength

Sets the data length of the sample.

SetDiscontinuity

Sets the discontinuity property.

SetMediaTime

Sets the media time of the CMediaSampleobject.

SetMediaType

Sets the media type of the CMediaSampleobject.

SetPreroll

Sets preroll property. If TRUE, this sample is for preroll only and should not be displayed.

SetSyncPoint

Sets sync-point property.

SetTime

Sets the stream time at which this sample should start and finish.

Implemented INonDelegatingUnknown Methods

Method Description

NonDelegatingQueryInterface

Passes out pointers to any interfaces added to the derived filter class.

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