The ltmmMediaSample object contains a block of media data sent from a Sample Source object or to a Sample Target object. The ltmmMediaSample object, is accessed through the IltmmMediaSampleDisp Interface. The IltmmMediaSampleDisp Interface lets the user set and get information about a ltmmMediaSample object.
Since the ltmmMediaSample Object is derived from the IDispatch object, the IltmmMediaSampleDisp Interface accesses the IDispatch functions, etc. In addition to these functions, the IltmmMediaSampleDisp Interface accesses the following functions:
Functions
IltmmMediaSampleDisp::get_ActualDataLength
IltmmMediaSampleDisp::get_Buffer
IltmmMediaSampleDisp::get_BufferSize
IltmmMediaSampleDisp::get_Discontinuity
IltmmMediaSampleDisp::get_Preroll
IltmmMediaSampleDisp::get_SyncPoint
IltmmMediaSampleDisp::GetMediaTime
IltmmMediaSampleDisp::GetMediaType
IltmmMediaSampleDisp::put_ActualDataLength
IltmmMediaSampleDisp::put_Discontinuity
IltmmMediaSampleDisp::put_Preroll
IltmmMediaSampleDisp::put_SyncPoint
IltmmMediaSampleDisp::ResetMediaTime
IltmmMediaSampleDisp::ResetTime
IltmmMediaSampleDisp::SetMediaTime
IltmmMediaSampleDisp::SetMediaType
Each media sample contains a certain type of media data. Generally, samples sent or received in the same stream will have the same media type. If the media type of one sample differs from the media type of the preceding media sample, the IltmmMediaSampleDisp::GetMediaType function can be used to get the media type of the newest sample. To change the media type of a sample, use the IltmmMediaSampleDisp::SetMediaType function.
The media samples contain a buffer, which contains the actual media data. In addition, they contain more information about the sample in general, and its place in the data stream being sent or retrieved.
Buffer
The buffer contains the actual media data, as well as other related data. To determine the size of this buffer, use the IltmmMediaSampleDisp::get_BufferSize function. This buffer can be accessed directly, by calling the IltmmMediaSampleDisp::get_Buffer function. A copy of the actual data can be obtained by calling the IltmmMediaSampleDisp::GetData function. The size of the actual data must be less than the size of the buffer itself. To get the size of the actual data, use IltmmMediaSampleDisp::get_ActualDataLength. When setting data in the buffer, the actual size of the data to be copied to the buffer is set using IltmmMediaSampleDisp::put_ActualDataLength. The actual data is copied to the buffer using IltmmMediaSampleDisp::SetData.
General
The media sample also contains information about the nature of the sample itself. The sample may serve as a synchronization point for a data stream, or, it may represent a discontinuity in the data stream, or it may be a preroll sample. To get this information from the sample, use the following functions:
IltmmMediaSampleDisp::get_Discontinuity
IltmmMediaSampleDisp::get_Preroll
IltmmMediaSampleDisp::get_SyncPoint
To set this information for a sample, use the following:
IltmmMediaSampleDisp::put_Discontinuity
IltmmMediaSampleDisp::put_Preroll
IltmmMediaSampleDisp::put_SyncPoint
Time Information
A data stream consists of a series of data samples, processed in a certain order. This order is maintained by time stamps, or media stamps, measured in stream time. To get the media times for a sample, call IltmmMediaSampleDisp::GetMediaTime. To get the stream time at which the sample should start and stop, call IltmmMediaSampleDisp::GetTime. These times can be invalidated by calling IltmmMediaSampleDisp::ResetMediaTime and IltmmMediaSampleDisp::ResetTime. To set the media time and stream times for a sample, call IltmmMediaSampleDisp::SetMediaTime and IltmmMediaSampleDisp::SetTime. For more information on time stamps, refer to Time Stamps.
Sample duplication
Copy everything (Buffer, General and Time information attributes) using IltmmMediaSampleDisp::CopyTo. Allocate a new sample with a complete copy of the Buffer, General and Time information attributes using IltmmMediaSampleDisp::Clone. This is useful to hold a sample and deliver it later, because getting two sample buffers from the same filter will usually invalidate the previous sample.
Win32, x64
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document