vda.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * VDA HW acceleration
  3. *
  4. * copyright (c) 2011 Sebastien Zwickert
  5. *
  6. * This file is part of FFmpeg.
  7. *
  8. * FFmpeg is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * FFmpeg is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with FFmpeg; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #ifndef AVCODEC_VDA_H
  23. #define AVCODEC_VDA_H
  24. /**
  25. * @file
  26. * @ingroup lavc_codec_hwaccel_vda
  27. * Public libavcodec VDA header.
  28. */
  29. #include <stdint.h>
  30. // emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes
  31. // http://openradar.appspot.com/8026390
  32. #undef __GNUC_STDC_INLINE__
  33. #define Picture QuickdrawPicture
  34. #include <VideoDecodeAcceleration/VDADecoder.h>
  35. #undef Picture
  36. #include "libavcodec/version.h"
  37. /**
  38. * @defgroup lavc_codec_hwaccel_vda VDA
  39. * @ingroup lavc_codec_hwaccel
  40. *
  41. * @{
  42. */
  43. /**
  44. * This structure is used to provide the necessary configurations and data
  45. * to the VDA FFmpeg HWAccel implementation.
  46. *
  47. * The application must make it available as AVCodecContext.hwaccel_context.
  48. */
  49. struct vda_context {
  50. /**
  51. * VDA decoder object.
  52. *
  53. * - encoding: unused
  54. * - decoding: Set/Unset by libavcodec.
  55. */
  56. VDADecoder decoder;
  57. /**
  58. * The Core Video pixel buffer that contains the current image data.
  59. *
  60. * encoding: unused
  61. * decoding: Set by libavcodec. Unset by user.
  62. */
  63. CVPixelBufferRef cv_buffer;
  64. /**
  65. * Use the hardware decoder in synchronous mode.
  66. *
  67. * encoding: unused
  68. * decoding: Set by user.
  69. */
  70. int use_sync_decoding;
  71. /**
  72. * The frame width.
  73. *
  74. * - encoding: unused
  75. * - decoding: Set/Unset by user.
  76. */
  77. int width;
  78. /**
  79. * The frame height.
  80. *
  81. * - encoding: unused
  82. * - decoding: Set/Unset by user.
  83. */
  84. int height;
  85. /**
  86. * The frame format.
  87. *
  88. * - encoding: unused
  89. * - decoding: Set/Unset by user.
  90. */
  91. int format;
  92. /**
  93. * The pixel format for output image buffers.
  94. *
  95. * - encoding: unused
  96. * - decoding: Set/Unset by user.
  97. */
  98. OSType cv_pix_fmt_type;
  99. /**
  100. * The current bitstream buffer.
  101. *
  102. * - encoding: unused
  103. * - decoding: Set/Unset by libavcodec.
  104. */
  105. uint8_t *priv_bitstream;
  106. /**
  107. * The current size of the bitstream.
  108. *
  109. * - encoding: unused
  110. * - decoding: Set/Unset by libavcodec.
  111. */
  112. int priv_bitstream_size;
  113. /**
  114. * The reference size used for fast reallocation.
  115. *
  116. * - encoding: unused
  117. * - decoding: Set/Unset by libavcodec.
  118. */
  119. int priv_allocated_size;
  120. /**
  121. * Use av_buffer to manage buffer.
  122. * When the flag is set, the CVPixelBuffers returned by the decoder will
  123. * be released automatically, so you have to retain them if necessary.
  124. * Not setting this flag may cause memory leak.
  125. *
  126. * encoding: unused
  127. * decoding: Set by user.
  128. */
  129. int use_ref_buffer;
  130. };
  131. /** Create the video decoder. */
  132. int ff_vda_create_decoder(struct vda_context *vda_ctx,
  133. uint8_t *extradata,
  134. int extradata_size);
  135. /** Destroy the video decoder. */
  136. int ff_vda_destroy_decoder(struct vda_context *vda_ctx);
  137. /**
  138. * @}
  139. */
  140. #endif /* AVCODEC_VDA_H */