FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/vaapi_decode.h
Date: 2021-09-24 20:55:06
Exec Total Coverage
Lines: 0 2 0.0%
Branches: 0 0 -%

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 AVCODEC_VAAPI_DECODE_H
20 #define AVCODEC_VAAPI_DECODE_H
21
22 #include <va/va.h>
23
24 #include "libavutil/frame.h"
25 #include "libavutil/hwcontext.h"
26 #include "libavutil/hwcontext_vaapi.h"
27
28 #include "avcodec.h"
29
30 static inline VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
31 {
32 return (uintptr_t)pic->data[3];
33 }
34
35 enum {
36 MAX_PARAM_BUFFERS = 16,
37 };
38
39 typedef struct VAAPIDecodePicture {
40 VASurfaceID output_surface;
41
42 int nb_param_buffers;
43 VABufferID param_buffers[MAX_PARAM_BUFFERS];
44
45 int nb_slices;
46 VABufferID *slice_buffers;
47 int slices_allocated;
48 } VAAPIDecodePicture;
49
50 typedef struct VAAPIDecodeContext {
51 VAConfigID va_config;
52 VAContextID va_context;
53
54 AVHWDeviceContext *device;
55 AVVAAPIDeviceContext *hwctx;
56
57 AVHWFramesContext *frames;
58 AVVAAPIFramesContext *hwfc;
59
60 enum AVPixelFormat surface_format;
61 int surface_count;
62
63 VASurfaceAttrib pixel_format_attribute;
64 } VAAPIDecodeContext;
65
66
67 int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
68 VAAPIDecodePicture *pic,
69 int type,
70 const void *data,
71 size_t size);
72
73 int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
74 VAAPIDecodePicture *pic,
75 const void *params_data,
76 size_t params_size,
77 const void *slice_data,
78 size_t slice_size);
79
80 int ff_vaapi_decode_issue(AVCodecContext *avctx,
81 VAAPIDecodePicture *pic);
82 int ff_vaapi_decode_cancel(AVCodecContext *avctx,
83 VAAPIDecodePicture *pic);
84
85 int ff_vaapi_decode_init(AVCodecContext *avctx);
86 int ff_vaapi_decode_uninit(AVCodecContext *avctx);
87
88 int ff_vaapi_common_frame_params(AVCodecContext *avctx,
89 AVBufferRef *hw_frames_ctx);
90
91 #endif /* AVCODEC_VAAPI_DECODE_H */
92