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.

104 lines
3.1KB

  1. /*
  2. * This file is part of Libav.
  3. *
  4. * Libav is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * Libav is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with Libav; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef AVCODEC_VAAPI_DECODE_H
  19. #define AVCODEC_VAAPI_DECODE_H
  20. #include <va/va.h>
  21. #include "libavutil/frame.h"
  22. #include "libavutil/hwcontext.h"
  23. #include "libavutil/hwcontext_vaapi.h"
  24. #include "libavutil/internal.h"
  25. #include "avcodec.h"
  26. #include "version.h"
  27. #if FF_API_VAAPI_CONTEXT
  28. #include "vaapi.h"
  29. #endif
  30. static inline VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
  31. {
  32. return (uintptr_t)pic->data[3];
  33. }
  34. enum {
  35. MAX_PARAM_BUFFERS = 16,
  36. };
  37. typedef struct VAAPIDecodePicture {
  38. VASurfaceID output_surface;
  39. int nb_param_buffers;
  40. VABufferID param_buffers[MAX_PARAM_BUFFERS];
  41. int nb_slices;
  42. VABufferID *slice_buffers;
  43. int slices_allocated;
  44. } VAAPIDecodePicture;
  45. typedef struct VAAPIDecodeContext {
  46. VAConfigID va_config;
  47. VAContextID va_context;
  48. #if FF_API_VAAPI_CONTEXT
  49. FF_DISABLE_DEPRECATION_WARNINGS
  50. int have_old_context;
  51. struct vaapi_context *old_context;
  52. AVBufferRef *device_ref;
  53. FF_ENABLE_DEPRECATION_WARNINGS
  54. #endif
  55. AVHWDeviceContext *device;
  56. AVVAAPIDeviceContext *hwctx;
  57. AVHWFramesContext *frames;
  58. AVVAAPIFramesContext *hwfc;
  59. enum AVPixelFormat surface_format;
  60. int surface_count;
  61. } VAAPIDecodeContext;
  62. int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
  63. VAAPIDecodePicture *pic,
  64. int type,
  65. const void *data,
  66. size_t size);
  67. int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
  68. VAAPIDecodePicture *pic,
  69. const void *params_data,
  70. size_t params_size,
  71. const void *slice_data,
  72. size_t slice_size);
  73. int ff_vaapi_decode_issue(AVCodecContext *avctx,
  74. VAAPIDecodePicture *pic);
  75. int ff_vaapi_decode_cancel(AVCodecContext *avctx,
  76. VAAPIDecodePicture *pic);
  77. int ff_vaapi_decode_init(AVCodecContext *avctx);
  78. int ff_vaapi_decode_uninit(AVCodecContext *avctx);
  79. int ff_vaapi_common_frame_params(AVCodecContext *avctx,
  80. AVBufferRef *hw_frames_ctx);
  81. #endif /* AVCODEC_VAAPI_DECODE_H */