vaapi_vpp.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * This file is part of FFmpeg.
  3. *
  4. * FFmpeg 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. * FFmpeg 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 FFmpeg; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef AVFILTER_VAAPI_VPP_H
  19. #define AVFILTER_VAAPI_VPP_H
  20. #include <va/va.h>
  21. #include <va/va_vpp.h>
  22. #include "libavutil/hwcontext.h"
  23. #include "libavutil/hwcontext_vaapi.h"
  24. #include "avfilter.h"
  25. // ARGB black, for VAProcPipelineParameterBuffer.output_background_color.
  26. #define VAAPI_VPP_BACKGROUND_BLACK 0xff000000
  27. typedef struct VAAPIVPPContext {
  28. const AVClass *class;
  29. AVVAAPIDeviceContext *hwctx;
  30. AVBufferRef *device_ref;
  31. int valid_ids;
  32. VAConfigID va_config;
  33. VAContextID va_context;
  34. AVBufferRef *input_frames_ref;
  35. AVHWFramesContext *input_frames;
  36. VARectangle input_region;
  37. enum AVPixelFormat output_format;
  38. int output_width; // computed width
  39. int output_height; // computed height
  40. VABufferID filter_buffers[VAProcFilterCount];
  41. int nb_filter_buffers;
  42. int (*build_filter_params)(AVFilterContext *avctx);
  43. void (*pipeline_uninit)(AVFilterContext *avctx);
  44. } VAAPIVPPContext;
  45. void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx);
  46. void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx);
  47. int ff_vaapi_vpp_query_formats(AVFilterContext *avctx);
  48. void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx);
  49. int ff_vaapi_vpp_config_input(AVFilterLink *inlink);
  50. int ff_vaapi_vpp_config_output(AVFilterLink *outlink);
  51. int ff_vaapi_vpp_init_params(AVFilterContext *avctx,
  52. VAProcPipelineParameterBuffer *params,
  53. const AVFrame *input_frame,
  54. AVFrame *output_frame);
  55. int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx,
  56. int type,
  57. const void *data,
  58. size_t size,
  59. int count);
  60. int ff_vaapi_vpp_render_picture(AVFilterContext *avctx,
  61. VAProcPipelineParameterBuffer *params,
  62. AVFrame *output_frame);
  63. #endif /* AVFILTER_VAAPI_VPP_H */