Microsoft Media Foundation官方文档翻译(20)《Stream Subtype GUIDs》《...

官方英文文档链接:https://docs.microsoft.com/en-us/windows/desktop/medfound/stream-subtype-guids

基于05/31/2018

Media Type 剩下的几篇都在此页

Stream Subtype GUIDs

Complete and Partial Media Type

Media Type Conversions

Media Type Helper Funtions

Media Type Debugging Code

 

Stream Subtype GUIDs

  • 05/31/2018
  • 2 minutes to read

下面的 subtype GUIDs 定义在 mfapi.h 头文件中。要设定这些 subtype,使用 MF_MT_SUBTYPE attribute

当设置了这些 subtype 时,需要将 MF_MT_MAJOR_TYPE attribute 设为 MFMediaType_Stream

GUIDDescription
MFStreamFormat_MPEG2Program MPEG-2 program stream
MFStreamFormat_MPEG2Transport MPEG-2 transport stream.

 

Complete and Partial Media Types

  • 05/31/2018
  • 2 minutes to read

此文介绍 complete media types 与 partial media types 的区别。

Complete Media Types

complete media 是完全定义媒体流格式的类型。给定完整的媒体类型,管道组件可以分析与媒体类型关联的流数据,而不会出现歧义。

对于未压缩的格式,以下主题定义了 complete media type 所需要的 attribute:

对于压缩过的 (或编码过) 的流,complete media type 的定义由编解码器定义。

Partial Media Types

partial media 缺少完整媒体类型所需的一个或多个属性。枚举可能的媒体类型时,Microsoft Media Foundation 组件可能会保留未设置的值,以指示它可以处理任何值。例如, 视频处理器可能会保留 MF_MT_FRAME_RATE attribute,以表示它可以处理任何帧速率,并在必要时执行帧速率转换。

如果创建 partial media type,则仍应包含所知道的尽可能多的信息。但是,不要包含不确定的信息。信息缺失总比错误好。

partial media type 至少应该包含这两个信息: MF_MT_MAJOR_TYPEand MF_MT_SUBTYPE

有时候是必须使用 complete media types:

  • Media sources 必须提供 complete output types.
  • 解码器在设置 input type 之后必须提供 complete output types。在设置 input type 之前,解码器也许可以提供 partial output type。
  • 编码器在设置 output type 之后必须提供 complete input types,在设置 output type 之前,编码器也许可以提供 partial input type。

 

Media Type Conversions

  • 05/31/2018
  • 3 minutes to read

有时需要在 Media Foundation media types 和更老的 DirectShow 或 Windows Media Format SDK 里的 media type 结构之间进行转换。

From a Format Structure to a Media Foundation Type

下面的函数使用一个 format structure 来初始化 Media Foundation media type。当数据流或者文件头包含有 format structure 时也可以使用这些函数。例如 WAVE 音频文件开头就包含一个 WAVEFORMATEX 结构体。

Structure to ConvertFunction
AM_MEDIA_TYPE (DirectShow)
DMO_MEDIA_TYPE (DirectX Media Objects) 
WM_MEDIA_TYPE (Windows Media Format SDK) 
[!Note]
These structures are equivalent.


MFInitMediaTypeFromAMMediaType
BITMAPINFOHEADER MFCreateVideoMediaTypeFromBitMapInfoHeaderEx
MFVIDEOFORMAT MFInitMediaTypeFromMFVideoFormat
MPEG1VIDEOINFO MFInitMediaTypeFromMPEG1VideoInfo
MPEG2VIDEOINFO MFInitMediaTypeFromMPEG2VideoInfo
VIDEOINFOHEADER2 MFInitMediaTypeFromVideoInfoHeader2
VIDEOINFOHEADER MFInitMediaTypeFromVideoInfoHeader
WAVEFORMATEX or WAVEFORMATEXTENSIBLE MFInitMediaTypeFromWaveFormatEx

 

From a Media Foundation Type to a Format Structure

下面的函数使用 Media Foundation media type 来创建或者初始化一个 format structure。

