The ltmmMediaType Object is a wrapper object for the DirectShow AM_MEDIA_TYPE structure. It is used to describe the media sample formats returned from and written to the ltmmSampleSource, ltmmSampleTarget, and ltmmMediaSample objects.
To create an instance of an ltmmMediaType object:
Dim object As ltmmMediaType
Set object = New ltmmMediaType
The ltmmMediaType Object contains the following properties and methods:
Properties
ltmmMediaType.FixedSizeSamples
ltmmMediaType.TemporalCompression
Methods
Before sending samples or receiving samples, a sample source object or sample target object should set the media type sent or accepted by that object.
LEADTOOLS offers both a high level and a low level methods for handling the media type.
High level
The media type information can be obtained in a flat or "portable" format that contains all the necessary information to fully reconstruct the media type. This prevents the user from having to worry about the specific type, subtype, and format information. To get this "portable" media type information, use the ltmmMediaType.GetPortableType method.
Once the media type has been obtained by calling the ltmmMediaType.GetPortableType method, it can then be used to set the media type for other objects by using the ltmmMediaType.SetPortableType method. Please note that only data retrieved using the ltmmMediaType.GetPortableType method should be passed to the ltmmMediaType.SetPortableType method. These two methods allow the user to get a media type from one sample and use that media type to set another sample.
Low level
The low level method for handling the media type requires the user to be familiar with media types, subtypes and any format types that may be encountered. All information can be obtained and set individually, using the following properties and methods:
ltmmMediaType.FixedSizeSamples Property
ltmmMediaType.FormatSize Property
ltmmMediaType.FormatType Property
ltmmMediaType.SampleSize Property
ltmmMediaType.Subtype Property
ltmmMediaType.TemporalCompression Property
ltmmMediaType.GetFormatData Method
ltmmMediaType.SetFormatData Method
The media samples sent from a sample source object or to a sample target object may be of a fixed (the same) size, or may be different sizes. The ltmmMediaType.FixedSizeSamples property indicates whether the samples are of fixed (the same) size or not. The ltmmMediaType.SampleSize Property provides the size of the sample. To change or set the "Fixed size" state of a sample, use ltmmMediaType.FixedSizeSamples. To change or set the size of the sample, use ltmmMediaType.SampleSize.
A media sample has a certain media type. Each "media type" consists of three attributes, the Type, Subtype and FormatType. The "Type" of the sample may be MEDIATYPE_Video, or MEDIATYPE_Stream, or some other type. To determine or assign the major media type of a media sample, use the ltmmMediaType.Type Property.
A format type may also have a subtype. For "Type" MEDIATYPE_Video, the "Subtype" may be MEDIASUBTYPE_RGB24. To determine or assign the subtype, use the ltmmMediaType.Subtype Property.
The "FormatType" specifies additional information for a specific Type-Subtype combination. The ltmmMediaType.FormatType Property provides information on the kind of data found in the Format buffer. The Format buffer can be accessed directly, by the ltmmMediaType.Format Property, or a copy of the buffer can be obtained by calling the ltmmMediaType.GetFormatData Method. The format data itself must actually be copied to the format buffer. This is done using the ltmmMediaType.SetFormatData Method. To determine or change the size of the format buffer, use the ltmmMediaType.FormatSize Property. For more information on available "Types", "Subtypes" and "FormatTypes", refer to the DirectShow documentation.
Media samples can be compressed using temporal or interframe compression. The ltmmMediaType.TemporalCompression Property can be used to determine whether samples are compressed using temporal compression.
Win32, x64
See Also