2 * gstvaapidisplay.h - VA display abstraction
4 * Copyright (C) 2010-2011 Splitted-Desktop Systems
5 * Copyright (C) 2011-2012 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_DISPLAY_H
24 #define GST_VAAPI_DISPLAY_H
28 #include <gst/vaapi/gstvaapitypes.h>
29 #include <gst/vaapi/gstvaapiimageformat.h>
30 #include <gst/vaapi/gstvaapiprofile.h>
34 #define GST_VAAPI_TYPE_DISPLAY \
35 (gst_vaapi_display_get_type())
37 #define GST_VAAPI_DISPLAY(obj) \
38 (G_TYPE_CHECK_INSTANCE_CAST((obj), \
39 GST_VAAPI_TYPE_DISPLAY, \
42 #define GST_VAAPI_DISPLAY_CLASS(klass) \
43 (G_TYPE_CHECK_CLASS_CAST((klass), \
44 GST_VAAPI_TYPE_DISPLAY, \
45 GstVaapiDisplayClass))
47 #define GST_VAAPI_IS_DISPLAY(obj) \
48 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_DISPLAY))
50 #define GST_VAAPI_IS_DISPLAY_CLASS(klass) \
51 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_DISPLAY))
53 #define GST_VAAPI_DISPLAY_GET_CLASS(obj) \
54 (G_TYPE_INSTANCE_GET_CLASS((obj), \
55 GST_VAAPI_TYPE_DISPLAY, \
56 GstVaapiDisplayClass))
58 typedef enum _GstVaapiDisplayType GstVaapiDisplayType;
59 typedef struct _GstVaapiDisplayInfo GstVaapiDisplayInfo;
60 typedef struct _GstVaapiDisplay GstVaapiDisplay;
61 typedef struct _GstVaapiDisplayPrivate GstVaapiDisplayPrivate;
62 typedef struct _GstVaapiDisplayClass GstVaapiDisplayClass;
65 * GstVaapiDisplayType:
66 * @GST_VAAPI_DISPLAY_TYPE_ANY: Automatic detection of the display type.
67 * @GST_VAAPI_DISPLAY_TYPE_X11: VA/X11 display.
68 * @GST_VAAPI_DISPLAY_TYPE_GLX: VA/GLX display.
69 * @GST_VAAPI_DISPLAY_TYPE_WAYLAND: VA/Wayland display.
70 * @GST_VAAPI_DISPLAY_TYPE_DRM: VA/DRM display.
72 enum _GstVaapiDisplayType {
73 GST_VAAPI_DISPLAY_TYPE_ANY = 0,
74 GST_VAAPI_DISPLAY_TYPE_X11,
75 GST_VAAPI_DISPLAY_TYPE_GLX,
76 GST_VAAPI_DISPLAY_TYPE_WAYLAND,
77 GST_VAAPI_DISPLAY_TYPE_DRM,
80 #define GST_VAAPI_TYPE_DISPLAY_TYPE \
81 (gst_vaapi_display_type_get_type())
84 gst_vaapi_display_type_get_type(void) G_GNUC_CONST;
87 * GstVaapiDisplayInfo:
89 * Generic class to retrieve VA display info
91 struct _GstVaapiDisplayInfo {
92 GstVaapiDisplay *display;
93 GstVaapiDisplayType display_type;
96 gpointer native_display;
100 * GstVaapiDisplayProperties:
101 * @GST_VAAPI_DISPLAY_PROP_RENDER_MODE: rendering mode (#GstVaapiRenderMode).
102 * @GST_VAAPI_DISPLAY_PROP_ROTATION: rotation angle (#GstVaapiRotation).
103 * @GST_VAAPI_DISPLAY_PROP_HUE: hue (float: [-180 ; 180], default: 0).
104 * @GST_VAAPI_DISPLAY_PROP_SATURATION: saturation (float: [0 ; 2], default: 1).
105 * @GST_VAAPI_DISPLAY_PROP_BRIGHTNESS: brightness (float: [-1 ; 1], default: 0).
106 * @GST_VAAPI_DISPLAY_PROP_CONTRAST: contrast (float: [0 ; 2], default: 1).
108 #define GST_VAAPI_DISPLAY_PROP_RENDER_MODE "render-mode"
109 #define GST_VAAPI_DISPLAY_PROP_ROTATION "rotation"
110 #define GST_VAAPI_DISPLAY_PROP_HUE "hue"
111 #define GST_VAAPI_DISPLAY_PROP_SATURATION "saturation"
112 #define GST_VAAPI_DISPLAY_PROP_BRIGHTNESS "brightness"
113 #define GST_VAAPI_DISPLAY_PROP_CONTRAST "contrast"
118 * Base class for VA displays.
120 struct _GstVaapiDisplay {
122 GObject parent_instance;
124 GstVaapiDisplayPrivate *priv;
128 * GstVaapiDisplayClass:
129 * @open_display: virtual function to open a display
130 * @close_display: virtual function to close a display
131 * @lock: (optional) virtual function to lock a display
132 * @unlock: (optional) virtual function to unlock a display
133 * @sync: (optional) virtual function to sync a display
134 * @flush: (optional) virtual function to flush pending requests of a display
135 * @get_display: virtual function to retrieve the #GstVaapiDisplayInfo
136 * @get_size: virtual function to retrieve the display dimensions, in pixels
137 * @get_size_mm: virtual function to retrieve the display dimensions, in millimeters
139 * Base class for VA displays.
141 struct _GstVaapiDisplayClass {
143 GObjectClass parent_class;
146 gboolean (*open_display) (GstVaapiDisplay *display);
147 void (*close_display) (GstVaapiDisplay *display);
148 void (*lock) (GstVaapiDisplay *display);
149 void (*unlock) (GstVaapiDisplay *display);
150 void (*sync) (GstVaapiDisplay *display);
151 void (*flush) (GstVaapiDisplay *display);
152 gboolean (*get_display) (GstVaapiDisplay *display,
153 GstVaapiDisplayInfo *info);
154 void (*get_size) (GstVaapiDisplay *display,
155 guint *pwidth, guint *pheight);
156 void (*get_size_mm) (GstVaapiDisplay *display,
157 guint *pwidth, guint *pheight);
161 gst_vaapi_display_get_type(void) G_GNUC_CONST;
164 gst_vaapi_display_new_with_display(VADisplay va_display);
167 gst_vaapi_display_lock(GstVaapiDisplay *display);
170 gst_vaapi_display_unlock(GstVaapiDisplay *display);
173 gst_vaapi_display_sync(GstVaapiDisplay *display);
176 gst_vaapi_display_flush(GstVaapiDisplay *display);
179 gst_vaapi_display_get_display_type(GstVaapiDisplay *display);
182 gst_vaapi_display_get_display(GstVaapiDisplay *display);
185 gst_vaapi_display_get_width(GstVaapiDisplay *display);
188 gst_vaapi_display_get_height(GstVaapiDisplay *display);
191 gst_vaapi_display_get_size(GstVaapiDisplay *display, guint *pwidth, guint *pheight);
194 gst_vaapi_display_get_pixel_aspect_ratio(
195 GstVaapiDisplay *display,
201 gst_vaapi_display_get_decode_caps(GstVaapiDisplay *display);
204 gst_vaapi_display_has_decoder(
205 GstVaapiDisplay *display,
206 GstVaapiProfile profile,
207 GstVaapiEntrypoint entrypoint
211 gst_vaapi_display_get_encode_caps(GstVaapiDisplay *display);
214 gst_vaapi_display_has_encoder(
215 GstVaapiDisplay *display,
216 GstVaapiProfile profile,
217 GstVaapiEntrypoint entrypoint
221 gst_vaapi_display_get_image_caps(GstVaapiDisplay *display);
224 gst_vaapi_display_has_image_format(
225 GstVaapiDisplay *display,
226 GstVaapiImageFormat format
230 gst_vaapi_display_get_subpicture_caps(GstVaapiDisplay *display);
233 gst_vaapi_display_has_subpicture_format(
234 GstVaapiDisplay *display,
235 GstVaapiImageFormat format
239 gst_vaapi_display_has_property(GstVaapiDisplay *display, const gchar *name);
242 gst_vaapi_display_get_render_mode(
243 GstVaapiDisplay *display,
244 GstVaapiRenderMode *pmode
248 gst_vaapi_display_set_render_mode(
249 GstVaapiDisplay *display,
250 GstVaapiRenderMode mode
254 gst_vaapi_display_get_rotation(GstVaapiDisplay *display);
257 gst_vaapi_display_set_rotation(
258 GstVaapiDisplay *display,
259 GstVaapiRotation rotation
264 #endif /* GST_VAAPI_DISPLAY_H */