]> git.sesse.net Git - ffmpeg/blob - libavfilter/vaapi_vpp.h
Merge commit '156ea66c91b1986a87916f187216978d686725f6'
[ffmpeg] / libavfilter / vaapi_vpp.h
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 // ARGB black, for VAProcPipelineParameterBuffer.output_background_color.
31 #define VAAPI_VPP_BACKGROUND_BLACK 0xff000000
32
33 typedef struct VAAPIVPPContext {
34     const AVClass *class;
35
36     AVVAAPIDeviceContext *hwctx;
37     AVBufferRef *device_ref;
38
39     int valid_ids;
40     VAConfigID  va_config;
41     VAContextID va_context;
42
43     AVBufferRef       *input_frames_ref;
44     AVHWFramesContext *input_frames;
45
46     enum AVPixelFormat output_format;
47     int output_width;   // computed width
48     int output_height;  // computed height
49
50     VABufferID         filter_buffers[VAProcFilterCount];
51     int                nb_filter_buffers;
52
53     int (*build_filter_params)(AVFilterContext *avctx);
54
55     void (*pipeline_uninit)(AVFilterContext *avctx);
56 } VAAPIVPPContext;
57
58 void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx);
59
60 void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx);
61
62 int ff_vaapi_vpp_query_formats(AVFilterContext *avctx);
63
64 void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx);
65
66 int ff_vaapi_vpp_config_input(AVFilterLink *inlink);
67
68 int ff_vaapi_vpp_config_output(AVFilterLink *outlink);
69
70 int ff_vaapi_vpp_colour_standard(enum AVColorSpace av_cs);
71
72 int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx,
73                                     int type,
74                                     const void *data,
75                                     size_t size,
76                                     int count);
77
78 int ff_vaapi_vpp_render_picture(AVFilterContext *avctx,
79                                 VAProcPipelineParameterBuffer *params,
80                                 VASurfaceID output_surface);
81
82 #endif /* AVFILTER_VAAPI_VPP_H */