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>
35 typedef enum _GstVaapiChromaType GstVaapiChromaType;
36 typedef enum _GstVaapiSurfaceStatus GstVaapiSurfaceStatus;
37 typedef enum _GstVaapiSurfaceRenderFlags GstVaapiSurfaceRenderFlags;
40 * GST_VAAPI_SURFACE_CAPS_NAME:
42 * Generic caps type for VA surfaces.
44 #define GST_VAAPI_SURFACE_CAPS_NAME GST_VIDEO_CAPS_SURFACE
47 * GST_VAAPI_SURFACE_CAPS:
49 * Generic caps for VA surfaces.
51 #define GST_VAAPI_SURFACE_CAPS \
52 GST_VAAPI_SURFACE_CAPS_NAME ", " \
54 "opengl = (boolean) { true, false }, " \
55 "width = (int) [ 1, MAX ], " \
56 "height = (int) [ 1, MAX ], " \
57 "framerate = (fraction) [ 0, MAX ]"
59 #define GST_VAAPI_BUFFER_SHARING_CAPS_NAME "video/x-vaapi-sharing"
61 #define GST_VAAPI_BUFFER_SHARING_CAPS \
62 GST_VAAPI_BUFFER_SHARING_CAPS_NAME ", " \
64 "width = (int) [ 1, MAX ], " \
65 "height = (int) [ 1, MAX ], " \
66 "framerate = (fraction) [ 0, MAX ]"
70 * @GST_VAAPI_CHROMA_TYPE_YUV420: 4:2:0 chroma format
71 * @GST_VAAPI_CHROMA_TYPE_YUV422: 4:2:2 chroma format
72 * @GST_VAAPI_CHROMA_TYPE_YUV444: 4:4:4 chroma format
74 * The set of all chroma types for #GstVaapiSurface.
76 enum _GstVaapiChromaType {
77 GST_VAAPI_CHROMA_TYPE_YUV420 = 1,
78 GST_VAAPI_CHROMA_TYPE_YUV422,
79 GST_VAAPI_CHROMA_TYPE_YUV444
83 * GstVaapiSurfaceStatus:
84 * @GST_VAAPI_SURFACE_STATUS_IDLE:
85 * the surface is not being rendered or displayed
86 * @GST_VAAPI_SURFACE_STATUS_RENDERING:
87 * the surface is used for rendering (decoding to the surface in progress)
88 * @GST_VAAPI_SURFACE_STATUS_DISPLAYING:
89 * the surface is being displayed to screen
90 * @GST_VAAPI_SURFACE_STATUS_SKIPPED:
91 * indicates a skipped frame during encode
93 * The set of all surface status for #GstVaapiSurface.
95 enum _GstVaapiSurfaceStatus {
96 GST_VAAPI_SURFACE_STATUS_IDLE = 1 << 0,
97 GST_VAAPI_SURFACE_STATUS_RENDERING = 1 << 1,
98 GST_VAAPI_SURFACE_STATUS_DISPLAYING = 1 << 2,
99 GST_VAAPI_SURFACE_STATUS_SKIPPED = 1 << 3
103 * GstVaapiSurfaceRenderFlags
104 * @GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD:
105 * selects the top field of the surface
106 * @GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD:
107 * selects the bottom field of the surface
108 * @GST_VAAPI_PICTURE_STRUCTURE_FRAME:
109 * selects the entire surface
110 * @GST_VAAPI_COLOR_STANDARD_ITUR_BT_601:
111 * uses ITU-R BT.601 standard for color space conversion
112 * @GST_VAAPI_COLOR_STANDARD_ITUR_BT_709:
113 * uses ITU-R BT.709 standard for color space conversion
115 * The set of all render flags for gst_vaapi_window_put_surface().
117 enum _GstVaapiSurfaceRenderFlags {
118 GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD = 1 << 0,
119 GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD = 1 << 1,
120 GST_VAAPI_PICTURE_STRUCTURE_FRAME =
122 GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD |
123 GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD
125 GST_VAAPI_COLOR_STANDARD_ITUR_BT_601 = 1 << 2,
126 GST_VAAPI_COLOR_STANDARD_ITUR_BT_709 = 1 << 3,
129 #define GST_VAAPI_TYPE_SURFACE \
130 (gst_vaapi_surface_get_type())
132 #define GST_VAAPI_SURFACE(obj) \
133 (G_TYPE_CHECK_INSTANCE_CAST((obj), \
134 GST_VAAPI_TYPE_SURFACE, \
137 #define GST_VAAPI_SURFACE_CLASS(klass) \
138 (G_TYPE_CHECK_CLASS_CAST((klass), \
139 GST_VAAPI_TYPE_SURFACE, \
140 GstVaapiSurfaceClass))
142 #define GST_VAAPI_IS_SURFACE(obj) \
143 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_SURFACE))
145 #define GST_VAAPI_IS_SURFACE_CLASS(klass) \
146 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_SURFACE))
148 #define GST_VAAPI_SURFACE_GET_CLASS(obj) \
149 (G_TYPE_INSTANCE_GET_CLASS((obj), \
150 GST_VAAPI_TYPE_SURFACE, \
151 GstVaapiSurfaceClass))
153 typedef struct _GstVaapiSurface GstVaapiSurface;
154 typedef struct _GstVaapiSurfacePrivate GstVaapiSurfacePrivate;
155 typedef struct _GstVaapiSurfaceClass GstVaapiSurfaceClass;
160 * A VA surface wrapper.
162 struct _GstVaapiSurface {
164 GstVaapiObject parent_instance;
166 GstVaapiSurfacePrivate *priv;
170 * GstVaapiSurfaceClass:
172 * A VA surface wrapper class.
174 struct _GstVaapiSurfaceClass {
176 GstVaapiObjectClass parent_class;
178 gboolean (*create)(GstVaapiSurface *surface);
182 gst_vaapi_surface_get_type(void) G_GNUC_CONST;
185 gst_vaapi_surface_new(
186 GstVaapiDisplay *display,
187 GstVaapiChromaType chroma_type,
193 gst_vaapi_surface_get_id(GstVaapiSurface *surface);
196 gst_vaapi_surface_get_chroma_type(GstVaapiSurface *surface);
199 gst_vaapi_surface_get_width(GstVaapiSurface *surface);
202 gst_vaapi_surface_get_height(GstVaapiSurface *surface);
205 gst_vaapi_surface_get_size(
206 GstVaapiSurface *surface,
212 gst_vaapi_surface_derive_image(GstVaapiSurface *surface);
215 gst_vaapi_surface_get_image(GstVaapiSurface *surface, GstVaapiImage *image);
218 gst_vaapi_surface_put_image(GstVaapiSurface *surface, GstVaapiImage *image);
221 gst_vaapi_surface_associate_subpicture(
222 GstVaapiSurface *surface,
223 GstVaapiSubpicture *subpicture,
224 const GstVaapiRectangle *src_rect,
225 const GstVaapiRectangle *dst_rect
229 gst_vaapi_surface_deassociate_subpicture(
230 GstVaapiSurface *surface,
231 GstVaapiSubpicture *subpicture
235 gst_vaapi_surface_sync(GstVaapiSurface *surface);
238 gst_vaapi_surface_query_status(
239 GstVaapiSurface *surface,
240 GstVaapiSurfaceStatus *pstatus
244 gst_vaapi_surface_set_subpictures_from_composition(
245 GstVaapiSurface *surface,
246 GstVideoOverlayComposition *composition,
247 gboolean propagate_context
252 #endif /* GST_VAAPI_SURFACE_H */