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