2 * gstvaapisurface.h - VA surface abstraction
4 * gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
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.
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.
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
21 #ifndef GST_VAAPI_SURFACE_H
22 #define GST_VAAPI_SURFACE_H
24 #include <gst/vaapi/gstvaapiobject.h>
25 #include <gst/vaapi/gstvaapidisplay.h>
26 #include <gst/vaapi/gstvaapiimage.h>
27 #include <gst/vaapi/gstvaapisubpicture.h>
31 typedef enum _GstVaapiChromaType GstVaapiChromaType;
32 typedef enum _GstVaapiSurfaceRenderFlags GstVaapiSurfaceRenderFlags;
36 * @GST_VAAPI_CHROMA_TYPE_YUV420: 4:2:0 chroma format
37 * @GST_VAAPI_CHROMA_TYPE_YUV422: 4:2:2 chroma format
38 * @GST_VAAPI_CHROMA_TYPE_YUV444: 4:4:4 chroma format
40 * The set of all chroma types for #GstVaapiSurface.
42 enum _GstVaapiChromaType {
43 GST_VAAPI_CHROMA_TYPE_YUV420 = 1,
44 GST_VAAPI_CHROMA_TYPE_YUV422,
45 GST_VAAPI_CHROMA_TYPE_YUV444
49 * GstVaapiSurfaceRenderFlags
50 * @GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD:
51 * selects the top field of the surface
52 * @GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD:
53 * selects the bottom field of the surface
54 * @GST_VAAPI_PICTURE_STRUCTURE_FRAME:
55 * selects the entire surface
56 * @GST_VAAPI_COLOR_STANDARD_ITUR_BT_601:
57 * uses ITU-R BT.601 standard for color space conversion
58 * @GST_VAAPI_COLOR_STANDARD_ITUR_BT_709:
59 * uses ITU-R BT.709 standard for color space conversion
61 * The set of all render flags for gst_vaapi_window_put_surface().
63 enum _GstVaapiSurfaceRenderFlags {
64 GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD = 1 << 0,
65 GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD = 1 << 1,
66 GST_VAAPI_PICTURE_STRUCTURE_FRAME =
68 GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD |
69 GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD
71 GST_VAAPI_COLOR_STANDARD_ITUR_BT_601 = 1 << 2,
72 GST_VAAPI_COLOR_STANDARD_ITUR_BT_709 = 1 << 3,
75 #define GST_VAAPI_TYPE_SURFACE \
76 (gst_vaapi_surface_get_type())
78 #define GST_VAAPI_SURFACE(obj) \
79 (G_TYPE_CHECK_INSTANCE_CAST((obj), \
80 GST_VAAPI_TYPE_SURFACE, \
83 #define GST_VAAPI_SURFACE_CLASS(klass) \
84 (G_TYPE_CHECK_CLASS_CAST((klass), \
85 GST_VAAPI_TYPE_SURFACE, \
86 GstVaapiSurfaceClass))
88 #define GST_VAAPI_IS_SURFACE(obj) \
89 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_SURFACE))
91 #define GST_VAAPI_IS_SURFACE_CLASS(klass) \
92 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_SURFACE))
94 #define GST_VAAPI_SURFACE_GET_CLASS(obj) \
95 (G_TYPE_INSTANCE_GET_CLASS((obj), \
96 GST_VAAPI_TYPE_SURFACE, \
97 GstVaapiSurfaceClass))
99 typedef struct _GstVaapiSurface GstVaapiSurface;
100 typedef struct _GstVaapiSurfacePrivate GstVaapiSurfacePrivate;
101 typedef struct _GstVaapiSurfaceClass GstVaapiSurfaceClass;
106 * A VA surface wrapper.
108 struct _GstVaapiSurface {
110 GstVaapiObject parent_instance;
112 GstVaapiSurfacePrivate *priv;
116 * GstVaapiSurfaceClass:
118 * A VA surface wrapper class.
120 struct _GstVaapiSurfaceClass {
122 GstVaapiObjectClass parent_class;
126 gst_vaapi_surface_get_type(void);
129 gst_vaapi_surface_new(
130 GstVaapiDisplay *display,
131 GstVaapiChromaType chroma_type,
137 gst_vaapi_surface_get_chroma_type(GstVaapiSurface *surface);
140 gst_vaapi_surface_get_width(GstVaapiSurface *surface);
143 gst_vaapi_surface_get_height(GstVaapiSurface *surface);
146 gst_vaapi_surface_get_size(
147 GstVaapiSurface *surface,
153 gst_vaapi_surface_derive_image(GstVaapiSurface *surface);
156 gst_vaapi_surface_get_image(GstVaapiSurface *surface, GstVaapiImage *image);
159 gst_vaapi_surface_put_image(GstVaapiSurface *surface, GstVaapiImage *image);
162 gst_vaapi_surface_associate_subpicture(
163 GstVaapiSurface *surface,
164 GstVaapiSubpicture *subpicture,
165 const GstVaapiRectangle *src_rect,
166 const GstVaapiRectangle *dst_rect
170 gst_vaapi_surface_deassociate_subpicture(
171 GstVaapiSurface *surface,
172 GstVaapiSubpicture *subpicture
176 gst_vaapi_surface_sync(GstVaapiSurface *surface);
180 #endif /* GST_VAAPI_SURFACE_H */