| Line | Branch | Exec | Source |
|---|---|---|---|
| 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 | |||
| 19 | #ifndef AVFILTER_VAAPI_VPP_H | ||
| 20 | #define AVFILTER_VAAPI_VPP_H | ||
| 21 | |||
| 22 | #include <va/va.h> | ||
| 23 | #include <va/va_vpp.h> | ||
| 24 | |||
| 25 | #include "libavutil/hwcontext.h" | ||
| 26 | #include "libavutil/hwcontext_vaapi.h" | ||
| 27 | |||
| 28 | #include "avfilter.h" | ||
| 29 | |||
| 30 | ✗ | static inline VASurfaceID ff_vaapi_vpp_get_surface_id(const AVFrame *frame) | |
| 31 | { | ||
| 32 | ✗ | return (uintptr_t)frame->data[3]; | |
| 33 | } | ||
| 34 | |||
| 35 | // ARGB black, for VAProcPipelineParameterBuffer.output_background_color. | ||
| 36 | #define VAAPI_VPP_BACKGROUND_BLACK 0xff000000 | ||
| 37 | |||
| 38 | typedef struct VAAPIVPPContext { | ||
| 39 | const AVClass *class; | ||
| 40 | |||
| 41 | AVVAAPIDeviceContext *hwctx; | ||
| 42 | AVBufferRef *device_ref; | ||
| 43 | |||
| 44 | int valid_ids; | ||
| 45 | VAConfigID va_config; | ||
| 46 | VAContextID va_context; | ||
| 47 | |||
| 48 | AVBufferRef *input_frames_ref; | ||
| 49 | AVHWFramesContext *input_frames; | ||
| 50 | VARectangle input_region; | ||
| 51 | |||
| 52 | enum AVPixelFormat output_format; | ||
| 53 | int output_width; // computed width | ||
| 54 | int output_height; // computed height | ||
| 55 | |||
| 56 | VABufferID filter_buffers[VAProcFilterCount]; | ||
| 57 | int nb_filter_buffers; | ||
| 58 | |||
| 59 | int passthrough; | ||
| 60 | |||
| 61 | int (*build_filter_params)(AVFilterContext *avctx); | ||
| 62 | |||
| 63 | void (*pipeline_uninit)(AVFilterContext *avctx); | ||
| 64 | } VAAPIVPPContext; | ||
| 65 | |||
| 66 | void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx); | ||
| 67 | |||
| 68 | void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx); | ||
| 69 | |||
| 70 | int ff_vaapi_vpp_query_formats(const AVFilterContext *avctx, | ||
| 71 | AVFilterFormatsConfig **cfg_in, | ||
| 72 | AVFilterFormatsConfig **cfg_out); | ||
| 73 | |||
| 74 | void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx); | ||
| 75 | |||
| 76 | int ff_vaapi_vpp_config_input(AVFilterLink *inlink); | ||
| 77 | |||
| 78 | int ff_vaapi_vpp_config_output(AVFilterLink *outlink); | ||
| 79 | |||
| 80 | int ff_vaapi_vpp_init_params(AVFilterContext *avctx, | ||
| 81 | VAProcPipelineParameterBuffer *params, | ||
| 82 | const AVFrame *input_frame, | ||
| 83 | AVFrame *output_frame); | ||
| 84 | |||
| 85 | int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx, | ||
| 86 | int type, | ||
| 87 | const void *data, | ||
| 88 | size_t size, | ||
| 89 | int count); | ||
| 90 | |||
| 91 | int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, | ||
| 92 | VAProcPipelineParameterBuffer *params, | ||
| 93 | AVFrame *output_frame); | ||
| 94 | |||
| 95 | int ff_vaapi_vpp_render_pictures(AVFilterContext *avctx, | ||
| 96 | VAProcPipelineParameterBuffer *params_list, | ||
| 97 | int count, | ||
| 98 | AVFrame *output_frame); | ||
| 99 | |||
| 100 | #endif /* AVFILTER_VAAPI_VPP_H */ | ||
| 101 |