ltmmMediaSample Object
The ltmmMediaSample Object is an automation wrapper object for the DirectShow MediaSample object. It is used to encapsulate media samples returned from the ltmmSampleSource and ltmmSampleTarget objects. A media sample is a COM object that contains a block of media data. Media samples support the use of shared memory buffers among filters belonging to the same graph.
To create an instance of an ltmmMediaSample object:
Dim object As ltmmMediaSample
Set object = New ltmmMediaSample
The ltmmMediaSample Object contains the following properties and methods:
Properties
ltmmMediaSample.ActualDatalength
Methods
ltmmMediaSample.ResetMediaTime
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 ltmmMediaSample.GetMediaType method can be used to get the media type of the newest sample. To change the media type of a sample, use the ltmmMediaSample.SetMediaType method.
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 ltmmMediaSample.BufferSize property. This buffer can be accessed directly, by the ltmmMediaSample.Buffer property. A copy of the actual data can be obtained by calling the ltmmMediaSample.GetData method. The size of the actual data must be less than the size of the buffer itself. To get and set the size of the actual data, use ltmmMediaSample.ActualDatalength. The actual data is copied to the buffer using ltmmMediaSample.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 or set this information from the sample, use the following properties:
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 ltmmMediaSample.GetMediaTime. To get the stream time at which the sample should start and stop, call ltmmMediaSample.GetTime. These times can be invalidated by calling ltmmMediaSample.ResetMediaTime and ltmmMediaSample.ResetTime. To set the media time and stream times for a sample, call ltmmMediaSample.SetMediaTime and ltmmMediaSample.SetTime. For more information on time stamps, refer to Time Stamps.
See Also