FFmpeg
vaapi_decode.h
Go to the documentation of this file.
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"
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 {
37 };
38 
39 typedef struct VAAPIDecodePicture {
40  VASurfaceID output_surface;
41 
44 
45  int nb_slices;
46  VABufferID *slice_buffers;
49 
50 typedef struct VAAPIDecodeContext {
51  VAConfigID va_config;
52  VAContextID va_context;
53 
56 
59 
62 
63  VASurfaceAttrib pixel_format_attribute;
65 
66 
68  VAAPIDecodePicture *pic,
69  int type,
70  const void *data,
71  size_t size);
72 
74  VAAPIDecodePicture *pic,
75  const void *params_data,
76  size_t params_size,
77  const void *slice_data,
78  size_t slice_size);
79 
81  VAAPIDecodePicture *pic);
83  VAAPIDecodePicture *pic);
84 
87 
89  AVBufferRef *hw_frames_ctx);
90 
91 #endif /* AVCODEC_VAAPI_DECODE_H */
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
ff_vaapi_get_surface_id
static VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
Definition: vaapi_decode.h:30
VAAPIDecodePicture::slice_buffers
VABufferID * slice_buffers
Definition: vaapi_decode.h:46
VAAPIDecodeContext
Definition: vaapi_decode.h:50
VAAPIDecodeContext::device
AVHWDeviceContext * device
Definition: vaapi_decode.h:54
VAAPIDecodePicture
Definition: vaapi_decode.h:39
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
data
const char data[16]
Definition: mxf.c:143
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:317
VAAPIDecodePicture::nb_param_buffers
int nb_param_buffers
Definition: vaapi_decode.h:42
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
VAAPIDecodePicture::output_surface
VASurfaceID output_surface
Definition: vaapi_decode.h:40
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:61
ff_vaapi_decode_make_slice_buffer
int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, const void *params_data, size_t params_size, const void *slice_data, size_t slice_size)
Definition: vaapi_decode.c:59
MAX_PARAM_BUFFERS
@ MAX_PARAM_BUFFERS
Definition: vaapi_decode.h:36
ff_vaapi_decode_cancel
int ff_vaapi_decode_cancel(AVCodecContext *avctx, VAAPIDecodePicture *pic)
Definition: vaapi_decode.c:225
ff_vaapi_decode_uninit
int ff_vaapi_decode_uninit(AVCodecContext *avctx)
Definition: vaapi_decode.c:680
VAAPIDecodeContext::surface_format
enum AVPixelFormat surface_format
Definition: vaapi_decode.h:60
ff_vaapi_decode_issue
int ff_vaapi_decode_issue(AVCodecContext *avctx, VAAPIDecodePicture *pic)
Definition: vaapi_decode.c:151
VAAPIDecodeContext::surface_count
int surface_count
Definition: vaapi_decode.h:61
VAAPIDecodePicture::slices_allocated
int slices_allocated
Definition: vaapi_decode.h:47
VAAPIDecodeContext::va_config
VAConfigID va_config
Definition: vaapi_decode.h:51
VAAPIDecodePicture::nb_slices
int nb_slices
Definition: vaapi_decode.h:45
ff_vaapi_decode_init
int ff_vaapi_decode_init(AVCodecContext *avctx)
Definition: vaapi_decode.c:634
size
int size
Definition: twinvq_data.h:10344
VAAPIDecodeContext::pixel_format_attribute
VASurfaceAttrib pixel_format_attribute
Definition: vaapi_decode.h:63
frame.h
avcodec.h
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:124
hwcontext_vaapi.h
VAAPIDecodeContext::hwctx
AVVAAPIDeviceContext * hwctx
Definition: vaapi_decode.h:55
AVCodecContext
main external API structure.
Definition: avcodec.h:383
ff_vaapi_decode_make_param_buffer
int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, int type, const void *data, size_t size)
Definition: vaapi_decode.c:30
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
AVVAAPIFramesContext
VAAPI-specific data associated with a frame pool.
Definition: hwcontext_vaapi.h:88
VAAPIDecodeContext::va_context
VAContextID va_context
Definition: vaapi_decode.h:52
VAAPIDecodeContext::hwfc
AVVAAPIFramesContext * hwfc
Definition: vaapi_decode.h:58
VAAPIDecodePicture::param_buffers
VABufferID param_buffers[MAX_PARAM_BUFFERS]
Definition: vaapi_decode.h:43
hwcontext.h
AVVAAPIDeviceContext
VAAPI connection details.
Definition: hwcontext_vaapi.h:68
ff_vaapi_common_frame_params
int ff_vaapi_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Definition: vaapi_decode.c:610
VAAPIDecodeContext::frames
AVHWFramesContext * frames
Definition: vaapi_decode.h:57