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:
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.
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.
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:
To set this information for a sample, use the following:
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.
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.
Medical Web Viewer .NET