IMFSample interface

Represents a media sample, which is a container object for media data. For video, a sample typically contains one video frame. For audio data, a sample typically contains multiple audio samples, rather than a single sample of audio.

A media sample contains zero or more buffers. Each buffer manages a block of memory, and is represented by the IMFMediaBuffer interface. A sample can have multiple buffers. The buffers are kept in an ordered list and accessed by index value. It is also valid to have an empty sample with no buffers.

Members

The IMFSample interface inherits from IMFAttributes. IMFSample also has these types of members:

Methods

The IMFSample interface has these methods.

MethodDescription
AddBuffer

Adds a buffer to the end of the list of buffers in the sample.

ConvertToContiguousBuffer

Converts a sample with multiple buffers into a sample with a single buffer.

CopyToBuffer

Copies the sample data to a buffer.

GetBufferByIndex

Retrieves a buffer from the sample.

GetBufferCount

Retrieves the number of buffers in the sample.

GetSampleDuration

Retrieves the duration of the sample.

GetSampleFlags

Retrieves flags associated with the sample.

GetSampleTime

Retrieves the presentation time of the sample.

GetTotalLength

Retrieves the total length of the valid data in all of the buffers in the sample.

RemoveAllBuffers

Removes all buffers from the sample.

RemoveBufferByIndex

Removes a buffer at a specified index from the sample.

SetSampleDuration

Sets the duration of the sample.

SetSampleFlags

Sets flags associated with the sample.

SetSampleTime

Sets the presentation time of the sample.

 

Remarks

To create a new media sample, call MFCreateSample.

This interface is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:

  • Windows XP with Service Pack 2 (SP2) and later.
  • Windows XP Media Center Edition 2005 with KB900325 (Windows XP Media Center Edition 2005) and KB925766 (October 2006 Update Rollup for Windows XP Media Center Edition) installed.

Requirements

Minimum supported client

Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 [desktop apps | Windows Store apps]

Header

Mfobjects.h (include Mfidl.h)

Library

Mfuuid.lib

See also

Media Foundation Interfaces
Sample Attributes
Media Samples

 

 

Community Additions

ADD
Show:
© 2014 Microsoft