FunctionTarget Structure
IMFMediaType::GetRepresentation AM_MEDIA_TYPEMFVIDEOFORMATVIDEOINFOHEADER, or VIDEOINFOHEADER2
MFCreateAMMediaTypeFromMFMediaType AM_MEDIA_TYPE
MFCreateMFVideoFormatFromMFMediaType MFVIDEOFORMAT
MFCreateWaveFormatExFromMFMediaType WAVEFORMATEX or WAVEFORMATEXTENSIBLE
MFInitAMMediaTypeFromMFMediaType AM_MEDIA_TYPE

 

Format Mappings

下表列出了 Media Foundation attributes 与对应的 format structure 属性。并非所有的这些属性都可以直接转换。若要执行转换,参考上一节列出的函数。这个表格仅供参考。

AM_MEDIA_TYPE

MemberAttribute
bTemporalCompression MF_MT_ALL_SAMPLES_INDEPENDENT
bFixedSizeSamples MF_MT_FIXED_SIZE_SAMPLES
lSampleSize MF_MT_SAMPLE_SIZE

 

WAVEFORMATEX, WAVEFORMATEXTENSIBLE

MemberAttribute
wFormatTag MF_MT_SUBTYPE
If wFormatTag is WAVE_FORMAT_EXTENSIBLE, the subtype is found in the SubFormat member.
nChannels MF_MT_AUDIO_NUM_CHANNELS
nSamplesPerSec MF_MT_AUDIO_SAMPLES_PER_SECOND
nAvgBytesPerSec MF_MT_AUDIO_AVG_BYTES_PER_SECOND
nBlockAlign MF_MT_AUDIO_BLOCK_ALIGNMENT
wBitsPerSample MF_MT_AUDIO_BITS_PER_SAMPLE
wValidBitsPerSample MF_MT_AUDIO_VALID_BITS_PER_SAMPLE
wSamplesPerBlock MF_MT_AUDIO_SAMPLES_PER_BLOCK
dwChannelMask MF_MT_AUDIO_CHANNEL_MASK
SubFormat MF_MT_SUBTYPE
Extra data MF_MT_USER_DATA

 

VIDEOINFOHEADER, VIDEOINFOHEADER2

MemberAttribute
dwBitRate MF_MT_AVG_BITRATE
dwBitErrorRate MF_MT_AVG_BIT_ERROR_RATE
AvgTimePerFrame MF_MT_FRAME_RATE; use MFAverageTimePerFrameToFrameRateto calculate this value.
dwInterlaceFlags MF_MT_INTERLACE_MODE
dwCopyProtectFlags No defined equivalent
dwPictAspectRatioXdwPictAspectRatioY MF_MT_PIXEL_ASPECT_RATIO; must convert from picture aspect ratio to picture aspect ratio.
dwControlFlags MF_MT_PAD_CONTROL_FLAGS. If the AMCONTROL_COLORINFO_PRESENT flag is present, set the extended color attributes described in Extended Color Information.
bmiHeader.biWidthbmiHeader.biHeight MF_MT_FRAME_SIZE
bmiHeader.biBitCount Implicit in the subtype (MF_MT_SUBTYPE).
bmiHeader.biCompression Implicit in the subtype.
bmiHeader.biSizeImage MF_MT_SAMPLE_SIZE
Palette information MF_MT_PALETTE

 

下面的属性可以从 VIDEOINFOHEADER 或 VIDEOINFOHEADER2 结构推断出来,但是这要求对格式细节有一定的了解。例如不同的 YUV 格式有不同的 stride。

MPEG1VIDEOINFO

MemberAttribute
dwStartTimeCode MF_MT_MPEG_START_TIME_CODE
bSequenceHeader MF_MT_MPEG_SEQUENCE_HEADER
biXPelsPerMeterbiYPelsPerMeter MF_MT_PIXEL_ASPECT_RATIO

 

MPEG2VIDEOINFO

MemberAttribute
dwStartTimeCode MF_MT_MPEG_START_TIME_CODE
dwSequenceHeader MF_MT_MPEG_SEQUENCE_HEADER
dwProfile MF_MT_MPEG2_PROFILE
dwLevel MF_MT_MPEG2_LEVEL
dwFlags MF_MT_MPEG2_FLAGS

 

Examples

下面的代码使用一个 video media type,补充了一个 BITMAPINFOHEADER。注意这个转换丢掉了一些信息(隔行扫描,帧率,扩展颜色数据),然而在从视频帧保存成位图时,可能需要这些信息。

 1 #include <dshow.h>
 2 #include <dvdmedia.h>
 3 
 4 // Converts a video type to a BITMAPINFO structure.
 5 // The caller must free the structure by calling CoTaskMemFree.
 6 
 7 // Note that this conversion loses some format information, including 
 8 // interlacing, and frame rate.
 9 
