2 * gstvaapisurface.h - VA surface abstraction
4 * Copyright (C) 2010-2011 Splitted-Desktop Systems
5 * Copyright (C) 2011 Intel Corporation
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 2.1
10 * of the License, or (at your option) any later version.
12 * This library 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 GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301 USA
23 #ifndef GST_VAAPI_SURFACE_H
24 #define GST_VAAPI_SURFACE_H
26 #include <gst/vaapi/gstvaapiobject.h>
27 #include <gst/vaapi/gstvaapidisplay.h>
28 #include <gst/vaapi/gstvaapiimage.h>
29 #include <gst/vaapi/gstvaapisubpicture.h>
30 #include <gst/video/gstsurfacebuffer.h>
31 #include <gst/video/video-overlay-composition.h>
36 * GST_VAAPI_SURFACE_CAPS_NAME:
38 * Generic caps type for VA surfaces.
40 #define GST_VAAPI_SURFACE_CAPS_NAME GST_VIDEO_CAPS_SURFACE
43 * GST_VAAPI_SURFACE_CAPS:
45 * Generic caps for VA surfaces.
47 #define GST_VAAPI_SURFACE_CAPS \
48 GST_VAAPI_SURFACE_CAPS_NAME ", " \
50 "opengl = (boolean) { true, false }, " \
51 "width = (int) [ 1, MAX ], " \
52 "height = (int) [ 1, MAX ], " \
53 "framerate = (fraction) [ 0, MAX ]"
57 * @GST_VAAPI_CHROMA_TYPE_YUV420: 4:2:0 chroma format
58 * @GST_VAAPI_CHROMA_TYPE_YUV422: 4:2:2 chroma format
59 * @GST_VAAPI_CHROMA_TYPE_YUV444: 4:4:4 chroma format
61 * The set of all chroma types for #GstVaapiSurface.
64 GST_VAAPI_CHROMA_TYPE_YUV420 = 1,
65 GST_VAAPI_CHROMA_TYPE_YUV422,
66 GST_VAAPI_CHROMA_TYPE_YUV444
70 * GstVaapiSurfaceStatus:
71 * @GST_VAAPI_SURFACE_STATUS_IDLE:
72 * the surface is not being rendered or displayed
73 * @GST_VAAPI_SURFACE_STATUS_RENDERING:
74 * the surface is used for rendering (decoding to the surface in progress)
75 * @GST_VAAPI_SURFACE_STATUS_DISPLAYING:
76 * the surface is being displayed to screen
77 * @GST_VAAPI_SURFACE_STATUS_SKIPPED:
78 * indicates a skipped frame during encode
80 * The set of all surface status for #GstVaapiSurface.
83 GST_VAAPI_SURFACE_STATUS_IDLE = 1 << 0,
84 GST_VAAPI_SURFACE_STATUS_RENDERING = 1 << 1,
85 GST_VAAPI_SURFACE_STATUS_DISPLAYING = 1 << 2,
86 GST_VAAPI_SURFACE_STATUS_SKIPPED = 1 << 3
87 } GstVaapiSurfaceStatus;
90 * GstVaapiSurfaceRenderFlags
91 * @GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD:
92 * selects the top field of the surface
93 * @GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD:
94 * selects the bottom field of the surface
95 * @GST_VAAPI_PICTURE_STRUCTURE_FRAME:
96 * selects the entire surface
97 * @GST_VAAPI_COLOR_STANDARD_ITUR_BT_601:
98 * uses ITU-R BT.601 standard for color space conversion
99 * @GST_VAAPI_COLOR_STANDARD_ITUR_BT_709:
100 * uses ITU-R BT.709 standard for color space conversion
102 * The set of all render flags for gst_vaapi_window_put_surface().
105 GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD = 1 << 0,
106 GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD = 1 << 1,
107 GST_VAAPI_PICTURE_STRUCTURE_FRAME =
109 GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD |
110 GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD
112 GST_VAAPI_COLOR_STANDARD_ITUR_BT_601 = 1 << 2,
113 GST_VAAPI_COLOR_STANDARD_ITUR_BT_709 = 1 << 3,
114 } GstVaapiSurfaceRenderFlags;
116 #define GST_VAAPI_TYPE_SURFACE \
117 (gst_vaapi_surface_get_type())
119 #define GST_VAAPI_SURFACE(obj) \
120 (G_TYPE_CHECK_INSTANCE_CAST((obj), \
121 GST_VAAPI_TYPE_SURFACE, \
124 #define GST_VAAPI_SURFACE_CLASS(klass) \
125 (G_TYPE_CHECK_CLASS_CAST((klass), \
126 GST_VAAPI_TYPE_SURFACE, \
127 GstVaapiSurfaceClass))
129 #define GST_VAAPI_IS_SURFACE(obj) \
130 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_SURFACE))
132 #define GST_VAAPI_IS_SURFACE_CLASS(klass) \
133 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_SURFACE))
135 #define GST_VAAPI_SURFACE_GET_CLASS(obj) \
136 (G_TYPE_INSTANCE_GET_CLASS((obj), \
137 GST_VAAPI_TYPE_SURFACE, \
138 GstVaapiSurfaceClass))
140 typedef struct _GstVaapiSurface GstVaapiSurface;
141 typedef struct _GstVaapiSurfacePrivate GstVaapiSurfacePrivate;
142 typedef struct _GstVaapiSurfaceClass GstVaapiSurfaceClass;
147 * A VA surface wrapper.
149 struct _GstVaapiSurface {
151 GstVaapiObject parent_instance;
153 GstVaapiSurfacePrivate *priv;
157 * GstVaapiSurfaceClass:
159 * A VA surface wrapper class.
161 struct _GstVaapiSurfaceClass {
163 GstVaapiObjectClass parent_class;
167 gst_vaapi_surface_get_type(void) G_GNUC_CONST;
170 gst_vaapi_surface_new(
171 GstVaapiDisplay *display,
172 GstVaapiChromaType chroma_type,
178 gst_vaapi_surface_get_id(GstVaapiSurface *surface);
181 gst_vaapi_surface_get_chroma_type(GstVaapiSurface *surface);
184 gst_vaapi_surface_get_width(GstVaapiSurface *surface);
187 gst_vaapi_surface_get_height(GstVaapiSurface *surface);
190 gst_vaapi_surface_get_size(
191 GstVaapiSurface *surface,
197 gst_vaapi_surface_derive_image(GstVaapiSurface *surface);
200 gst_vaapi_surface_get_image(GstVaapiSurface *surface, GstVaapiImage *image);
203 gst_vaapi_surface_put_image(GstVaapiSurface *surface, GstVaapiImage *image);
206 gst_vaapi_surface_associate_subpicture(
207 GstVaapiSurface *surface,
208 GstVaapiSubpicture *subpicture,
209 const GstVaapiRectangle *src_rect,
210 const GstVaapiRectangle *dst_rect
214 gst_vaapi_surface_deassociate_subpicture(
215 GstVaapiSurface *surface,
216 GstVaapiSubpicture *subpicture
220 gst_vaapi_surface_sync(GstVaapiSurface *surface);
223 gst_vaapi_surface_query_status(
224 GstVaapiSurface *surface,
225 GstVaapiSurfaceStatus *pstatus
229 gst_vaapi_surface_set_subpictures_from_composition(
230 GstVaapiSurface *surface,
231 GstVideoOverlayComposition *composition,
232 gboolean propagate_context
237 #endif /* GST_VAAPI_SURFACE_H */