xvmc.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /*
  2. * Copyright (C) 2003 Ivan Kalvachev
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef AVCODEC_XVMC_H
  21. #define AVCODEC_XVMC_H
  22. #include <X11/extensions/XvMC.h>
  23. #include "avcodec.h"
  24. #if LIBAVCODEC_VERSION_MAJOR < 53
  25. #define AV_XVMC_STATE_DISPLAY_PENDING 1 /** the surface should be shown, the video driver manipulates this */
  26. #define AV_XVMC_STATE_PREDICTION 2 /** the surface is needed for prediction, the codec manipulates this */
  27. #define AV_XVMC_STATE_OSD_SOURCE 4 /** the surface is needed for subpicture rendering */
  28. #endif
  29. #define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
  30. the number is 1337 speak for the letters IDCT MCo (motion compensation) */
  31. struct xvmc_pix_fmt {
  32. /** The field contains the special constant value AV_XVMC_ID.
  33. It is used as a test that the application correctly uses the API,
  34. and that there is no corruption caused by pixel routines.
  35. - application - set during initialization
  36. - libavcodec - unchanged
  37. */
  38. int xvmc_id;
  39. /** Pointer to the block array allocated by XvMCCreateBlocks().
  40. The array has to be freed by XvMCDestroyBlocks().
  41. Each group of 64 values represents one data block of differential
  42. pixel information (in MoCo mode) or coefficients for IDCT.
  43. - application - set the pointer during initialization
  44. - libavcodec - fills coefficients/pixel data into the array
  45. */
  46. short* data_blocks;
  47. /** Pointer to the macroblock description array allocated by
  48. XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks().
  49. - application - set the pointer during initialization
  50. - libavcodec - fills description data into the array
  51. */
  52. XvMCMacroBlock* mv_blocks;
  53. /** Number of macroblock descriptions that can be stored in the mv_blocks
  54. array.
  55. - application - set during initialization
  56. - libavcodec - unchanged
  57. */
  58. int allocated_mv_blocks;
  59. /** Number of blocks that can be stored at once in the data_blocks array.
  60. - application - set during initialization
  61. - libavcodec - unchanged
  62. */
  63. int allocated_data_blocks;
  64. /** Indicates that the hardware would interpret data_blocks as IDCT
  65. coefficients and perform IDCT on them.
  66. - application - set during initialization
  67. - libavcodec - unchanged
  68. */
  69. int idct;
  70. /** In MoCo mode it indicates that intra macroblocks are assumed to be in
  71. unsigned format; same as the XVMC_INTRA_UNSIGNED flag.
  72. - application - set during initialization
  73. - libavcodec - unchanged
  74. */
  75. int unsigned_intra;
  76. /** Pointer to the surface allocated by XvMCCreateSurface().
  77. It has to be freed by XvMCDestroySurface() on application exit.
  78. It identifies the frame and its state on the video hardware.
  79. - application - set during initialization
  80. - libavcodec - unchanged
  81. */
  82. XvMCSurface* p_surface;
  83. /** Set by the decoder before calling ff_draw_horiz_band(),
  84. needed by the XvMCRenderSurface function. */
  85. //@{
  86. /** Pointer to the surface used as past reference
  87. - application - unchanged
  88. - libavcodec - set
  89. */
  90. XvMCSurface* p_past_surface;
  91. /** Pointer to the surface used as future reference
  92. - application - unchanged
  93. - libavcodec - set
  94. */
  95. XvMCSurface* p_future_surface;
  96. /** top/bottom field or frame
  97. - application - unchanged
  98. - libavcodec - set
  99. */
  100. unsigned int picture_structure;
  101. /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence
  102. - application - unchanged
  103. - libavcodec - set
  104. */
  105. unsigned int flags;
  106. //}@
  107. /** Number of macroblock descriptions in the mv_blocks array
  108. that have already been passed to the hardware.
  109. - application - zeroes it on get_buffer().
  110. A successful ff_draw_horiz_band() may increment it
  111. with filled_mb_block_num or zero both.
  112. - libavcodec - unchanged
  113. */
  114. int start_mv_blocks_num;
  115. /** Number of new macroblock descriptions in the mv_blocks array (after
  116. start_mv_blocks_num) that are filled by libavcodec and have to be
  117. passed to the hardware.
  118. - application - zeroes it on get_buffer() or after successful
  119. ff_draw_horiz_band().
  120. - libavcodec - increment with one of each stored MB
  121. */
  122. int filled_mv_blocks_num;
  123. /** Number of the the next free data block; one data block consists of
  124. 64 short values in the data_blocks array.
  125. All blocks before this one are already claimed by filling their number
  126. into the corresponding blocks description structure field,
  127. that are hold in mv_blocks array.
  128. - application - zeroes it on get_buffer().
  129. A successful ff_draw_horiz_band() may zero it together
  130. with start_mb_blocks_num.
  131. - libavcodec - each decoded macroblock increases it by the number
  132. of coded blocks it contains.
  133. */
  134. int next_free_data_block_num;
  135. /** extensions may be placed here */
  136. #if LIBAVCODEC_VERSION_MAJOR < 53
  137. //@{
  138. /** State flags used to work around limitations in the MPlayer video system.
  139. 0 - Surface is not used.
  140. 1 - Surface is still held in application to be displayed or is
  141. still visible.
  142. 2 - Surface is still held in libavcodec buffer for prediction.
  143. */
  144. int state;
  145. /** pointer to the surface where the subpicture is rendered */
  146. void* p_osd_target_surface_render;
  147. //}@
  148. #endif
  149. };
  150. #endif /* AVCODEC_XVMC_H */