Component.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. //
  2. // Notice Regarding Standards. AMD does not provide a license or sublicense to
  3. // any Intellectual Property Rights relating to any standards, including but not
  4. // limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
  5. // AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
  6. // (collectively, the "Media Technologies"). For clarity, you will pay any
  7. // royalties due for such third party technologies, which may include the Media
  8. // Technologies that are owed as a result of AMD providing the Software to you.
  9. //
  10. // MIT license
  11. //
  12. // Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
  13. //
  14. // Permission is hereby granted, free of charge, to any person obtaining a copy
  15. // of this software and associated documentation files (the "Software"), to deal
  16. // in the Software without restriction, including without limitation the rights
  17. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18. // copies of the Software, and to permit persons to whom the Software is
  19. // furnished to do so, subject to the following conditions:
  20. //
  21. // The above copyright notice and this permission notice shall be included in
  22. // all copies or substantial portions of the Software.
  23. //
  24. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  26. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  27. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  28. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  29. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  30. // THE SOFTWARE.
  31. //
  32. /**
  33. ***************************************************************************************************
  34. * @file Component.h
  35. * @brief AMFComponent interface declaration
  36. ***************************************************************************************************
  37. */
  38. #ifndef AMF_Component_h
  39. #define AMF_Component_h
  40. #pragma once
  41. #include "../core/Data.h"
  42. #include "../core/PropertyStorageEx.h"
  43. #include "../core/Surface.h"
  44. #include "../core/Context.h"
  45. #include "ComponentCaps.h"
  46. #if defined(__cplusplus)
  47. namespace amf
  48. {
  49. #endif
  50. //----------------------------------------------------------------------------------------------
  51. // AMFDataAllocatorCB interface
  52. //----------------------------------------------------------------------------------------------
  53. #if defined(__cplusplus)
  54. class AMF_NO_VTABLE AMFDataAllocatorCB : public AMFInterface
  55. {
  56. public:
  57. AMF_DECLARE_IID(0x4bf46198, 0x8b7b, 0x49d0, 0xaa, 0x72, 0x48, 0xd4, 0x7, 0xce, 0x24, 0xc5 )
  58. virtual AMF_RESULT AMF_STD_CALL AllocBuffer(AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer) = 0;
  59. virtual AMF_RESULT AMF_STD_CALL AllocSurface(AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format,
  60. amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, AMFSurface** ppSurface) = 0;
  61. };
  62. //----------------------------------------------------------------------------------------------
  63. // smart pointer
  64. //----------------------------------------------------------------------------------------------
  65. typedef AMFInterfacePtr_T<AMFDataAllocatorCB> AMFDataAllocatorCBPtr;
  66. #else // #if defined(__cplusplus)
  67. AMF_DECLARE_IID(AMFDataAllocatorCB, 0x4bf46198, 0x8b7b, 0x49d0, 0xaa, 0x72, 0x48, 0xd4, 0x7, 0xce, 0x24, 0xc5 )
  68. typedef struct AMFDataAllocatorCB AMFDataAllocatorCB;
  69. typedef struct AMFDataAllocatorCBVtbl
  70. {
  71. // AMFInterface interface
  72. amf_long (AMF_STD_CALL *Acquire)(AMFDataAllocatorCB* pThis);
  73. amf_long (AMF_STD_CALL *Release)(AMFDataAllocatorCB* pThis);
  74. enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFDataAllocatorCB* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
  75. // AMFDataAllocatorCB interface
  76. AMF_RESULT (AMF_STD_CALL *AllocBuffer)(AMFDataAllocatorCB* pThis, AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer);
  77. AMF_RESULT (AMF_STD_CALL *AllocSurface)(AMFDataAllocatorCB* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format,
  78. amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, AMFSurface** ppSurface);
  79. } AMFDataAllocatorCBVtbl;
  80. struct AMFDataAllocatorCB
  81. {
  82. const AMFDataAllocatorCBVtbl *pVtbl;
  83. };
  84. #endif // #if defined(__cplusplus)
  85. //----------------------------------------------------------------------------------------------
  86. #if defined(__cplusplus)
  87. class AMF_NO_VTABLE AMFComponentOptimizationCallback
  88. {
  89. public:
  90. virtual AMF_RESULT AMF_STD_CALL OnComponentOptimizationProgress(amf_uint percent) = 0;
  91. };
  92. #else // #if defined(__cplusplus)
  93. typedef struct AMFComponentOptimizationCallback AMFComponentOptimizationCallback;
  94. typedef struct AMFComponentOptimizationCallbackVtbl
  95. {
  96. // AMFDataAllocatorCB interface
  97. AMF_RESULT (AMF_STD_CALL *OnComponentOptimizationProgress)(AMFComponentOptimizationCallback* pThis, amf_uint percent);
  98. } AMFComponentOptimizationCallbackVtbl;
  99. struct AMFComponentOptimizationCallback
  100. {
  101. const AMFComponentOptimizationCallbackVtbl *pVtbl;
  102. };
  103. #endif //#if defined(__cplusplus)
  104. //----------------------------------------------------------------------------------------------
  105. // AMFComponent interface
  106. //----------------------------------------------------------------------------------------------
  107. #if defined(__cplusplus)
  108. class AMF_NO_VTABLE AMFComponent : public AMFPropertyStorageEx
  109. {
  110. public:
  111. AMF_DECLARE_IID(0x8b51e5e4, 0x455d, 0x4034, 0xa7, 0x46, 0xde, 0x1b, 0xed, 0xc3, 0xc4, 0x6)
  112. virtual AMF_RESULT AMF_STD_CALL Init(AMF_SURFACE_FORMAT format,amf_int32 width,amf_int32 height) = 0;
  113. virtual AMF_RESULT AMF_STD_CALL ReInit(amf_int32 width,amf_int32 height) = 0;
  114. virtual AMF_RESULT AMF_STD_CALL Terminate() = 0;
  115. virtual AMF_RESULT AMF_STD_CALL Drain() = 0;
  116. virtual AMF_RESULT AMF_STD_CALL Flush() = 0;
  117. virtual AMF_RESULT AMF_STD_CALL SubmitInput(AMFData* pData) = 0;
  118. virtual AMF_RESULT AMF_STD_CALL QueryOutput(AMFData** ppData) = 0;
  119. virtual AMFContext* AMF_STD_CALL GetContext() = 0;
  120. virtual AMF_RESULT AMF_STD_CALL SetOutputDataAllocatorCB(AMFDataAllocatorCB* callback) = 0;
  121. virtual AMF_RESULT AMF_STD_CALL GetCaps(AMFCaps** ppCaps) = 0;
  122. virtual AMF_RESULT AMF_STD_CALL Optimize(AMFComponentOptimizationCallback* pCallback) = 0;
  123. };
  124. //----------------------------------------------------------------------------------------------
  125. // smart pointer
  126. //----------------------------------------------------------------------------------------------
  127. typedef AMFInterfacePtr_T<AMFComponent> AMFComponentPtr;
  128. #else // #if defined(__cplusplus)
  129. AMF_DECLARE_IID(AMFComponent, 0x8b51e5e4, 0x455d, 0x4034, 0xa7, 0x46, 0xde, 0x1b, 0xed, 0xc3, 0xc4, 0x6)
  130. typedef struct AMFComponent AMFComponent;
  131. typedef struct AMFComponentVtbl
  132. {
  133. // AMFInterface interface
  134. amf_long (AMF_STD_CALL *Acquire)(AMFComponent* pThis);
  135. amf_long (AMF_STD_CALL *Release)(AMFComponent* pThis);
  136. enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComponent* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
  137. // AMFPropertyStorage interface
  138. AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFComponent* pThis, const wchar_t* name, AMFVariantStruct value);
  139. AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFComponent* pThis, const wchar_t* name, AMFVariantStruct* pValue);
  140. amf_bool (AMF_STD_CALL *HasProperty)(AMFComponent* pThis, const wchar_t* name);
  141. amf_size (AMF_STD_CALL *GetPropertyCount)(AMFComponent* pThis);
  142. AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFComponent* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
  143. AMF_RESULT (AMF_STD_CALL *Clear)(AMFComponent* pThis);
  144. AMF_RESULT (AMF_STD_CALL *AddTo)(AMFComponent* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
  145. AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFComponent* pThis, AMFPropertyStorage* pDest, amf_bool deep);
  146. void (AMF_STD_CALL *AddObserver)(AMFComponent* pThis, AMFPropertyStorageObserver* pObserver);
  147. void (AMF_STD_CALL *RemoveObserver)(AMFComponent* pThis, AMFPropertyStorageObserver* pObserver);
  148. // AMFPropertyStorageEx interface
  149. amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFComponent* pThis);
  150. AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFComponent* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
  151. AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFComponent* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
  152. AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFComponent* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated);
  153. // AMFComponent interface
  154. AMF_RESULT (AMF_STD_CALL *Init)(AMFComponent* pThis, AMF_SURFACE_FORMAT format,amf_int32 width,amf_int32 height);
  155. AMF_RESULT (AMF_STD_CALL *ReInit)(AMFComponent* pThis, amf_int32 width,amf_int32 height);
  156. AMF_RESULT (AMF_STD_CALL *Terminate)(AMFComponent* pThis);
  157. AMF_RESULT (AMF_STD_CALL *Drain)(AMFComponent* pThis);
  158. AMF_RESULT (AMF_STD_CALL *Flush)(AMFComponent* pThis);
  159. AMF_RESULT (AMF_STD_CALL *SubmitInput)(AMFComponent* pThis, AMFData* pData);
  160. AMF_RESULT (AMF_STD_CALL *QueryOutput)(AMFComponent* pThis, AMFData** ppData);
  161. AMFContext* (AMF_STD_CALL *GetContext)(AMFComponent* pThis);
  162. AMF_RESULT (AMF_STD_CALL *SetOutputDataAllocatorCB)(AMFComponent* pThis, AMFDataAllocatorCB* callback);
  163. AMF_RESULT (AMF_STD_CALL *GetCaps)(AMFComponent* pThis, AMFCaps** ppCaps);
  164. AMF_RESULT (AMF_STD_CALL *Optimize)(AMFComponent* pThis, AMFComponentOptimizationCallback* pCallback);
  165. } AMFComponentVtbl;
  166. struct AMFComponent
  167. {
  168. const AMFComponentVtbl *pVtbl;
  169. };
  170. #endif // #if defined(__cplusplus)
  171. //----------------------------------------------------------------------------------------------
  172. // AMFInput interface
  173. //----------------------------------------------------------------------------------------------
  174. #if defined(__cplusplus)
  175. class AMF_NO_VTABLE AMFInput : public AMFPropertyStorageEx
  176. {
  177. public:
  178. AMF_DECLARE_IID(0x1181eee7, 0x95f2, 0x434a, 0x9b, 0x96, 0xea, 0x55, 0xa, 0xa7, 0x84, 0x89)
  179. virtual AMF_RESULT AMF_STD_CALL SubmitInput(AMFData* pData) = 0;
  180. };
  181. //----------------------------------------------------------------------------------------------
  182. // smart pointer
  183. //----------------------------------------------------------------------------------------------
  184. typedef AMFInterfacePtr_T<AMFInput> AMFInputPtr;
  185. #else // #if defined(__cplusplus)
  186. AMF_DECLARE_IID(AMFInput, 0x1181eee7, 0x95f2, 0x434a, 0x9b, 0x96, 0xea, 0x55, 0xa, 0xa7, 0x84, 0x89)
  187. typedef struct AMFInput AMFInput;
  188. typedef struct AMFInputVtbl
  189. {
  190. // AMFInterface interface
  191. amf_long (AMF_STD_CALL *Acquire)(AMFInput* pThis);
  192. amf_long (AMF_STD_CALL *Release)(AMFInput* pThis);
  193. enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFInput* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
  194. // AMFPropertyStorage interface
  195. AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFInput* pThis, const wchar_t* name, AMFVariantStruct value);
  196. AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFInput* pThis, const wchar_t* name, AMFVariantStruct* pValue);
  197. amf_bool (AMF_STD_CALL *HasProperty)(AMFInput* pThis, const wchar_t* name);
  198. amf_size (AMF_STD_CALL *GetPropertyCount)(AMFInput* pThis);
  199. AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFInput* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
  200. AMF_RESULT (AMF_STD_CALL *Clear)(AMFInput* pThis);
  201. AMF_RESULT (AMF_STD_CALL *AddTo)(AMFInput* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
  202. AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFInput* pThis, AMFPropertyStorage* pDest, amf_bool deep);
  203. void (AMF_STD_CALL *AddObserver)(AMFInput* pThis, AMFPropertyStorageObserver* pObserver);
  204. void (AMF_STD_CALL *RemoveObserver)(AMFInput* pThis, AMFPropertyStorageObserver* pObserver);
  205. // AMFPropertyStorageEx interface
  206. amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFInput* pThis);
  207. AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFInput* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
  208. AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFInput* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
  209. AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFInput* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated);
  210. // AMFInput interface
  211. AMF_RESULT (AMF_STD_CALL *SubmitInput)(AMFInput* pThis, AMFData* pData);
  212. } AMFInputVtbl;
  213. struct AMFInput
  214. {
  215. const AMFInputVtbl *pVtbl;
  216. };
  217. #endif // #if defined(__cplusplus)
  218. //----------------------------------------------------------------------------------------------
  219. // AMFOutput interface
  220. //----------------------------------------------------------------------------------------------
  221. #if defined(__cplusplus)
  222. class AMF_NO_VTABLE AMFOutput : public AMFPropertyStorageEx
  223. {
  224. public:
  225. AMF_DECLARE_IID(0x86a8a037, 0x912c, 0x4698, 0xb0, 0x46, 0x7, 0x5a, 0x1f, 0xac, 0x6b, 0x97)
  226. virtual AMF_RESULT AMF_STD_CALL QueryOutput(AMFData** ppData) = 0;
  227. };
  228. //----------------------------------------------------------------------------------------------
  229. // smart pointer
  230. //----------------------------------------------------------------------------------------------
  231. typedef AMFInterfacePtr_T<AMFOutput> AMFOutputPtr;
  232. #else // #if defined(__cplusplus)
  233. AMF_DECLARE_IID(AMFOutput, 0x86a8a037, 0x912c, 0x4698, 0xb0, 0x46, 0x7, 0x5a, 0x1f, 0xac, 0x6b, 0x97)
  234. typedef struct AMFOutput AMFOutput;
  235. typedef struct AMFOutputVtbl
  236. {
  237. // AMFInterface interface
  238. amf_long (AMF_STD_CALL *Acquire)(AMFOutput* pThis);
  239. amf_long (AMF_STD_CALL *Release)(AMFOutput* pThis);
  240. enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFOutput* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
  241. // AMFPropertyStorage interface
  242. AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFOutput* pThis, const wchar_t* name, AMFVariantStruct value);
  243. AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFOutput* pThis, const wchar_t* name, AMFVariantStruct* pValue);
  244. amf_bool (AMF_STD_CALL *HasProperty)(AMFOutput* pThis, const wchar_t* name);
  245. amf_size (AMF_STD_CALL *GetPropertyCount)(AMFOutput* pThis);
  246. AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFOutput* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
  247. AMF_RESULT (AMF_STD_CALL *Clear)(AMFOutput* pThis);
  248. AMF_RESULT (AMF_STD_CALL *AddTo)(AMFOutput* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
  249. AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFOutput* pThis, AMFPropertyStorage* pDest, amf_bool deep);
  250. void (AMF_STD_CALL *AddObserver)(AMFOutput* pThis, AMFPropertyStorageObserver* pObserver);
  251. void (AMF_STD_CALL *RemoveObserver)(AMFOutput* pThis, AMFPropertyStorageObserver* pObserver);
  252. // AMFPropertyStorageEx interface
  253. amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFOutput* pThis);
  254. AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFOutput* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
  255. AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFOutput* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
  256. AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFOutput* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated);
  257. // AMFOutput interface
  258. AMF_RESULT (AMF_STD_CALL *QueryOutput)(AMFOutput* pThis, AMFData** ppData);
  259. } AMFOutputVtbl;
  260. struct AMFOutput
  261. {
  262. const AMFOutputVtbl *pVtbl;
  263. };
  264. #endif // #if defined(__cplusplus)
  265. //----------------------------------------------------------------------------------------------
  266. // AMFComponent interface
  267. //----------------------------------------------------------------------------------------------
  268. #if defined(__cplusplus)
  269. class AMF_NO_VTABLE AMFComponentEx : public AMFComponent
  270. {
  271. public:
  272. AMF_DECLARE_IID(0xfda792af, 0x8712, 0x44df, 0x8e, 0xa0, 0xdf, 0xfa, 0xad, 0x2c, 0x80, 0x93)
  273. virtual amf_int32 AMF_STD_CALL GetInputCount() = 0;
  274. virtual amf_int32 AMF_STD_CALL GetOutputCount() = 0;
  275. virtual AMF_RESULT AMF_STD_CALL GetInput(amf_int32 index, AMFInput** ppInput) = 0;
  276. virtual AMF_RESULT AMF_STD_CALL GetOutput(amf_int32 index, AMFOutput** ppOutput) = 0;
  277. };
  278. //----------------------------------------------------------------------------------------------
  279. // smart pointer
  280. //----------------------------------------------------------------------------------------------
  281. typedef AMFInterfacePtr_T<AMFComponentEx> AMFComponentExPtr;
  282. #else // #if defined(__cplusplus)
  283. AMF_DECLARE_IID(AMFComponentEx, 0xfda792af, 0x8712, 0x44df, 0x8e, 0xa0, 0xdf, 0xfa, 0xad, 0x2c, 0x80, 0x93)
  284. typedef struct AMFComponentEx AMFComponentEx;
  285. typedef struct AMFComponentExVtbl
  286. {
  287. // AMFInterface interface
  288. amf_long (AMF_STD_CALL *Acquire)(AMFComponentEx* pThis);
  289. amf_long (AMF_STD_CALL *Release)(AMFComponentEx* pThis);
  290. enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComponentEx* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
  291. // AMFPropertyStorage interface
  292. AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFComponentEx* pThis, const wchar_t* name, AMFVariantStruct value);
  293. AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFComponentEx* pThis, const wchar_t* name, AMFVariantStruct* pValue);
  294. amf_bool (AMF_STD_CALL *HasProperty)(AMFComponentEx* pThis, const wchar_t* name);
  295. amf_size (AMF_STD_CALL *GetPropertyCount)(AMFComponentEx* pThis);
  296. AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFComponentEx* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
  297. AMF_RESULT (AMF_STD_CALL *Clear)(AMFComponentEx* pThis);
  298. AMF_RESULT (AMF_STD_CALL *AddTo)(AMFComponentEx* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
  299. AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFComponentEx* pThis, AMFPropertyStorage* pDest, amf_bool deep);
  300. void (AMF_STD_CALL *AddObserver)(AMFComponentEx* pThis, AMFPropertyStorageObserver* pObserver);
  301. void (AMF_STD_CALL *RemoveObserver)(AMFComponentEx* pThis, AMFPropertyStorageObserver* pObserver);
  302. // AMFPropertyStorageEx interface
  303. amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFComponentEx* pThis);
  304. AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFComponentEx* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
  305. AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFComponentEx* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
  306. AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFComponentEx* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated);
  307. // AMFComponent interface
  308. AMF_RESULT (AMF_STD_CALL *Init)(AMFComponentEx* pThis, AMF_SURFACE_FORMAT format,amf_int32 width,amf_int32 height);
  309. AMF_RESULT (AMF_STD_CALL *ReInit)(AMFComponentEx* pThis, amf_int32 width,amf_int32 height);
  310. AMF_RESULT (AMF_STD_CALL *Terminate)(AMFComponentEx* pThis);
  311. AMF_RESULT (AMF_STD_CALL *Drain)(AMFComponentEx* pThis);
  312. AMF_RESULT (AMF_STD_CALL *Flush)(AMFComponentEx* pThis);
  313. AMF_RESULT (AMF_STD_CALL *SubmitInput)(AMFComponentEx* pThis, AMFData* pData);
  314. AMF_RESULT (AMF_STD_CALL *QueryOutput)(AMFComponentEx* pThis, AMFData** ppData);
  315. AMFContext* (AMF_STD_CALL *GetContext)(AMFComponentEx* pThis);
  316. AMF_RESULT (AMF_STD_CALL *SetOutputDataAllocatorCB)(AMFComponentEx* pThis, AMFDataAllocatorCB* callback);
  317. AMF_RESULT (AMF_STD_CALL *GetCaps)(AMFComponentEx* pThis, AMFCaps** ppCaps);
  318. AMF_RESULT (AMF_STD_CALL *Optimize)(AMFComponentEx* pThis, AMFComponentOptimizationCallback* pCallback);
  319. // AMFComponentEx interface
  320. amf_int32 (AMF_STD_CALL *GetInputCount)(AMFComponentEx* pThis);
  321. amf_int32 (AMF_STD_CALL *GetOutputCount)(AMFComponentEx* pThis);
  322. AMF_RESULT (AMF_STD_CALL *GetInput)(AMFComponentEx* pThis, amf_int32 index, AMFInput** ppInput);
  323. AMF_RESULT (AMF_STD_CALL *GetOutput)(AMFComponentEx* pThis, amf_int32 index, AMFOutput** ppOutput);
  324. } AMFComponentExVtbl;
  325. struct AMFComponentEx
  326. {
  327. const AMFComponentExVtbl *pVtbl;
  328. };
  329. #endif // #if defined(__cplusplus)
  330. #if defined(__cplusplus)
  331. } // namespace
  332. #endif
  333. typedef enum AMF_STREAM_TYPE_ENUM
  334. {
  335. AMF_STREAM_UNKNOWN = 0,
  336. AMF_STREAM_VIDEO = 1,
  337. AMF_STREAM_AUDIO = 2,
  338. AMF_STREAM_DATA = 3,
  339. } AMF_STREAM_TYPE_ENUM;
  340. typedef enum AMF_STREAM_CODEC_ID_ENUM // matched codecs from VideoDecoxcderUVD.h
  341. {
  342. AMF_STREAM_CODEC_ID_UNKNOWN = 0,
  343. AMF_STREAM_CODEC_ID_MPEG2 = 1, // AMFVideoDecoderUVD_MPEG2
  344. AMF_STREAM_CODEC_ID_MPEG4 = 2, // AMFVideoDecoderUVD_MPEG4
  345. AMF_STREAM_CODEC_ID_WMV3 = 3, // AMFVideoDecoderUVD_WMV3
  346. AMF_STREAM_CODEC_ID_VC1 = 4, // AMFVideoDecoderUVD_VC1
  347. AMF_STREAM_CODEC_ID_H264_AVC = 5, // AMFVideoDecoderUVD_H264_AVC
  348. AMF_STREAM_CODEC_ID_H264_MVC = 6, // AMFVideoDecoderUVD_H264_MVC
  349. AMF_STREAM_CODEC_ID_H264_SVC = 7, // AMFVideoDecoderUVD_H264_SVC
  350. AMF_STREAM_CODEC_ID_MJPEG = 8, // AMFVideoDecoderUVD_MJPEG
  351. AMF_STREAM_CODEC_ID_H265_HEVC = 9, // AMFVideoDecoderHW_H265_HEVC
  352. AMF_STREAM_CODEC_ID_H265_MAIN10 = 10, // AMFVideoDecoderHW_H265_MAIN10
  353. AMF_STREAM_CODEC_ID_VP9 = 11, // AMFVideoDecoderHW_VP9
  354. AMF_STREAM_CODEC_ID_VP9_10BIT = 12, // AMFVideoDecoderHW_VP9_10BIT
  355. AMF_STREAM_CODEC_ID_AV1 = 13, // AMFVideoDecoderHW_AV1
  356. AMF_STREAM_CODEC_ID_AV1_12BIT = 14, // AMFVideoDecoderHW_AV1_12BIT
  357. } AMF_STREAM_CODEC_ID_ENUM;
  358. // common stream properties
  359. #define AMF_STREAM_TYPE L"StreamType" // amf_int64( AMF_STREAM_TYPE_ENUM )
  360. #define AMF_STREAM_ENABLED L"Enabled" // bool( default = false )
  361. #define AMF_STREAM_CODEC_ID L"CodecID" // amf_int64(Video: AMF_STREAM_CODEC_ID_ENUM, Audio: AVCodecID) (default = 0 - uncompressed)
  362. #define AMF_STREAM_BIT_RATE L"BitRate" // amf_int64 (default = codec->bit_rate)
  363. #define AMF_STREAM_EXTRA_DATA L"ExtraData" // interface to AMFBuffer - as is from FFMPEG
  364. // video stream properties
  365. #define AMF_STREAM_VIDEO_MEMORY_TYPE L"VideoMemoryType" // amf_int64(AMF_MEMORY_TYPE); default = AMF_MEMORY_DX11
  366. #define AMF_STREAM_VIDEO_FORMAT L"VideoFormat" // amf_int64(AMF_SURFACE_FORMAT); default = AMF_SURFACE_NV12 (used if AMF_STREAM_CODEC_ID == 0)
  367. #define AMF_STREAM_VIDEO_FRAME_RATE L"VideoFrameRate" // AMFRate; default = (30,1) - video frame rate
  368. #define AMF_STREAM_VIDEO_FRAME_SIZE L"VideoFrameSize" // AMFSize; default = (1920,1080) - video frame rate
  369. #define AMF_STREAM_VIDEO_SURFACE_POOL L"VideoSurfacePool" // amf_int64; default = 5, number of allocated output surfaces
  370. //TODO support interlaced frames
  371. // audio stream properties
  372. #define AMF_STREAM_AUDIO_FORMAT L"AudioFormat" // amf_int64(AMF_AUDIO_FORMAT); default = AMFAF_S16
  373. #define AMF_STREAM_AUDIO_SAMPLE_RATE L"AudioSampleRate" // amf_int64; default = 48000
  374. #define AMF_STREAM_AUDIO_CHANNELS L"AudioChannels" // amf_int64; default = 2
  375. #define AMF_STREAM_AUDIO_CHANNEL_LAYOUT L"AudioChannelLayout" // amf_int64 (default = codec->channel_layout)
  376. #define AMF_STREAM_AUDIO_BLOCK_ALIGN L"AudioBlockAlign" // amf_int64 (default = codec->block_align)
  377. #define AMF_STREAM_AUDIO_FRAME_SIZE L"AudioFrameSize" // amf_int64 (default = codec->frame_size)
  378. #endif //#ifndef AMF_Component_h