xine-lib  1.2.10
accel_vaapi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Edgar Hucek <gimli|@dark-green.com>
3  * Copyright (C) 2012-2016 xine developers
4  *
5  * This file is part of xine, a free video player.
6  *
7  * xine is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * xine is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
20  *
21  *
22  * Common acceleration definitions for vaapi
23  *
24  *
25  */
26 
27 #ifndef HAVE_XINE_ACCEL_VAAPI_H
28 #define HAVE_XINE_ACCEL_VAAPI_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <va/va.h>
35 
36 #define SURFACE_FREE 0
37 #define SURFACE_ALOC 1
38 #define SURFACE_RELEASE 2
39 #define SURFACE_RENDER 3
40 #define SURFACE_RENDER_RELEASE 5
41 
43  VADisplayAttribute brightness;
44  VADisplayAttribute contrast;
45  VADisplayAttribute hue;
46  VADisplayAttribute saturation;
47 };
48 
51 
53  VADisplay va_display;
54  VAContextID va_context_id;
55  VAConfigID va_config_id;
56  int width;
57  int height;
58  unsigned int valid_context;
59 
60  /* decoding surfaces */
61  VASurfaceID *va_surface_ids;
63  unsigned int va_head;
64 
66  VAImageFormat *va_image_formats;
68 };
69 
71 
73  unsigned int index;
74  VASurfaceID va_surface_id;
75  unsigned int status;
76 };
77 
78  /*
79  *
80  */
81 
82 #define IMGFMT_VAAPI 0x56410000 /* 'VA'00 */
83 #define IMGFMT_VAAPI_MASK 0xFFFF0000
84 #define IMGFMT_VAAPI_CODEC_MASK 0x000000F0
85 #define IMGFMT_VAAPI_CODEC(fmt) ((fmt) & IMGFMT_VAAPI_CODEC_MASK)
86 #define IMGFMT_VAAPI_CODEC_MPEG2 (0x10)
87 #define IMGFMT_VAAPI_CODEC_MPEG4 (0x20)
88 #define IMGFMT_VAAPI_CODEC_H264 (0x30)
89 #define IMGFMT_VAAPI_CODEC_VC1 (0x40)
90 #define IMGFMT_VAAPI_CODEC_HEVC (0x50)
91 #define IMGFMT_VAAPI_MPEG2 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_MPEG2)
92 #define IMGFMT_VAAPI_MPEG2_IDCT (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_MPEG2|1)
93 #define IMGFMT_VAAPI_MPEG2_MOCO (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_MPEG2|2)
94 #define IMGFMT_VAAPI_MPEG4 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_MPEG4)
95 #define IMGFMT_VAAPI_H263 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_MPEG4|1)
96 #define IMGFMT_VAAPI_H264 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_H264)
97 #define IMGFMT_VAAPI_HEVC (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_HEVC)
98 #define IMGFMT_VAAPI_HEVC_MAIN10 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_HEVC|1)
99 #define IMGFMT_VAAPI_VC1 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_VC1)
100 #define IMGFMT_VAAPI_WMV3 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_VC1|1)
101 
103  int (*lock_vaapi)(vo_frame_t *frame_gen);
104  void (*unlock_vaapi)(vo_frame_t *frame_gen);
105 
106  VAStatus (*vaapi_init)(vo_frame_t *frame_gen, int va_profile, int width, int height);
107  int (*profile_from_imgfmt)(vo_frame_t *frame_gen, unsigned img_fmt);
108  ff_vaapi_context_t *(*get_context)(vo_frame_t *frame_gen);
109  int (*guarded_render)(vo_frame_t *frame_gen);
110  ff_vaapi_surface_t *(*get_vaapi_surface)(vo_frame_t *frame_gen);
111  void (*render_vaapi_surface)(vo_frame_t *frame_gen, ff_vaapi_surface_t *va_surface);
112  void (*release_vaapi_surface)(vo_frame_t *frame_gen, ff_vaapi_surface_t *va_surface);
113 };
114 
116  unsigned int index;
117 
118  const struct vaapi_accel_funcs_s *f;
119 };
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif
126 
vaapi_accel_funcs_s::guarded_render
int(* guarded_render)(vo_frame_t *frame_gen)
Definition: accel_vaapi.h:109
ff_vaapi_context_s::va_render_surfaces
ff_vaapi_surface_t * va_render_surfaces
Definition: accel_vaapi.h:62
ff_vaapi_context_s::va_context_id
VAContextID va_context_id
Definition: accel_vaapi.h:54
ff_vaapi_context_s::va_image_formats
VAImageFormat * va_image_formats
Definition: accel_vaapi.h:66
vaapi_accel_funcs_s::unlock_vaapi
void(* unlock_vaapi)(vo_frame_t *frame_gen)
Definition: accel_vaapi.h:104
ff_vaapi_surface_s::index
unsigned int index
Definition: accel_vaapi.h:73
vaapi_accel_s::index
unsigned int index
Definition: accel_vaapi.h:116
ff_vaapi_surface_s::status
unsigned int status
Definition: accel_vaapi.h:75
vaapi_accel_funcs_s::profile_from_imgfmt
int(* profile_from_imgfmt)(vo_frame_t *frame_gen, unsigned img_fmt)
Definition: accel_vaapi.h:107
ff_vaapi_context_s::height
int height
Definition: accel_vaapi.h:57
vaapi_equalizer::contrast
VADisplayAttribute contrast
Definition: accel_vaapi.h:44
vaapi_equalizer::brightness
VADisplayAttribute brightness
Definition: accel_vaapi.h:43
ff_vaapi_context_s::va_surface_ids
VASurfaceID * va_surface_ids
Definition: accel_vaapi.h:61
vaapi_equalizer
Definition: accel_vaapi.h:42
ff_vaapi_context_s::va_num_image_formats
int va_num_image_formats
Definition: accel_vaapi.h:67
vo_driver_t
Definition: video_out.h:50
ff_vaapi_surface_s
Definition: accel_vaapi.h:72
ff_vaapi_context_s
Definition: accel_vaapi.h:52
width
unsigned int width
Definition: gfontrle.c:4
ff_vaapi_surface_s::va_surface_id
VASurfaceID va_surface_id
Definition: accel_vaapi.h:74
vaapi_accel_s::f
const struct vaapi_accel_funcs_s * f
Definition: accel_vaapi.h:118
vaapi_equalizer::hue
VADisplayAttribute hue
Definition: accel_vaapi.h:45
ff_vaapi_context_s::va_config_id
VAConfigID va_config_id
Definition: accel_vaapi.h:55
vaapi_accel_funcs_s::render_vaapi_surface
void(* render_vaapi_surface)(vo_frame_t *frame_gen, ff_vaapi_surface_t *va_surface)
Definition: accel_vaapi.h:111
vaapi_accel_funcs_s::release_vaapi_surface
void(* release_vaapi_surface)(vo_frame_t *frame_gen, ff_vaapi_surface_t *va_surface)
Definition: accel_vaapi.h:112
ff_vaapi_context_s::valid_context
unsigned int valid_context
Definition: accel_vaapi.h:58
vaapi_equalizer::saturation
VADisplayAttribute saturation
Definition: accel_vaapi.h:46
height
unsigned int height
Definition: gfontrle.c:5
vaapi_accel_funcs_s::vaapi_init
VAStatus(* vaapi_init)(vo_frame_t *frame_gen, int va_profile, int width, int height)
Definition: accel_vaapi.h:106
vaapi_accel_funcs_s::lock_vaapi
int(* lock_vaapi)(vo_frame_t *frame_gen)
Definition: accel_vaapi.h:103
vo_frame_s
Definition: video_out.h:59
ff_vaapi_context_s::va_display
VADisplay va_display
Definition: accel_vaapi.h:53
ff_vaapi_context_s::width
int width
Definition: accel_vaapi.h:56
vaapi_accel_funcs_s
Definition: accel_vaapi.h:102
ff_vaapi_context_s::driver
vo_driver_t * driver
Definition: accel_vaapi.h:65
vaapi_accel_s
Definition: accel_vaapi.h:115
ff_vaapi_context_s::va_head
unsigned int va_head
Definition: accel_vaapi.h:63