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.

100 lines
3.0KB

  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 "avcodec.h"
  25. #include "version.h"
  26. #if FF_API_VAAPI_CONTEXT
  27. #include "vaapi.h"
  28. #endif
  29. static inline VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
  30. {
  31. return (uintptr_t)pic->data[3];
  32. }
  33. enum {
  34. MAX_PARAM_BUFFERS = 16,
  35. };
  36. typedef struct VAAPIDecodePicture {
  37. VASurfaceID output_surface;
  38. int nb_param_buffers;
  39. VABufferID param_buffers[MAX_PARAM_BUFFERS];
  40. int nb_slices;
  41. VABufferID *slice_buffers;
  42. int slices_allocated;
  43. } VAAPIDecodePicture;
  44. typedef struct VAAPIDecodeContext {
  45. VAProfile va_profile;
  46. VAEntrypoint va_entrypoint;
  47. VAConfigID va_config;
  48. VAContextID va_context;
  49. #if FF_API_VAAPI_CONTEXT
  50. int have_old_context;
  51. struct vaapi_context *old_context;
  52. AVBufferRef *device_ref;
  53. #endif
  54. AVHWDeviceContext *device;
  55. AVVAAPIDeviceContext *hwctx;
  56. AVHWFramesContext *frames;
  57. AVVAAPIFramesContext *hwfc;
  58. enum AVPixelFormat surface_format;
  59. int surface_count;
  60. } VAAPIDecodeContext;
  61. int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
  62. VAAPIDecodePicture *pic,
  63. int type,
  64. const void *data,
  65. size_t size);
  66. int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
  67. VAAPIDecodePicture *pic,
  68. const void *params_data,
  69. size_t params_size,
  70. const void *slice_data,
  71. size_t slice_size);
  72. int ff_vaapi_decode_issue(AVCodecContext *avctx,
  73. VAAPIDecodePicture *pic);
  74. int ff_vaapi_decode_cancel(AVCodecContext *avctx,
  75. VAAPIDecodePicture *pic);
  76. int ff_vaapi_decode_init(AVCodecContext *avctx);
  77. int ff_vaapi_decode_uninit(AVCodecContext *avctx);
  78. #endif /* AVCODEC_VAAPI_DECODE_H */