Move GstVaapiSurfaceRenderFlags to gstvaapisurface.h since this will
[profile/ivi/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapisurface.h
1 /*
2  *  gstvaapisurface.h - VA surface abstraction
3  *
4  *  gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program 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
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
19  */
20
21 #ifndef GST_VAAPI_SURFACE_H
22 #define GST_VAAPI_SURFACE_H
23
24 #include <gst/vaapi/gstvaapiimage.h>
25 #include <gst/vaapi/gstvaapidisplay.h>
26
27 G_BEGIN_DECLS
28
29 typedef enum _GstVaapiChromaType                GstVaapiChromaType;
30 typedef enum _GstVaapiSurfaceRenderFlags        GstVaapiSurfaceRenderFlags;
31
32 /**
33  * GstVaapiChromaType:
34  * @GST_VAAPI_CHROMA_TYPE_YUV420: 4:2:0 chroma format
35  * @GST_VAAPI_CHROMA_TYPE_YUV422: 4:2:2 chroma format
36  * @GST_VAAPI_CHROMA_TYPE_YUV444: 4:4:4 chroma format
37  *
38  * The set of all chroma types for #GstVaapiSurface.
39  */
40 enum _GstVaapiChromaType {
41     GST_VAAPI_CHROMA_TYPE_YUV420 = 1,
42     GST_VAAPI_CHROMA_TYPE_YUV422,
43     GST_VAAPI_CHROMA_TYPE_YUV444
44 };
45
46 /**
47  * GstVaapiSurfaceRenderFlags
48  * @GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD:
49  *   selects the top field of the surface
50  * @GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD:
51  *   selects the bottom field of the surface
52  * @GST_VAAPI_PICTURE_STRUCTURE_FRAME:
53  *   selects the entire surface
54  * @GST_VAAPI_COLOR_STANDARD_ITUR_BT_601:
55  *   uses ITU-R BT.601 standard for color space conversion
56  * @GST_VAAPI_COLOR_STANDARD_ITUR_BT_709:
57  *   uses ITU-R BT.709 standard for color space conversion
58  *
59  * The set of all render flags for gst_vaapi_window_put_surface().
60  */
61 enum _GstVaapiSurfaceRenderFlags {
62     GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD       = 1 << 0,
63     GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD    = 1 << 1,
64     GST_VAAPI_PICTURE_STRUCTURE_FRAME           =
65     (
66         GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD |
67         GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD
68     ),
69     GST_VAAPI_COLOR_STANDARD_ITUR_BT_601        = 1 << 2,
70     GST_VAAPI_COLOR_STANDARD_ITUR_BT_709        = 1 << 3,
71 };
72
73 #define GST_VAAPI_TYPE_SURFACE \
74     (gst_vaapi_surface_get_type())
75
76 #define GST_VAAPI_SURFACE(obj)                          \
77     (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
78                                 GST_VAAPI_TYPE_SURFACE, \
79                                 GstVaapiSurface))
80
81 #define GST_VAAPI_SURFACE_CLASS(klass)                  \
82     (G_TYPE_CHECK_CLASS_CAST((klass),                   \
83                              GST_VAAPI_TYPE_SURFACE,    \
84                              GstVaapiSurfaceClass))
85
86 #define GST_VAAPI_IS_SURFACE(obj) \
87     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_SURFACE))
88
89 #define GST_VAAPI_IS_SURFACE_CLASS(klass) \
90     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_SURFACE))
91
92 #define GST_VAAPI_SURFACE_GET_CLASS(obj)                \
93     (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
94                                GST_VAAPI_TYPE_SURFACE,  \
95                                GstVaapiSurfaceClass))
96
97 typedef struct _GstVaapiSurface                 GstVaapiSurface;
98 typedef struct _GstVaapiSurfacePrivate          GstVaapiSurfacePrivate;
99 typedef struct _GstVaapiSurfaceClass            GstVaapiSurfaceClass;
100
101 /**
102  * GstVaapiSurface:
103  *
104  * A VA surface wrapper.
105  */
106 struct _GstVaapiSurface {
107     /*< private >*/
108     GObject parent_instance;
109
110     /*< private >*/
111     GstVaapiSurfacePrivate *priv;
112 };
113
114 /**
115  * GstVaapiSurfaceClass:
116  *
117  * A VA surface wrapper class.
118  */
119 struct _GstVaapiSurfaceClass {
120     /*< private >*/
121     GObjectClass parent_class;
122 };
123
124 GType
125 gst_vaapi_surface_get_type(void);
126
127 GstVaapiSurface *
128 gst_vaapi_surface_new(
129     GstVaapiDisplay    *display,
130     GstVaapiChromaType  chroma_type,
131     guint               width,
132     guint               height
133 );
134
135 VASurfaceID
136 gst_vaapi_surface_get_id(GstVaapiSurface *surface);
137
138 GstVaapiDisplay *
139 gst_vaapi_surface_get_display(GstVaapiSurface *surface);
140
141 GstVaapiChromaType
142 gst_vaapi_surface_get_chroma_type(GstVaapiSurface *surface);
143
144 guint
145 gst_vaapi_surface_get_width(GstVaapiSurface *surface);
146
147 guint
148 gst_vaapi_surface_get_height(GstVaapiSurface *surface);
149
150 void
151 gst_vaapi_surface_get_size(
152     GstVaapiSurface *surface,
153     guint           *pwidth,
154     guint           *pheight
155 );
156
157 GstVaapiImage *
158 gst_vaapi_surface_derive_image(GstVaapiSurface *surface);
159
160 gboolean
161 gst_vaapi_surface_get_image(GstVaapiSurface *surface, GstVaapiImage *image);
162
163 gboolean
164 gst_vaapi_surface_put_image(GstVaapiSurface *surface, GstVaapiImage *image);
165
166 gboolean
167 gst_vaapi_surface_sync(GstVaapiSurface *surface);
168
169 G_END_DECLS
170
171 #endif /* GST_VAAPI_SURFACE_H */