1 /*
2  *  gstvaapitypes.h - Basic types
3  *
4  *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5  *    Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
6  *  Copyright (C) 2012-2014 Intel Corporation
7  *    Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
8  *
9  *  This library is free software; you can redistribute it and/or
10  *  modify it under the terms of the GNU Lesser General Public License
11  *  as published by the Free Software Foundation; either version 2.1
12  *  of the License, or (at your option) any later version.
13  *
14  *  This library is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  *  Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public
20  *  License along with this library; if not, write to the Free
21  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  *  Boston, MA 02110-1301 USA
23  */
24 
25 #ifndef GST_VAAPI_TYPES_H
26 #define GST_VAAPI_TYPES_H
27 
28 #include <glib.h>
29 
30 G_BEGIN_DECLS
31 
32 /**
33  * GstVaapiID:
34  *
35  * An integer large enough to hold a generic VA id or a pointer
36  * wherever necessary.
37  */
38 typedef gsize GstVaapiID;
39 
40 /**
41  * GST_VAAPI_ID:
42  * @id: an arbitrary integer value
43  *
44  * Macro that creates a #GstVaapiID from @id.
45  */
46 #define GST_VAAPI_ID(id) ((GstVaapiID)(id))
47 
48 /**
49  * GST_VAAPI_ID_INVALID:
50  *
51  * Macro that evaluates to an invalid #GstVaapiID value.
52  */
53 #define GST_VAAPI_ID_INVALID GST_VAAPI_ID((gssize)(gint32)-1)
54 
55 /**
56  * GST_VAAPI_ID_FORMAT:
57  *
58  * Can be used together with #GST_VAAPI_ID_ARGS to properly output an
59  * integer value in a printf()-style text message.
60  * <informalexample>
61  * <programlisting>
62  * printf("id: %" GST_VAAPI_ID_FORMAT "\n", GST_VAAPI_ID_ARGS(id));
63  * </programlisting>
64  * </informalexample>
65  */
66 #define GST_VAAPI_ID_FORMAT "p"
67 
68 /**
69  * GST_VAAPI_ID_ARGS:
70  * @id: a #GstVaapiID
71  *
72  * Can be used together with #GST_VAAPI_ID_FORMAT to properly output
73  * an integer value in a printf()-style text message.
74  */
75 #define GST_VAAPI_ID_ARGS(id) GSIZE_TO_POINTER(id)
76 
77 /**
78  * GstVaapiPoint:
79  * @x: X coordinate
80  * @y: Y coordinate
81  *
82  * A location within a surface.
83  */
84 typedef struct _GstVaapiPoint GstVaapiPoint;
85 struct _GstVaapiPoint {
86     guint32 x;
87     guint32 y;
88 };
89 
90 /**
91  * GstVaapiRectangle:
92  * @x: X coordinate
93  * @y: Y coordinate
94  * @width: region width
95  * @height: region height
96  *
97  * A rectangle region within a surface.
98  */
99 typedef struct _GstVaapiRectangle GstVaapiRectangle;
100 struct _GstVaapiRectangle {
101     guint32 x;
102     guint32 y;
103     guint32 width;
104     guint32 height;
105 };
106 
107 /**
108  * GstVaapiRenderMode:
109  * @GST_VAAPI_RENDER_MODE_OVERLAY: in this mode, the VA display
110  *   backend renders surfaces with an overlay engine. This means that
111  *   the surface that is currently displayed shall not be re-used
112  *   right away for decoding. i.e. it needs to be retained further,
113  *   until the next surface is to be displayed.
114  * @GST_VAAPI_RENDER_MODE_TEXTURE: in this modem the VA display
115  *   backend renders surfaces with a textured blit (GPU/3D engine).
116  *   This means that the surface is copied to some intermediate
117  *   backing store, or back buffer of a frame buffer, and is free to
118  *   be re-used right away for decoding.
119  */
120 typedef enum {
121     GST_VAAPI_RENDER_MODE_OVERLAY = 1,
122     GST_VAAPI_RENDER_MODE_TEXTURE
123 } GstVaapiRenderMode;
124 
125 /**
126  * GstVaapiRotation:
127  * @GST_VAAPI_ROTATION_0: the VA display is not rotated.
128  * @GST_VAAPI_ROTATION_90: the VA display is rotated by 90°, clockwise.
129  * @GST_VAAPI_ROTATION_180: the VA display is rotated by 180°, clockwise.
130  * @GST_VAAPI_ROTATION_270: the VA display is rotated by 270°, clockwise.
131  * @GST_VAAPI_ROTATION_AUTOMATIC: the VA display is rotated by image-orientating tag.
132  */
133 typedef enum {
134     GST_VAAPI_ROTATION_0   = 0,
135     GST_VAAPI_ROTATION_90  = 90,
136     GST_VAAPI_ROTATION_180 = 180,
137     GST_VAAPI_ROTATION_270 = 270,
138     GST_VAAPI_ROTATION_AUTOMATIC = 360,
139 } GstVaapiRotation;
140 
141 /**
142  * GstVaapiRateControl:
143  * @GST_VAAPI_RATECONTROL_NONE: No rate control performed by the
144  *   underlying driver
145  * @GST_VAAPI_RATECONTROL_CQP: Constant QP
146  * @GST_VAAPI_RATECONTROL_CBR: Constant bitrate
147  * @GST_VAAPI_RATECONTROL_VCM: Video conference mode
148  * @GST_VAAPI_RATECONTROL_VBR: Variable bitrate
149  * @GST_VAAPI_RATECONTROL_VBR_CONSTRAINED: Variable bitrate with peak
150  *   rate higher than average bitrate
151  * @GST_VAAPI_RATECONTROL_MB: Macroblock based rate control
152  *
153  * The set of allowed rate control values for #GstVaapiRateControl.
154  * Note: this is only valid for encoders.
155  */
156 typedef enum {
157     GST_VAAPI_RATECONTROL_NONE = 0,
158     GST_VAAPI_RATECONTROL_CQP,
159     GST_VAAPI_RATECONTROL_CBR,
160     GST_VAAPI_RATECONTROL_VCM,
161     GST_VAAPI_RATECONTROL_VBR,
162     GST_VAAPI_RATECONTROL_VBR_CONSTRAINED,
163     GST_VAAPI_RATECONTROL_MB,
164 } GstVaapiRateControl;
165 
166 /* Define a mask for GstVaapiRateControl */
167 #define GST_VAAPI_RATECONTROL_MASK(RC) \
168     (1 << G_PASTE(GST_VAAPI_RATECONTROL_,RC))
169 
170 G_END_DECLS
171 
172 #endif /* GST_VAAPI_TYPES_H */
173