10 HRESULT GetBitmapInfoHeaderFromMFMediaType(
11     IMFMediaType *pType,            // Pointer to the media type.
12     BITMAPINFOHEADER **ppBmih,      // Receives a pointer to the structure. 
13     DWORD *pcbSize)                 // Receives the size of the structure.
14 {
15     *ppBmih = NULL;
16     *pcbSize = 0;
17 
18     GUID majorType = GUID_NULL;
19     AM_MEDIA_TYPE *pmt = NULL;
20     DWORD cbSize = 0;
21     DWORD cbOffset = 0;
22     BITMAPINFOHEADER *pBMIH = NULL;
23 
24     // Verify that this is a video type.
25     HRESULT hr = pType->GetMajorType(&majorType);
26     if (FAILED(hr))
27     {
28         goto done;
29     }
30 
31     if (majorType != MFMediaType_Video)
32     {
33         hr = MF_E_INVALIDMEDIATYPE;
34         goto done;
35     }
36 
37     hr = pType->GetRepresentation(AM_MEDIA_TYPE_REPRESENTATION, (void**)&pmt);
38     if (FAILED(hr))
39     {
40         goto done;
41     }
42 
43     if (pmt->formattype == FORMAT_VideoInfo)
44     {
45         cbOffset = (FIELD_OFFSET(VIDEOINFOHEADER,bmiHeader));
46     }
47     else if (pmt->formattype == FORMAT_VideoInfo2)
48     {
49         cbOffset = (FIELD_OFFSET(VIDEOINFOHEADER2,bmiHeader));
50     }
51     else
52     {
53         hr = MF_E_INVALIDMEDIATYPE; // Unsupported format type.
54         goto done;
55     }
56 
57     if (pmt->cbFormat - cbOffset < sizeof(BITMAPINFOHEADER))
58     {
59         hr = E_UNEXPECTED; // Bad format size. 
60         goto done;
61     }
62 
63     cbSize = pmt->cbFormat - cbOffset;
64 
65     pBMIH = (BITMAPINFOHEADER*)CoTaskMemAlloc(cbSize);
66     if (pBMIH == NULL)
67     {
68         hr = E_OUTOFMEMORY;
69         goto done;
70     }
71     
72     CopyMemory(pBMIH, pmt->pbFormat + cbOffset, cbSize);
73     
74     *ppBmih = pBMIH;
75     *pcbSize = cbSize;
76 
77 done:
78     if (pmt)
79     {
80         pType->FreeRepresentation(AM_MEDIA_TYPE_REPRESENTATION, pmt);
81     }
82     return hr;
83 }

 

 

 

Media Type Helper Functions

  • 05/31/2018
  • 2 minutes to read

下面是一些与 media type 相关的函数。

FunctionDescription
MFAverageTimePerFrameToFrameRate Calculates the frame rate from the average duration of a video frame.
MFCalculateImageSize Retrieves the image size for an uncompressed video format.
MFCompareFullToPartialMediaType Compares a full media type to a partial media type.
MFCreateMediaType Creates an empty media type.
MFFrameRateToAverageTimePerFrame Converts a video frame rate into a frame duration.
MFGetStrideForBitmapInfoHeader Retrieves the minimum surface stride for a video format.
MFIsFormatYUV Queries whether a FOURCC code or D3DFORMAT value is a YUV format.
MFValidateMediaTypeSize Validates the size of a buffer for a video format block.
MFWrapMediaType Creates a media type that wraps another media type.

 

 

Media Type Debugging Code

  • 05/31/2018
  • 4 minutes to read

