public class MFMediaType : MFAttributes
Represents a description of a media format.
MFMediaType(IntPtr ptr)
Initializes a new instance of the MFMediaType class.
public void MFMediaType(IntPtr ptr)
Parameters
ptr
IntPtrThe native pointer of the COM object.
CreateEmpty()
Creates an empty MFMediaType.
public static MFMediaType CreateEmpty()
Returns
Returns an empty MFMediaType.
FreeRepresentation(Guid guidRepresentation, IntPtr representation)
Frees memory that was allocated by the GetRepresentation method.
public void FreeRepresentation(Guid guidRepresentation, IntPtr representation)
Parameters
guidRepresentation
GuidGuid that was passed to the GetRepresentation method.
representation
IntPtrPointer to the buffer that was returned by the GetRepresentation method.
Remarks
For more information, see .
FreeRepresentationNative(Guid guidRepresentation, IntPtr representation)
Frees memory that was allocated by the GetRepresentation method.
public Int32 FreeRepresentationNative(Guid guidRepresentation, IntPtr representation)
Parameters
guidRepresentation
GuidGuid that was passed to the GetRepresentation method.
representation
IntPtrPointer to the buffer that was returned by the GetRepresentation method.
Returns
HRESULT
Remarks
For more information, see .
FromWaveFormat(WaveFormat waveFormat)
Creates a new MFMediaType based on a specified waveFormat.
public static MFMediaType FromWaveFormat(WaveFormat waveFormat)
Parameters
waveFormat
WaveFormatWaveFormat which should be "converted" to a MFMediaType.
Returns
Returns a new MFMediaType.
GetMajorType()
Gets the major type of the format.
GetMajorTypeNative(Guid& majorType)
Gets the major type of the format.
public Int32 GetMajorTypeNative(Guid& majorType)
Parameters
majorType
Guid&Receives the major type Guid. The major type describes the broad category of the format, such as audio or video. For a list of possible values, see .
Returns
HRESULT
GetRepresentation(Guid guidRepresentation)
Retrieves an alternative representation of the media type. Currently only the DirectShow AMMEDIATYPE structure is supported.
public IntPtr GetRepresentation(Guid guidRepresentation)
Parameters
guidRepresentation
GuidGuid that specifies the representation to retrieve. The following values are defined.
Returns
A pointer to a structure that contains the representation. The method allocates the memory for the structure. The caller must release the memory by calling FreeRepresentation.
Remarks
For more information, see .
GetRepresentationNative(Guid guidRepresentation, IntPtr& representation)
Retrieves an alternative representation of the media type. Currently only the DirectShow AMMEDIATYPE structure is supported.
public Int32 GetRepresentationNative(Guid guidRepresentation, IntPtr& representation)
Parameters
guidRepresentation
GuidGuid that specifies the representation to retrieve. The following values are defined.
representation
IntPtr&Receives a pointer to a structure that contains the representation. The method allocates the memory for the structure. The caller must release the memory by calling FreeRepresentation.
Returns
HRESULT
Remarks
For more information, see .
IsCompressedFormat()
Queries whether the media type is a temporally compressed format. Temporal compression uses information from previously decoded samples when decompressing the current sample.
IsCompressedFormatNative(NativeBool& iscompressed)
Queries whether the media type is a temporally compressed format. Temporal compression uses information from previously decoded samples when decompressing the current sample.
public Int32 IsCompressedFormatNative(NativeBool& iscompressed)
Parameters
iscompressed
NativeBool&Receives a Boolean value. The value is TRUE if the format uses temporal compression, or FALSE if the format does not use temporal compression.
Returns
HRESULT
IsEqual(MFMediaType mediaType)
Compares two media types and determines whether they are identical. If they are not identical, the method indicates how the two formats differ.
IsEqualNative(MFMediaType mediaType, MediaTypeEqualFlags& flags)
Compares two media types and determines whether they are identical. If they are not identical, the method indicates how the two formats differ.
public Int32 IsEqualNative(MFMediaType mediaType, MediaTypeEqualFlags& flags)
Parameters
mediaType
MFMediaTypeThe MFMediaType to compare.
flags
MediaTypeEqualFlags&Receives a bitwise OR of zero or more flags, indicating the degree of similarity between the two media types.
Returns
HRESULT
ToWaveFormat(MFWaveFormatExConvertFlags flags)
Converts the MFMediaType to a WaveFormat.
public WaveFormat ToWaveFormat(MFWaveFormatExConvertFlags flags)
Parameters
flags
MFWaveFormatExConvertFlagsContains a flag from the MFWaveFormatExConvertFlags enumeration.
Returns
The WaveFormat which got created based on the MFMediaType.
AverageBytesPerSecond
Gets or sets the average number of bytes per second.
public Int32 AverageBytesPerSecond { get; set; }
BitsPerSample
Gets or sets the number of bits per sample.
public Int32 BitsPerSample { get; set; }
ChannelMask
Gets or sets the channelmask.
public ChannelMask ChannelMask { get; set; }
Channels
Gets or sets the number of channels.
public Int32 Channels { get; set; }
IsCompressed
Gets a value, indicating whether the media type is a temporally compressed format. Temporal compression uses information from previously decoded samples when decompressing the current sample.
public NativeBool IsCompressed { get; }
MajorType
Gets or sets the major type.
public Guid MajorType { get; set; }
SampleRate
Gets or sets the number of samples per second (for one channel each).
public Int32 SampleRate { get; set; }
SubType
Gets or sets the audio subtype.
public Guid SubType { get; set; }