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.

233 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. /**
  27. * \defgroup VAAPI_Decoding VA API Decoding
  28. * \ingroup Decoder
  29. * @{
  30. */
  31. /**
  32. * This structure is used to share data between the FFmpeg library and
  33. * the client video application.
  34. * This shall be zero-allocated and available as
  35. * AVCodecContext.hwaccel_context. All user members can be set once
  36. * during initialization or through each AVCodecContext.get_buffer()
  37. * function call. In any case, they must be valid prior to calling
  38. * decoding functions.
  39. */
  40. struct vaapi_context {
  41. /**
  42. * Window system dependent data
  43. *
  44. * - encoding: unused
  45. * - decoding: Set by user
  46. */
  47. void *display;
  48. /**
  49. * Configuration ID
  50. *
  51. * - encoding: unused
  52. * - decoding: Set by user
  53. */
  54. uint32_t config_id;
  55. /**
  56. * Context ID (video decode pipeline)
  57. *
  58. * - encoding: unused
  59. * - decoding: Set by user
  60. */
  61. uint32_t context_id;
  62. /**
  63. * VAPictureParameterBuffer ID
  64. *
  65. * - encoding: unused
  66. * - decoding: Set by libavcodec
  67. */
  68. VABufferID pic_param_buf_id;
  69. /**
  70. * VAIQMatrixBuffer ID
  71. *
  72. * - encoding: unused
  73. * - decoding: Set by libavcodec
  74. */
  75. VABufferID iq_matrix_buf_id;
  76. /**
  77. * VABitPlaneBuffer ID (for VC-1 decoding)
  78. *
  79. * - encoding: unused
  80. * - decoding: Set by libavcodec
  81. */
  82. VABufferID bitplane_buf_id;
  83. /**
  84. * Slice parameter/data buffer IDs
  85. *
  86. * - encoding: unused
  87. * - decoding: Set by libavcodec
  88. */
  89. VABufferID *slice_buf_ids;
  90. /**
  91. * Number of effective slice buffer IDs to send to the HW
  92. *
  93. * - encoding: unused
  94. * - decoding: Set by libavcodec
  95. */
  96. unsigned int n_slice_buf_ids;
  97. /**
  98. * Size of pre-allocated slice_buf_ids
  99. *
  100. * - encoding: unused
  101. * - decoding: Set by libavcodec
  102. */
  103. unsigned int slice_buf_ids_alloc;
  104. /**
  105. * Picture parameter buffer
  106. *
  107. * - encoding: unused
  108. * - decoding: Set by libavcodec
  109. */
  110. union {
  111. VAPictureParameterBufferMPEG2 mpeg2;
  112. VAPictureParameterBufferMPEG4 mpeg4;
  113. VAPictureParameterBufferH264 h264;
  114. VAPictureParameterBufferVC1 vc1;
  115. } pic_param;
  116. /**
  117. * Size of a VAPictureParameterBuffer element
  118. *
  119. * - encoding: unused
  120. * - decoding: Set by libavcodec
  121. */
  122. unsigned int pic_param_size;
  123. /**
  124. * Inverse quantization matrix buffer
  125. *
  126. * - encoding: unused
  127. * - decoding: Set by libavcodec
  128. */
  129. union {
  130. VAIQMatrixBufferMPEG2 mpeg2;
  131. VAIQMatrixBufferMPEG4 mpeg4;
  132. VAIQMatrixBufferH264 h264;
  133. } iq_matrix;
  134. /**
  135. * Size of a VAIQMatrixBuffer element
  136. *
  137. * - encoding: unused
  138. * - decoding: Set by libavcodec
  139. */
  140. unsigned int iq_matrix_size;
  141. /**
  142. * Flag: is quantization matrix present?
  143. *
  144. * - encoding: unused
  145. * - decoding: Set by libavcodec
  146. */
  147. uint8_t iq_matrix_present;
  148. /**
  149. * VC-1 bitplane buffer
  150. *
  151. * - encoding: unused
  152. * - decoding: Set by libavcodec
  153. */
  154. uint8_t *bitplane_buffer;
  155. /**
  156. * Size of VC-1 bitplane buffer
  157. *
  158. * - encoding: unused
  159. * - decoding: Set by libavcodec
  160. */
  161. unsigned int bitplane_buffer_size;
  162. /**
  163. * Pointer to VASliceParameterBuffers
  164. *
  165. * - encoding: unused
  166. * - decoding: Set by libavcodec
  167. */
  168. void *slice_params;
  169. /**
  170. * Size of a VASliceParameterBuffer element
  171. *
  172. * - encoding: unused
  173. * - decoding: Set by libavcodec
  174. */
  175. unsigned int slice_param_size;
  176. /**
  177. * Size of pre-allocated slice_params
  178. *
  179. * - encoding: unused
  180. * - decoding: Set by libavcodec
  181. */
  182. unsigned int slice_params_alloc;
  183. /**
  184. * Number of slices currently filled in
  185. *
  186. * - encoding: unused
  187. * - decoding: Set by libavcodec
  188. */
  189. unsigned int slice_count;
  190. /**
  191. * Pointer to slice data buffer base
  192. * - encoding: unused
  193. * - decoding: Set by libavcodec
  194. */
  195. const uint8_t *slice_data;
  196. /**
  197. * Current size of slice data
  198. *
  199. * - encoding: unused
  200. * - decoding: Set by libavcodec
  201. */
  202. uint32_t slice_data_size;
  203. };
  204. /* @} */
  205. #endif /* AVCODEC_VAAPI_H */