PageRenderTime 51ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/Core/Dependencies/Media SDK 2012/samples/sample_mfoundation_plugins/mf_utils/include/mf_guids.h

https://bitbucket.org/barakianc/nvidia-physx-and-apex-in-gge
C Header | 359 lines | 188 code | 65 blank | 106 comment | 3 complexity | 3d517a71bbdc5d37e4372a00c4b99cff MD5 | raw file
  1. /********************************************************************************
  2. INTEL CORPORATION PROPRIETARY INFORMATION
  3. This software is supplied under the terms of a license agreement or nondisclosure
  4. agreement with Intel Corporation and may not be copied or disclosed except in
  5. accordance with the terms of that agreement
  6. Copyright(c) 2008-2011 Intel Corporation. All Rights Reserved.
  7. *********************************************************************************
  8. File: mf_guids.h
  9. Purpose: define common code for MSDK based MF plug-ins.
  10. Defined Classes, Structures & Enumerations:
  11. * GUID_info - stores types of MFT (major & sub types)
  12. * ClassRegData - stores registration data of MF plug-ins
  13. Defined Types:
  14. * CreateInstanceFn - defines type of plug-ins CreateInstance functions
  15. * FillParamsFn - defines type of parameters filling functions
  16. * ClassRegDataFn - defines type of helper function
  17. Defined Macroses:
  18. * CHARS_IN_GUID - number of chars in GUID
  19. * SAFE_NEW - calls new for specified class, catches exceptions
  20. * SAFE_NEW_ARRAY - calls new for specified array, catches exceptions
  21. * SAFE_DELETE - deletes class object and frees pointer
  22. * SAFE_DELETE_ARRAY - deletes array object and frees pointer
  23. * SAFE_RELEASE - releases com object and frees pointer
  24. * SAFE_FREE - deletes variable and frees pointer
  25. * myfopen - redirection on fsopen
  26. * mywfopen - redirection on _wfsopen
  27. Defined Global Variables:
  28. * g_UncompressedVideoTypes - list of uncompressed video types used in plug-ins
  29. * g_DecoderRegFlags - decoder MFTs registry flags
  30. * g_EncoderRegFlags - encoder MFTs registry flags
  31. # GUIDS
  32. * CLSID_MF_MPEG2EncFilter
  33. * CLSID_MF_H264EncFilter
  34. * CLSID_MF_MPEG2DecFilter
  35. * CLSID_MF_H264DecFilter
  36. * CLSID_MF_VC1DecFilter
  37. * MFVideoFormat_NV12_MFX
  38. * MEDIASUBTYPE_MPEG1_MFX
  39. * MEDIASUBTYPE_MPEG2_MFX
  40. * MEDIASUBTYPE_H264_MFX
  41. * MEDIASUBTYPE_VC1_MFX
  42. * MEDIASUBTYPE_VC1P_MFX
  43. Defined Global Functions:
  44. * myDllMain
  45. * AMovieSetupRegisterServer
  46. * AMovieSetupUnregisterServer
  47. * CreateVDecPlugin - creates video decoder plug-in instance
  48. * CreateVEncPlugin - creates video encoder plug-in instance
  49. *********************************************************************************/
  50. #ifndef __MF_GUIDS_H__
  51. #define __MF_GUIDS_H__
  52. // switching off Microsoft warnings
  53. #pragma warning(disable: 4201) // nameless structs/unions
  54. #pragma warning(disable: 4995) // 'name' was declared deprecated
  55. #include <windows.h>
  56. #include <tchar.h>
  57. #include <assert.h>
  58. #include <strsafe.h>
  59. #include <stdio.h>
  60. #include <math.h>
  61. #include <limits.h>
  62. #include <share.h>
  63. #include <list>
  64. #include <objbase.h>
  65. #include <uuids.h>
  66. #include <initguid.h>
  67. #include <atlbase.h>
  68. #include <mfapi.h>
  69. #include <mfidl.h>
  70. #include <mferror.h>
  71. #include <mftransform.h>
  72. #include <dmoreg.h> // DirectX SDK registration
  73. #include <wmpservices.h>
  74. #include <wmsdkidl.h>
  75. #include <wmcodecdsp.h>
  76. #include <evr.h>
  77. #include <d3d9.h>
  78. #include <dxva2api.h>
  79. #include <KS.h>
  80. #include <Codecapi.h>
  81. #include <Psapi.h>
  82. #pragma warning(default: 4995) // 'name' was declared deprecated
  83. #pragma warning(default: 4201) // nameless structs/unions
  84. /*------------------------------------------------------------------------------*/
  85. #include "mfxdefs.h"
  86. #include "mfxstructures.h"
  87. #include "mfxvideo.h"
  88. #include "mfxvideo++.h"
  89. /*------------------------------------------------------------------------------*/
  90. #define CHARS_IN_GUID 39
  91. #ifndef SAFE_NEW
  92. #define SAFE_NEW(P, C){ try { (P) = new C; } catch(...) { (P) = NULL; } }
  93. #endif
  94. #ifndef SAFE_NEW_ARRAY
  95. #define SAFE_NEW_ARRAY(P, C, N){ try { (P) = new C[N]; } catch(...) { (P) = NULL; } }
  96. #endif
  97. #ifndef SAFE_DELETE
  98. #define SAFE_DELETE(P) {if (P) {delete (P); (P) = NULL;}}
  99. #endif
  100. #ifndef SAFE_DELETE_ARRAY
  101. #define SAFE_DELETE_ARRAY(P) {if (P) {delete[] (P); (P) = NULL;}}
  102. #endif
  103. #ifndef SAFE_RELEASE
  104. #define SAFE_RELEASE(P) if (P) { (P)->Release(); (P) = NULL; }
  105. #endif
  106. #ifndef SAFE_FREE
  107. #define SAFE_FREE(P) if (P) { free(P); (P) = NULL; }
  108. #endif
  109. #define SAFE_MFT_FREE(P) if (P) { CoTaskMemFree(P); (P) = NULL; }
  110. #define myfopen(FNAME, FMODE) _fsopen(FNAME, FMODE, _SH_DENYNO)
  111. #define mywfopen(FNAME, FMODE) _wfsopen(FNAME, FMODE, _SH_DENYNO)
  112. /*------------------------------------------------------------------------------*/
  113. // Structure to store input types of MFT
  114. typedef struct {
  115. GUID major_type; // major type (VIDEO, AUDIO, etc)
  116. GUID subtype; // subtype
  117. } GUID_info;
  118. struct ClassRegData;
  119. // Function pointer for creating COM objects. (Used by the class factory.)
  120. typedef HRESULT (*CreateInstanceFn)(REFIID iid,
  121. void **ppObject,
  122. ClassRegData *pRegistrationData);
  123. // Function pointer to work with codec params
  124. typedef mfxStatus (*CodecParamsFn)(mfxVideoParam* pVideoParams);
  125. // Function pointer to some function
  126. typedef HRESULT (*ClassRegDataFn)(void);
  127. // Class factory data.
  128. // Defines a look-up table of class IDs and corresponding creation functions.
  129. struct ClassRegData
  130. {
  131. GUID* guidClassID; // Class ID of plug-in
  132. LPWSTR pPluginName; // friendly name
  133. UINT32 iPluginCategory; // category
  134. CreateInstanceFn pCreationFunction; // create function
  135. CodecParamsFn pFillParams; // function to fill codec params
  136. CodecParamsFn pFreeParams; // function to free codec params
  137. GUID_info* pInputTypes; // array of input types
  138. DWORD cInputTypes; // size of array of input types
  139. GUID_info* pOutputTypes; // array of output types
  140. DWORD cOutputTypes; // size of array of output types
  141. UINT32 iFlags; // registry flags (for MFTs only)
  142. IMFAttributes* pAttributes; // MFT attributes
  143. LPWSTR* pFileExtensions; // for ByteStreamHandler only
  144. UINT32 cFileExtensions; // for ByteStreamHandler only
  145. ClassRegDataFn pDllRegisterFn; // plug-in specific register function
  146. ClassRegDataFn pDllUnregisterFn; // plug-in specific unregister function
  147. };
  148. // MF plug-in types
  149. enum
  150. {
  151. REG_UNKNOWN = 0x000,
  152. REG_AS_BYTE_STREAM_HANDLER = 0x001,
  153. REG_AS_AUDIO_DECODER = 0x002,
  154. REG_AS_VIDEO_DECODER = 0x004,
  155. REG_AS_AUDIO_ENCODER = 0x008,
  156. REG_AS_VIDEO_ENCODER = 0x010,
  157. REG_AS_AUDIO_EFFECT = 0x020,
  158. REG_AS_VIDEO_EFFECT = 0x040,
  159. REG_AS_VIDEO_PROCESSOR = 0x080,
  160. REG_AS_SINK = 0x100,
  161. REG_AS_WMP_PLUGIN = 0x200
  162. };
  163. BOOL myDllMain(HANDLE hModule,
  164. DWORD ul_reason_for_call,
  165. ClassRegData *pClassRegData,
  166. UINT32 numberClassRegData);
  167. STDAPI AMovieSetupRegisterServer(CLSID clsServer,
  168. LPCWSTR szDescription,
  169. LPCWSTR szFileName,
  170. LPCWSTR szThreadingModel = L"Both",
  171. LPCWSTR szServerType = L"InprocServer32");
  172. STDAPI AMovieSetupUnregisterServer(CLSID clsServer);
  173. /*------------------------------------------------------------------------------*/
  174. // Plug-ins GUIDs
  175. // {07F19984-4FC7-45ba-9AD0-418449E81283}
  176. DEFINE_GUID(CLSID_MF_MPEG2EncFilter,
  177. 0x07f19984, 0x4fc7, 0x45ba, 0x9a, 0xd0, 0x41, 0x84, 0x49, 0xe8, 0x12, 0x83);
  178. // {08B2F572-51BF-4e93-8B15-33864546DC9A}
  179. DEFINE_GUID(CLSID_MF_H264EncFilter,
  180. 0x08b2f572, 0x51bf, 0x4e93, 0x8b, 0x15, 0x33, 0x86, 0x45, 0x46, 0xdc, 0x9a);
  181. // {0CF65E82-CCFF-4e02-99EB-A579B667820D}
  182. DEFINE_GUID(CLSID_MF_MPEG2DecFilter,
  183. 0x0cf65e82, 0xccff, 0x4e02, 0x99, 0xeb, 0xa5, 0x79, 0xb6, 0x67, 0x82, 0xd);
  184. // {0855C9AC-BC6F-4371-8954-671CCD4EC16F}
  185. DEFINE_GUID(CLSID_MF_H264DecFilter,
  186. 0x0855c9ac, 0xbc6f, 0x4371, 0x89, 0x54, 0x67, 0x1c, 0xcd, 0x4e, 0xc1, 0x6f);
  187. // {04C76F2E-128C-4f2b-8270-F9C0B6DFAD31}
  188. DEFINE_GUID(CLSID_MF_VC1DecFilter,
  189. 0x04c76f2e, 0x128c, 0x4f2b, 0x82, 0x70, 0xf9, 0xc0, 0xb6, 0xdf, 0xad, 0x31);
  190. // {0489CFBB-3D2D-4f90-BBC2-350F9DDECF77}
  191. DEFINE_GUID(CLSID_MF_VppFilter,
  192. 0x0489cfbb, 0x3d2d, 0x4f90, 0xbb, 0xc2, 0x35, 0x0f, 0x9d, 0xde, 0xcf, 0x77);
  193. /*--------------------------------------------------------------------*/
  194. // Additional Color Format GUIDs
  195. // {CB08E88B-3961-42ae-BA67-FF47CCC13EED}
  196. DEFINE_GUID(MFVideoFormat_NV12_MFX,
  197. MAKEFOURCC('N','V','1','2'), 0x3961, 0x42ae, 0xba, 0x67, 0xff, 0x47, 0xcc, 0xc1, 0x3e, 0xed);
  198. /*--------------------------------------------------------------------*/
  199. // Additional Media Types GUIDs
  200. DEFINE_GUID(MEDIASUBTYPE_MPEG1_MFX,
  201. MAKEFOURCC('M','P','G','1'), 0x0000, 0x0010, 0x90, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
  202. DEFINE_GUID(MEDIASUBTYPE_MPEG2_MFX,
  203. MAKEFOURCC('M','P','G','2'), 0x0000, 0x0010, 0x90, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
  204. DEFINE_GUID(MEDIASUBTYPE_H264_MFX,
  205. MAKEFOURCC('H','2','6','4'), 0x0000, 0x0010, 0x90, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
  206. DEFINE_GUID(MEDIASUBTYPE_VC1_MFX, // pure VC1
  207. 0x59e58851, 0x02b2, 0x431c, 0xa3, 0x7f, 0xe5, 0x5d, 0x98, 0xeb, 0x09, 0x72);
  208. DEFINE_GUID(MEDIASUBTYPE_VC1P_MFX,
  209. 0xe77f04f1, 0xd2cf, 0x42d3, 0xbd, 0x8f, 0xe7, 0xfe, 0x63, 0x19, 0xc2, 0x6a);
  210. /*--------------------------------------------------------------------*/
  211. // HW support GUIDs
  212. // {26F6BB9A-EAA2-45f8-86D2-69DCD984B9B1}
  213. DEFINE_GUID(IID_IMFDeviceDXVA,
  214. 0x26f6bb9a, 0xeaa2, 0x45f8, 0x86, 0xd2, 0x69, 0xdc, 0xd9, 0x84, 0xb9, 0xb1);
  215. // {85E4DCCF-F1FE-4117-854D-7CDA2ACC2C77}
  216. // Media type attribute containing IUnknown pointer to IMFDeviceDXVA
  217. DEFINE_GUID(MF_MT_D3D_DEVICE,
  218. 0x85e4dccf, 0xf1fe, 0x4117, 0x85, 0x4d, 0x7c, 0xda, 0x2a, 0xcc, 0x2c, 0x77);
  219. // {80860F81-298D-4828-BB7A-323558ECB6AF}
  220. // Media type attribute containing decoder's subtype
  221. DEFINE_GUID(MF_MT_DEC_SUBTYPE,
  222. 0x80860f81, 0x298d, 0x4828, 0xbb, 0x7a, 0x32, 0x35, 0x58, 0xec, 0xb6, 0xaf);
  223. // {4ACC65CB-BE19-4cd6-80BD-B28F8E112054}
  224. // Media type attribute containing error occurred in dowsntream plug-in
  225. DEFINE_GUID(MF_MT_DOWNSTREAM_ERROR,
  226. 0x4acc65cb, 0xbe19, 0x4cd6, 0x80, 0xbd, 0xb2, 0x8f, 0x8e, 0x11, 0x20, 0x54);
  227. // {7E151065-C321-4e28-A6A5-BA4C84DAA7B9}
  228. DEFINE_GUID(MF_MT_MFX_FRAME_SRF,
  229. 0x7e151065, 0xc321, 0x4e28, 0xa6, 0xa5, 0xba, 0x4c, 0x84, 0xda, 0xa7, 0xb9);
  230. // {FC8875C8-8B57-479e-B89E-D4D10E174645}
  231. DEFINE_GUID(MF_MT_FAKE_SRF,
  232. 0xfc8875c8, 0x8b57, 0x479e, 0xb8, 0x9e, 0xd4, 0xd1, 0xe, 0x17, 0x46, 0x45);
  233. /*--------------------------------------------------------------------*/
  234. // Other GUIDs
  235. // {31670B7E-6A65-4a0f-BC78-62B0AE86DDC3}
  236. DEFINE_GUID(IID_IMfxFrameSurface,
  237. 0x31670b7e, 0x6a65, 0x4a0f, 0xbc, 0x78, 0x62, 0xb0, 0xae, 0x86, 0xdd, 0xc3);
  238. // {7F48BBA1-8680-4af9-83BD-DE8FBBD3B32D}
  239. DEFINE_GUID(IID_MFVideoBuffer,
  240. 0x7f48bba1, 0x8680, 0x4af9, 0x83, 0xbd, 0xde, 0x8f, 0xbb, 0xd3, 0xb3, 0x2d);
  241. /*--------------------------------------------------------------------*/
  242. // Global variables
  243. static const GUID_info g_UncompressedVideoTypes[] =
  244. {
  245. { MFMediaType_Video, MFVideoFormat_NV12_MFX },
  246. { MFMediaType_Video, MFVideoFormat_NV12 },
  247. //{ MFMediaType_Video, MFVideoFormat_YV12 },
  248. };
  249. static const UINT32 g_DecoderRegFlags = MFT_ENUM_FLAG_ASYNCMFT;
  250. static const UINT32 g_EncoderRegFlags = MFT_ENUM_FLAG_ASYNCMFT;
  251. static const UINT32 g_VppRegFlags = MFT_ENUM_FLAG_ASYNCMFT;
  252. extern HINSTANCE g_hInst;
  253. /*--------------------------------------------------------------------*/
  254. static const mfxU32 g_tabDoNotUseVppAlg[] =
  255. {
  256. MFX_EXTBUFF_VPP_DENOISE,
  257. MFX_EXTBUFF_VPP_SCENE_ANALYSIS,
  258. MFX_EXTBUFF_VPP_PROCAMP,
  259. MFX_EXTBUFF_VPP_DETAIL
  260. };
  261. static const mfxExtVPPDoNotUse g_extVppDoNotUse =
  262. {
  263. {
  264. MFX_EXTBUFF_VPP_DONOTUSE, // BufferId
  265. sizeof(mfxExtVPPDoNotUse) // BufferSz
  266. }, // Header
  267. sizeof(g_tabDoNotUseVppAlg)/sizeof(mfxU32), // NumAlg
  268. (mfxU32*)&g_tabDoNotUseVppAlg //AlgList
  269. };
  270. static const mfxExtBuffer* g_pVppExtBuf[] =
  271. {
  272. (mfxExtBuffer*)&g_extVppDoNotUse
  273. };
  274. /*------------------------------------------------------------------------------*/
  275. extern mfxVersion g_MfxVersion;
  276. /*------------------------------------------------------------------------------*/
  277. extern void DllAddRef(void);
  278. extern void DllRelease(void);
  279. /*--------------------------------------------------------------------*/
  280. // Create functions
  281. extern HRESULT CreateVEncPlugin(REFIID iid, void **ppObject, ClassRegData *pRegistrationData);
  282. extern HRESULT CreateVDecPlugin(REFIID iid, void **ppObject, ClassRegData *pRegistrationData);
  283. extern HRESULT CreateVppPlugin (REFIID iid, void **ppObject, ClassRegData *pRegistrationData);
  284. #endif // #ifndef __MF_GUIDS_H__