You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

234 lines
5.2KB

  1. /*
  2. * Video Acceleration API (shared data between FFmpeg and the video player)
  3. * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
  4. *
  5. * Copyright (C) 2008-2009 Splitted-Desktop Systems
  6. *
  7. * This file is part of FFmpeg.
  8. *
  9. * FFmpeg is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * FFmpeg is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with FFmpeg; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. */
  23. #ifndef AVCODEC_VAAPI_H
  24. #define AVCODEC_VAAPI_H
  25. #include <stdint.h>
  26. #include <va/va.h>
  27. /**
  28. * \defgroup VAAPI_Decoding VA API Decoding
  29. * \ingroup Decoder
  30. * @{
  31. */
  32. /**
  33. * This structure is used to share data between the FFmpeg library and
  34. * the client video application.
  35. * This shall be zero-allocated and available as
  36. * AVCodecContext.hwaccel_context. All user members can be set once
  37. * during initialization or through each AVCodecContext.get_buffer()
  38. * function call. In any case, they must be valid prior to calling
  39. * decoding functions.
  40. */
  41. struct vaapi_context {
  42. /**
  43. * Window system dependent data
  44. *
  45. * - encoding: unused
  46. * - decoding: Set by user
  47. */
  48. void *display;
  49. /**
  50. * Configuration ID
  51. *
  52. * - encoding: unused
  53. * - decoding: Set by user
  54. */
  55. uint32_t config_id;
  56. /**
  57. * Context ID (video decode pipeline)
  58. *
  59. * - encoding: unused
  60. * - decoding: Set by user
  61. */
  62. uint32_t context_id;
  63. /**
  64. * VAPictureParameterBuffer ID
  65. *
  66. * - encoding: unused
  67. * - decoding: Set by libavcodec
  68. */
  69. VABufferID pic_param_buf_id;
  70. /**
  71. * VAIQMatrixBuffer ID
  72. *
  73. * - encoding: unused
  74. * - decoding: Set by libavcodec
  75. */
  76. VABufferID iq_matrix_buf_id;
  77. /**
  78. * VABitPlaneBuffer ID (for VC-1 decoding)
  79. *
  80. * - encoding: unused
  81. * - decoding: Set by libavcodec
  82. */
  83. VABufferID bitplane_buf_id;
  84. /**
  85. * Slice parameter/data buffer IDs
  86. *
  87. * - encoding: unused
  88. * - decoding: Set by libavcodec
  89. */
  90. VABufferID *slice_buf_ids;
  91. /**
  92. * Number of effective slice buffer IDs to send to the HW
  93. *
  94. * - encoding: unused
  95. * - decoding: Set by libavcodec
  96. */
  97. unsigned int n_slice_buf_ids;
  98. /**
  99. * Size of pre-allocated slice_buf_ids
  100. *
  101. * - encoding: unused
  102. * - decoding: Set by libavcodec
  103. */
  104. unsigned int slice_buf_ids_alloc;
  105. /**
  106. * Picture parameter buffer
  107. *
  108. * - encoding: unused
  109. * - decoding: Set by libavcodec
  110. */
  111. union {
  112. VAPictureParameterBufferMPEG2 mpeg2;
  113. VAPictureParameterBufferMPEG4 mpeg4;
  114. VAPictureParameterBufferH264 h264;
  115. VAPictureParameterBufferVC1 vc1;
  116. } pic_param;
  117. /**
  118. * Size of a VAPictureParameterBuffer element
  119. *
  120. * - encoding: unused
  121. * - decoding: Set by libavcodec
  122. */
  123. unsigned int pic_param_size;
  124. /**
  125. * Inverse quantization matrix buffer
  126. *
  127. * - encoding: unused
  128. * - decoding: Set by libavcodec
  129. */
  130. union {
  131. VAIQMatrixBufferMPEG2 mpeg2;
  132. VAIQMatrixBufferMPEG4 mpeg4;
  133. VAIQMatrixBufferH264 h264;
  134. } iq_matrix;
  135. /**
  136. * Size of a VAIQMatrixBuffer element
  137. *
  138. * - encoding: unused
  139. * - decoding: Set by libavcodec
  140. */
  141. unsigned int iq_matrix_size;
  142. /**
  143. * Flag: is quantization matrix present?
  144. *
  145. * - encoding: unused
  146. * - decoding: Set by libavcodec
  147. */
  148. uint8_t iq_matrix_present;
  149. /**
  150. * VC-1 bitplane buffer
  151. *
  152. * - encoding: unused
  153. * - decoding: Set by libavcodec
  154. */
  155. uint8_t *bitplane_buffer;
  156. /**
  157. * Size of VC-1 bitplane buffer
  158. *
  159. * - encoding: unused
  160. * - decoding: Set by libavcodec
  161. */
  162. unsigned int bitplane_buffer_size;
  163. /**
  164. * Pointer to VASliceParameterBuffers
  165. *
  166. * - encoding: unused
  167. * - decoding: Set by libavcodec
  168. */
  169. void *slice_params;
  170. /**
  171. * Size of a VASliceParameterBuffer element
  172. *
  173. * - encoding: unused
  174. * - decoding: Set by libavcodec
  175. */
  176. unsigned int slice_param_size;
  177. /**
  178. * Size of pre-allocated slice_params
  179. *
  180. * - encoding: unused
  181. * - decoding: Set by libavcodec
  182. */
  183. unsigned int slice_params_alloc;
  184. /**
  185. * Number of slices currently filled in
  186. *
  187. * - encoding: unused
  188. * - decoding: Set by libavcodec
  189. */
  190. unsigned int slice_count;
  191. /**
  192. * Pointer to slice data buffer base
  193. * - encoding: unused
  194. * - decoding: Set by libavcodec
  195. */
  196. const uint8_t *slice_data;
  197. /**
  198. * Current size of slice data
  199. *
  200. * - encoding: unused
  201. * - decoding: Set by libavcodec
  202. */
  203. uint32_t slice_data_size;
  204. };
  205. /* @} */
  206. #endif /* AVCODEC_VAAPI_H */