ComponentCaps.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. #ifndef AMF_ComponentCaps_h
  33. #define AMF_ComponentCaps_h
  34. #pragma once
  35. #include "../core/Interface.h"
  36. #include "../core/PropertyStorage.h"
  37. #include "../core/Surface.h"
  38. #if defined(__cplusplus)
  39. namespace amf
  40. {
  41. #endif
  42. typedef enum AMF_ACCELERATION_TYPE
  43. {
  44. AMF_ACCEL_NOT_SUPPORTED = -1,
  45. AMF_ACCEL_HARDWARE,
  46. AMF_ACCEL_GPU,
  47. AMF_ACCEL_SOFTWARE
  48. } AMF_ACCELERATION_TYPE;
  49. //----------------------------------------------------------------------------------------------
  50. // AMFIOCaps interface
  51. //----------------------------------------------------------------------------------------------
  52. #if defined(__cplusplus)
  53. class AMF_NO_VTABLE AMFIOCaps : public AMFInterface
  54. {
  55. public:
  56. // Get supported resolution ranges in pixels/lines:
  57. virtual void AMF_STD_CALL GetWidthRange(amf_int32* minWidth, amf_int32* maxWidth) const = 0;
  58. virtual void AMF_STD_CALL GetHeightRange(amf_int32* minHeight, amf_int32* maxHeight) const = 0;
  59. // Get memory alignment in lines: Vertical aligmnent should be multiples of this number
  60. virtual amf_int32 AMF_STD_CALL GetVertAlign() const = 0;
  61. // Enumerate supported surface pixel formats
  62. virtual amf_int32 AMF_STD_CALL GetNumOfFormats() const = 0;
  63. virtual AMF_RESULT AMF_STD_CALL GetFormatAt(amf_int32 index, AMF_SURFACE_FORMAT* format, amf_bool* native) const = 0;
  64. // Enumerate supported memory types
  65. virtual amf_int32 AMF_STD_CALL GetNumOfMemoryTypes() const = 0;
  66. virtual AMF_RESULT AMF_STD_CALL GetMemoryTypeAt(amf_int32 index, AMF_MEMORY_TYPE* memType, amf_bool* native) const = 0;
  67. virtual amf_bool AMF_STD_CALL IsInterlacedSupported() const = 0;
  68. };
  69. //----------------------------------------------------------------------------------------------
  70. // smart pointer
  71. //----------------------------------------------------------------------------------------------
  72. typedef AMFInterfacePtr_T<AMFIOCaps> AMFIOCapsPtr;
  73. #else // #if defined(__cplusplus)
  74. typedef struct AMFIOCaps AMFIOCaps;
  75. typedef struct AMFIOCapsVtbl
  76. {
  77. // AMFInterface interface
  78. amf_long (AMF_STD_CALL *Acquire)(AMFIOCaps* pThis);
  79. amf_long (AMF_STD_CALL *Release)(AMFIOCaps* pThis);
  80. enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFIOCaps* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
  81. // AMFIOCaps interface
  82. // Get supported resolution ranges in pixels/lines:
  83. void (AMF_STD_CALL *GetWidthRange)(AMFIOCaps* pThis, amf_int32* minWidth, amf_int32* maxWidth);
  84. void (AMF_STD_CALL *GetHeightRange)(AMFIOCaps* pThis, amf_int32* minHeight, amf_int32* maxHeight);
  85. // Get memory alignment in lines: Vertical aligmnent should be multiples of this number
  86. amf_int32 (AMF_STD_CALL *GetVertAlign)(AMFIOCaps* pThis);
  87. // Enumerate supported surface pixel formats
  88. amf_int32 (AMF_STD_CALL *GetNumOfFormats)(AMFIOCaps* pThis);
  89. AMF_RESULT (AMF_STD_CALL *GetFormatAt)(AMFIOCaps* pThis, amf_int32 index, AMF_SURFACE_FORMAT* format, amf_bool* native);
  90. // Enumerate supported memory types
  91. amf_int32 (AMF_STD_CALL *GetNumOfMemoryTypes)(AMFIOCaps* pThis);
  92. AMF_RESULT (AMF_STD_CALL *GetMemoryTypeAt)(AMFIOCaps* pThis, amf_int32 index, AMF_MEMORY_TYPE* memType, amf_bool* native);
  93. amf_bool (AMF_STD_CALL *IsInterlacedSupported)(AMFIOCaps* pThis);
  94. } AMFIOCapsVtbl;
  95. struct AMFIOCaps
  96. {
  97. const AMFIOCapsVtbl *pVtbl;
  98. };
  99. #endif // #if defined(__cplusplus)
  100. //----------------------------------------------------------------------------------------------
  101. // AMFCaps interface - base interface for every h/w module supported by Capability Manager
  102. //----------------------------------------------------------------------------------------------
  103. #if defined(__cplusplus)
  104. class AMF_NO_VTABLE AMFCaps : public AMFPropertyStorage
  105. {
  106. public:
  107. virtual AMF_ACCELERATION_TYPE AMF_STD_CALL GetAccelerationType() const = 0;
  108. virtual AMF_RESULT AMF_STD_CALL GetInputCaps(AMFIOCaps** input) = 0;
  109. virtual AMF_RESULT AMF_STD_CALL GetOutputCaps(AMFIOCaps** output) = 0;
  110. };
  111. //----------------------------------------------------------------------------------------------
  112. // smart pointer
  113. //----------------------------------------------------------------------------------------------
  114. typedef AMFInterfacePtr_T<AMFCaps> AMFCapsPtr;
  115. #else // #if defined(__cplusplus)
  116. typedef struct AMFCaps AMFCaps;
  117. typedef struct AMFCapsVtbl
  118. {
  119. // AMFInterface interface
  120. amf_long (AMF_STD_CALL *Acquire)(AMFCaps* pThis);
  121. amf_long (AMF_STD_CALL *Release)(AMFCaps* pThis);
  122. enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFCaps* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
  123. // AMFPropertyStorage interface
  124. AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFCaps* pThis, const wchar_t* name, AMFVariantStruct value);
  125. AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFCaps* pThis, const wchar_t* name, AMFVariantStruct* pValue);
  126. amf_bool (AMF_STD_CALL *HasProperty)(AMFCaps* pThis, const wchar_t* name);
  127. amf_size (AMF_STD_CALL *GetPropertyCount)(AMFCaps* pThis);
  128. AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFCaps* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
  129. AMF_RESULT (AMF_STD_CALL *Clear)(AMFCaps* pThis);
  130. AMF_RESULT (AMF_STD_CALL *AddTo)(AMFCaps* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
  131. AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFCaps* pThis, AMFPropertyStorage* pDest, amf_bool deep);
  132. void (AMF_STD_CALL *AddObserver)(AMFCaps* pThis, AMFPropertyStorageObserver* pObserver);
  133. void (AMF_STD_CALL *RemoveObserver)(AMFCaps* pThis, AMFPropertyStorageObserver* pObserver);
  134. // AMFCaps interface
  135. AMF_ACCELERATION_TYPE (AMF_STD_CALL *GetAccelerationType)(AMFCaps* pThis);
  136. AMF_RESULT (AMF_STD_CALL *GetInputCaps)(AMFCaps* pThis, AMFIOCaps** input);
  137. AMF_RESULT (AMF_STD_CALL *GetOutputCaps)(AMFCaps* pThis, AMFIOCaps** output);
  138. } AMFCapsVtbl;
  139. struct AMFCaps
  140. {
  141. const AMFCapsVtbl *pVtbl;
  142. };
  143. #endif // #if defined(__cplusplus)
  144. //----------------------------------------------------------------------------------------------
  145. #if defined(__cplusplus)
  146. }
  147. #endif
  148. #endif //#ifndef AMF_ComponentCaps_h