下面的代码可以在调试时输出 media type 的内容。

  1 // The following code enables you to view the contents of a media type while 
  2 // debugging.
  3 
  4 #include <strsafe.h>
  5 
  6 LPCWSTR GetGUIDNameConst(const GUID& guid);
  7 HRESULT GetGUIDName(const GUID& guid, WCHAR **ppwsz);
  8 
  9 HRESULT LogAttributeValueByIndex(IMFAttributes *pAttr, DWORD index);
 10 HRESULT SpecialCaseAttributeValue(GUID guid, const PROPVARIANT& var);
 11 
 12 void DBGMSG(PCWSTR format, ...);
 13 
 14 HRESULT LogMediaType(IMFMediaType *pType)
 15 {
 16     UINT32 count = 0;
 17 
 18     HRESULT hr = pType->GetCount(&count);
 19     if (FAILED(hr))
 20     {
 21         return hr;
 22     }
 23 
 24     if (count == 0)
 25     {
 26         DBGMSG(L"Empty media type.\n");
 27     }
 28 
 29     for (UINT32 i = 0; i < count; i++)
 30     {
 31         hr = LogAttributeValueByIndex(pType, i);
 32         if (FAILED(hr))
 33         {
 34             break;
 35         }
 36     }
 37     return hr;
 38 }
 39 
 40 HRESULT LogAttributeValueByIndex(IMFAttributes *pAttr, DWORD index)
 41 {
 42     WCHAR *pGuidName = NULL;
 43     WCHAR *pGuidValName = NULL;
 44 
 45     GUID guid = { 0 };
 46 
 47     PROPVARIANT var;
 48     PropVariantInit(&var);
 49 
 50     HRESULT hr = pAttr->GetItemByIndex(index, &guid, &var);
 51     if (FAILED(hr))
 52     {
 53         goto done;
 54     }
 55 
 56     hr = GetGUIDName(guid, &pGuidName);
 57     if (FAILED(hr))
 58     {
 59         goto done;
 60     }
 61 
 62     DBGMSG(L"\t%s\t", pGuidName);
 63 
 64     hr = SpecialCaseAttributeValue(guid, var);
 65     if (FAILED(hr))
 66     {
 67         goto done;
 68     }
 69     if (hr == S_FALSE)
 70     {
 71         switch (var.vt)
 72         {
 73         case VT_UI4:
 74             DBGMSG(L"%d", var.ulVal);
 75             break;
 76 
 77         case VT_UI8:
 78             DBGMSG(L"%I64d", var.uhVal);
 79             break;
 80 
 81         case VT_R8:
 82             DBGMSG(L"%f", var.dblVal);
 83             break;
 84 
 85         case VT_CLSID:
 86             hr = GetGUIDName(*var.puuid, &pGuidValName);
 87             if (SUCCEEDED(hr))
 88             {
 89                 DBGMSG(pGuidValName);
 90             }
 91             break;
 92 
 93         case VT_LPWSTR:
 94             DBGMSG(var.pwszVal);
 95             break;
 96 
 97         case VT_VECTOR | VT_UI1:
 98             DBGMSG(L"<<byte array>>");
 99             break;
100 
101         case VT_UNKNOWN:
102             DBGMSG(L"IUnknown");
103             break;
104 
105         default:
106             DBGMSG(L"Unexpected attribute type (vt = %d)", var.vt);
107             break;
108         }
109     }
110 
111 done:
112     DBGMSG(L"\n");
113     CoTaskMemFree(pGuidName);
114     CoTaskMemFree(pGuidValName);
115     PropVariantClear(&var);
116     return hr;
117 }
118 
119 HRESULT GetGUIDName(const GUID& guid, WCHAR **ppwsz)
120 {
121     HRESULT hr = S_OK;
122     WCHAR *pName = NULL;
123 
124     LPCWSTR pcwsz = GetGUIDNameConst(guid);
125     if (pcwsz)
126     {
127         size_t cchLength = 0;
128     
129         hr = StringCchLength(pcwsz, STRSAFE_MAX_CCH, &cchLength);
130         if (FAILED(hr))
131         {
132             goto done;
133         }
134         
135         pName = (WCHAR*)CoTaskMemAlloc((cchLength + 1) * sizeof(WCHAR));
136 
137         if (pName == NULL)
138         {
139             hr = E_OUTOFMEMORY;
140             goto done;
141         }
142 
143         hr = StringCchCopy(pName, cchLength + 1, pcwsz);
144         if (FAILED(hr))
145         {
146             goto done;
147         }
148     }
149     else
150     {
151         hr = StringFromCLSID(guid, &pName);
152     }
153 
154 done:
155     if (FAILED(hr))
156     {
157         *ppwsz = NULL;
158         CoTaskMemFree(pName);
159     }
160     else
161     {
162         *ppwsz = pName;
163     }
164     return hr;
165 }
166 
167 void LogUINT32AsUINT64(const PROPVARIANT& var)
168 {
169     UINT32 uHigh = 0, uLow = 0;
170     Unpack2UINT32AsUINT64(var.uhVal.QuadPart, &uHigh, &uLow);
171     DBGMSG(L"%d x %d", uHigh, uLow);
172 }
173 
174 float OffsetToFloat(const MFOffset& offset)
175 {
176     return offset.value + (static_cast<float>(offset.fract) / 65536.0f);
177 }
178 
179 HRESULT LogVideoArea(const PROPVARIANT& var)
180 {
181     if (var.caub.cElems < sizeof(MFVideoArea))
182     {
183         return MF_E_BUFFERTOOSMALL;
184     }
185 
186     MFVideoArea *pArea = (MFVideoArea*)var.caub.pElems;
187 
188     DBGMSG(L"(%f,%f) (%d,%d)", OffsetToFloat(pArea->OffsetX), OffsetToFloat(pArea->OffsetY), 
189         pArea->Area.cx, pArea->Area.cy);
190     return S_OK;
191 }
192 
193 // Handle certain known special cases.
194 HRESULT SpecialCaseAttributeValue(GUID guid, const PROPVARIANT& var)
195 {
196     if ((guid == MF_MT_FRAME_RATE) || (guid == MF_MT_FRAME_RATE_RANGE_MAX) ||
197         (guid == MF_MT_FRAME_RATE_RANGE_MIN) || (guid == MF_MT_FRAME_SIZE) ||
198         (guid == MF_MT_PIXEL_ASPECT_RATIO))
199     {
200         // Attributes that contain two packed 32-bit values.
201         LogUINT32AsUINT64(var);
202     }
203     else if ((guid == MF_MT_GEOMETRIC_APERTURE) || 
204              (guid == MF_MT_MINIMUM_DISPLAY_APERTURE) || 
205              (guid == MF_MT_PAN_SCAN_APERTURE))
206     {
207         // Attributes that an MFVideoArea structure.
208         return LogVideoArea(var);
209     }
210     else
211     {
212         return S_FALSE;
213     }
214     return S_OK;
215 }
216 
217 void DBGMSG(PCWSTR format, ...)
218 {
219     va_list args;
220     va_start(args, format);
221 
222     WCHAR msg[MAX_PATH];
223 
224     if (SUCCEEDED(StringCbVPrintf(msg, sizeof(msg), format, args)))
225     {
226         OutputDebugString(msg);
227     }
228 }
229 
230 #ifndef IF_EQUAL_RETURN
231 #define IF_EQUAL_RETURN(param, val) if(val == param) return L#val
232 #endif
233 
234 LPCWSTR GetGUIDNameConst(const GUID& guid)
235 {
236     IF_EQUAL_RETURN(guid, MF_MT_MAJOR_TYPE);
237     IF_EQUAL_RETURN(guid, MF_MT_MAJOR_TYPE);
238     IF_EQUAL_RETURN(guid, MF_MT_SUBTYPE);
239     IF_EQUAL_RETURN(guid, MF_MT_ALL_SAMPLES_INDEPENDENT);
240     IF_EQUAL_RETURN(guid, MF_MT_FIXED_SIZE_SAMPLES);
241     IF_EQUAL_RETURN(guid, MF_MT_COMPRESSED);
242     IF_EQUAL_RETURN(guid, MF_MT_SAMPLE_SIZE);
243     IF_EQUAL_RETURN(guid, MF_MT_WRAPPED_TYPE);
244     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_NUM_CHANNELS);
245     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_SAMPLES_PER_SECOND);
246     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_FLOAT_SAMPLES_PER_SECOND);
247     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_AVG_BYTES_PER_SECOND);
248     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_BLOCK_ALIGNMENT);
249     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_BITS_PER_SAMPLE);
250     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_VALID_BITS_PER_SAMPLE);
251     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_SAMPLES_PER_BLOCK);
252     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_CHANNEL_MASK);
253     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_FOLDDOWN_MATRIX);
254     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_WMADRC_PEAKREF);
255     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_WMADRC_PEAKTARGET);
256     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_WMADRC_AVGREF);
257     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_WMADRC_AVGTARGET);
258     IF_EQUAL_RETURN(guid, MF_MT_AUDIO_PREFER_WAVEFORMATEX);
259     IF_EQUAL_RETURN(guid, MF_MT_AAC_PAYLOAD_TYPE);
260     IF_EQUAL_RETURN(guid, MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION);
261     IF_EQUAL_RETURN(guid, MF_MT_FRAME_SIZE);
262     IF_EQUAL_RETURN(guid, MF_MT_FRAME_RATE);
263     IF_EQUAL_RETURN(guid, MF_MT_FRAME_RATE_RANGE_MAX);
264     IF_EQUAL_RETURN(guid, MF_MT_FRAME_RATE_RANGE_MIN);
265     IF_EQUAL_RETURN(guid, MF_MT_PIXEL_ASPECT_RATIO);
266     IF_EQUAL_RETURN(guid, MF_MT_DRM_FLAGS);
267     IF_EQUAL_RETURN(guid, MF_MT_PAD_CONTROL_FLAGS);
268     IF_EQUAL_RETURN(guid, MF_MT_SOURCE_CONTENT_HINT);
269     IF_EQUAL_RETURN(guid, MF_MT_VIDEO_CHROMA_SITING);
270     IF_EQUAL_RETURN(guid, MF_MT_INTERLACE_MODE);
271     IF_EQUAL_RETURN(guid, MF_MT_TRANSFER_FUNCTION);
272     IF_EQUAL_RETURN(guid, MF_MT_VIDEO_PRIMARIES);
273     IF_EQUAL_RETURN(guid, MF_MT_CUSTOM_VIDEO_PRIMARIES);
274     IF_EQUAL_RETURN(guid, MF_MT_YUV_MATRIX);
275     IF_EQUAL_RETURN(guid, MF_MT_VIDEO_LIGHTING);
276     IF_EQUAL_RETURN(guid, MF_MT_VIDEO_NOMINAL_RANGE);
277     IF_EQUAL_RETURN(guid, MF_MT_GEOMETRIC_APERTURE);
278     IF_EQUAL_RETURN(guid, MF_MT_MINIMUM_DISPLAY_APERTURE);
279     IF_EQUAL_RETURN(guid, MF_MT_PAN_SCAN_APERTURE);
280     IF_EQUAL_RETURN(guid, MF_MT_PAN_SCAN_ENABLED);
281     IF_EQUAL_RETURN(guid, MF_MT_AVG_BITRATE);
282     IF_EQUAL_RETURN(guid, MF_MT_AVG_BIT_ERROR_RATE);
283     IF_EQUAL_RETURN(guid, MF_MT_MAX_KEYFRAME_SPACING);
284     IF_EQUAL_RETURN(guid, MF_MT_DEFAULT_STRIDE);
285     IF_EQUAL_RETURN(guid, MF_MT_PALETTE);
286     IF_EQUAL_RETURN(guid, MF_MT_USER_DATA);
287     IF_EQUAL_RETURN(guid, MF_MT_AM_FORMAT_TYPE);
288     IF_EQUAL_RETURN(guid, MF_MT_MPEG_START_TIME_CODE);
289     IF_EQUAL_RETURN(guid, MF_MT_MPEG2_PROFILE);
290     IF_EQUAL_RETURN(guid, MF_MT_MPEG2_LEVEL);
291     IF_EQUAL_RETURN(guid, MF_MT_MPEG2_FLAGS);
292     IF_EQUAL_RETURN(guid, MF_MT_MPEG_SEQUENCE_HEADER);
293     IF_EQUAL_RETURN(guid, MF_MT_DV_AAUX_SRC_PACK_0);
294     IF_EQUAL_RETURN(guid, MF_MT_DV_AAUX_CTRL_PACK_0);
295     IF_EQUAL_RETURN(guid, MF_MT_DV_AAUX_SRC_PACK_1);
296     IF_EQUAL_RETURN(guid, MF_MT_DV_AAUX_CTRL_PACK_1);
297     IF_EQUAL_RETURN(guid, MF_MT_DV_VAUX_SRC_PACK);
298     IF_EQUAL_RETURN(guid, MF_MT_DV_VAUX_CTRL_PACK);
299     IF_EQUAL_RETURN(guid, MF_MT_ARBITRARY_HEADER);
300     IF_EQUAL_RETURN(guid, MF_MT_ARBITRARY_FORMAT);
301     IF_EQUAL_RETURN(guid, MF_MT_IMAGE_LOSS_TOLERANT); 
302     IF_EQUAL_RETURN(guid, MF_MT_MPEG4_SAMPLE_DESCRIPTION);
303     IF_EQUAL_RETURN(guid, MF_MT_MPEG4_CURRENT_SAMPLE_ENTRY);
304     IF_EQUAL_RETURN(guid, MF_MT_ORIGINAL_4CC); 
305     IF_EQUAL_RETURN(guid, MF_MT_ORIGINAL_WAVE_FORMAT_TAG);
306     
307     // Media types
308 
309     IF_EQUAL_RETURN(guid, MFMediaType_Audio);
310     IF_EQUAL_RETURN(guid, MFMediaType_Video);
311     IF_EQUAL_RETURN(guid, MFMediaType_Protected);
312     IF_EQUAL_RETURN(guid, MFMediaType_SAMI);
313     IF_EQUAL_RETURN(guid, MFMediaType_Script);
314     IF_EQUAL_RETURN(guid, MFMediaType_Image);
315     IF_EQUAL_RETURN(guid, MFMediaType_HTML);
316     IF_EQUAL_RETURN(guid, MFMediaType_Binary);
317     IF_EQUAL_RETURN(guid, MFMediaType_FileTransfer);
318 
319     IF_EQUAL_RETURN(guid, MFVideoFormat_AI44); //     FCC('AI44')
320     IF_EQUAL_RETURN(guid, MFVideoFormat_ARGB32); //   D3DFMT_A8R8G8B8 
321     IF_EQUAL_RETURN(guid, MFVideoFormat_AYUV); //     FCC('AYUV')
322     IF_EQUAL_RETURN(guid, MFVideoFormat_DV25); //     FCC('dv25')
323     IF_EQUAL_RETURN(guid, MFVideoFormat_DV50); //     FCC('dv50')
324     IF_EQUAL_RETURN(guid, MFVideoFormat_DVH1); //     FCC('dvh1')
325     IF_EQUAL_RETURN(guid, MFVideoFormat_DVSD); //     FCC('dvsd')
326     IF_EQUAL_RETURN(guid, MFVideoFormat_DVSL); //     FCC('dvsl')
327     IF_EQUAL_RETURN(guid, MFVideoFormat_H264); //     FCC('H264')
328     IF_EQUAL_RETURN(guid, MFVideoFormat_I420); //     FCC('I420')
329     IF_EQUAL_RETURN(guid, MFVideoFormat_IYUV); //     FCC('IYUV')
330     IF_EQUAL_RETURN(guid, MFVideoFormat_M4S2); //     FCC('M4S2')
331     IF_EQUAL_RETURN(guid, MFVideoFormat_MJPG);
332     IF_EQUAL_RETURN(guid, MFVideoFormat_MP43); //     FCC('MP43')
333     IF_EQUAL_RETURN(guid, MFVideoFormat_MP4S); //     FCC('MP4S')
334     IF_EQUAL_RETURN(guid, MFVideoFormat_MP4V); //     FCC('MP4V')
335     IF_EQUAL_RETURN(guid, MFVideoFormat_MPG1); //     FCC('MPG1')
336     IF_EQUAL_RETURN(guid, MFVideoFormat_MSS1); //     FCC('MSS1')
337     IF_EQUAL_RETURN(guid, MFVideoFormat_MSS2); //     FCC('MSS2')
338     IF_EQUAL_RETURN(guid, MFVideoFormat_NV11); //     FCC('NV11')
339     IF_EQUAL_RETURN(guid, MFVideoFormat_NV12); //     FCC('NV12')
340     IF_EQUAL_RETURN(guid, MFVideoFormat_P010); //     FCC('P010')
341     IF_EQUAL_RETURN(guid, MFVideoFormat_P016); //     FCC('P016')
342     IF_EQUAL_RETURN(guid, MFVideoFormat_P210); //     FCC('P210')
343     IF_EQUAL_RETURN(guid, MFVideoFormat_P216); //     FCC('P216')
344     IF_EQUAL_RETURN(guid, MFVideoFormat_RGB24); //    D3DFMT_R8G8B8 
345     IF_EQUAL_RETURN(guid, MFVideoFormat_RGB32); //    D3DFMT_X8R8G8B8 
346     IF_EQUAL_RETURN(guid, MFVideoFormat_RGB555); //   D3DFMT_X1R5G5B5 
347     IF_EQUAL_RETURN(guid, MFVideoFormat_RGB565); //   D3DFMT_R5G6B5 
348     IF_EQUAL_RETURN(guid, MFVideoFormat_RGB8);
349     IF_EQUAL_RETURN(guid, MFVideoFormat_UYVY); //     FCC('UYVY')
350     IF_EQUAL_RETURN(guid, MFVideoFormat_v210); //     FCC('v210')
351     IF_EQUAL_RETURN(guid, MFVideoFormat_v410); //     FCC('v410')
352     IF_EQUAL_RETURN(guid, MFVideoFormat_WMV1); //     FCC('WMV1')
353     IF_EQUAL_RETURN(guid, MFVideoFormat_WMV2); //     FCC('WMV2')
354     IF_EQUAL_RETURN(guid, MFVideoFormat_WMV3); //     FCC('WMV3')
355     IF_EQUAL_RETURN(guid, MFVideoFormat_WVC1); //     FCC('WVC1')
356     IF_EQUAL_RETURN(guid, MFVideoFormat_Y210); //     FCC('Y210')
357     IF_EQUAL_RETURN(guid, MFVideoFormat_Y216); //     FCC('Y216')
358     IF_EQUAL_RETURN(guid, MFVideoFormat_Y410); //     FCC('Y410')
359     IF_EQUAL_RETURN(guid, MFVideoFormat_Y416); //     FCC('Y416')
360     IF_EQUAL_RETURN(guid, MFVideoFormat_Y41P);
361     IF_EQUAL_RETURN(guid, MFVideoFormat_Y41T);
362     IF_EQUAL_RETURN(guid, MFVideoFormat_YUY2); //     FCC('YUY2')
363     IF_EQUAL_RETURN(guid, MFVideoFormat_YV12); //     FCC('YV12')
364     IF_EQUAL_RETURN(guid, MFVideoFormat_YVYU);
365 
366     IF_EQUAL_RETURN(guid, MFAudioFormat_PCM); //              WAVE_FORMAT_PCM 
367     IF_EQUAL_RETURN(guid, MFAudioFormat_Float); //            WAVE_FORMAT_IEEE_FLOAT 
368     IF_EQUAL_RETURN(guid, MFAudioFormat_DTS); //              WAVE_FORMAT_DTS 
369     IF_EQUAL_RETURN(guid, MFAudioFormat_Dolby_AC3_SPDIF); //  WAVE_FORMAT_DOLBY_AC3_SPDIF 
370     IF_EQUAL_RETURN(guid, MFAudioFormat_DRM); //              WAVE_FORMAT_DRM 
371     IF_EQUAL_RETURN(guid, MFAudioFormat_WMAudioV8); //        WAVE_FORMAT_WMAUDIO2 
372     IF_EQUAL_RETURN(guid, MFAudioFormat_WMAudioV9); //        WAVE_FORMAT_WMAUDIO3 
373     IF_EQUAL_RETURN(guid, MFAudioFormat_WMAudio_Lossless); // WAVE_FORMAT_WMAUDIO_LOSSLESS 
374     IF_EQUAL_RETURN(guid, MFAudioFormat_WMASPDIF); //         WAVE_FORMAT_WMASPDIF 
375     IF_EQUAL_RETURN(guid, MFAudioFormat_MSP1); //             WAVE_FORMAT_WMAVOICE9 
376     IF_EQUAL_RETURN(guid, MFAudioFormat_MP3); //              WAVE_FORMAT_MPEGLAYER3 
377     IF_EQUAL_RETURN(guid, MFAudioFormat_MPEG); //             WAVE_FORMAT_MPEG 
378     IF_EQUAL_RETURN(guid, MFAudioFormat_AAC); //              WAVE_FORMAT_MPEG_HEAAC 
379     IF_EQUAL_RETURN(guid, MFAudioFormat_ADTS); //             WAVE_FORMAT_MPEG_ADTS_AAC 
380 
381     return NULL;
382 }

 

 

posted @ 2019-04-10 22:24  CaliforniaCHAO  阅读(812)  评论(0编辑  收藏  举报