2 * gstvaapidisplay_x11.c - VA/X11 display 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
22 #include "vaapi_utils.h"
23 #include "gstvaapidisplay_x11.h"
26 #include "vaapi_debug.h"
28 G_DEFINE_TYPE(GstVaapiDisplayX11,
29 gst_vaapi_display_x11,
30 GST_VAAPI_TYPE_DISPLAY);
32 #define GST_VAAPI_DISPLAY_X11_GET_PRIVATE(obj) \
33 (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
34 GST_VAAPI_TYPE_DISPLAY_X11, \
35 GstVaapiDisplayX11Private))
37 struct _GstVaapiDisplayX11Private {
48 gst_vaapi_display_x11_finalize(GObject *object)
50 G_OBJECT_CLASS(gst_vaapi_display_x11_parent_class)->finalize(object);
54 gst_vaapi_display_x11_set_property(GObject *object,
59 GstVaapiDisplayX11 * const display = GST_VAAPI_DISPLAY_X11(object);
62 case PROP_X11_DISPLAY:
63 display->priv->display = g_value_get_pointer(value);
66 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
72 gst_vaapi_display_x11_get_property(GObject *object,
77 GstVaapiDisplayX11 * const display = GST_VAAPI_DISPLAY_X11(object);
80 case PROP_X11_DISPLAY:
81 g_value_set_pointer(value, gst_vaapi_display_x11_get_display(display));
84 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
90 gst_vaapi_display_x11_class_init(GstVaapiDisplayX11Class *klass)
92 GObjectClass * const object_class = G_OBJECT_CLASS(klass);
94 g_type_class_add_private(klass, sizeof(GstVaapiDisplayX11Private));
96 object_class->finalize = gst_vaapi_display_x11_finalize;
97 object_class->set_property = gst_vaapi_display_x11_set_property;
98 object_class->get_property = gst_vaapi_display_x11_get_property;
100 g_object_class_install_property
103 g_param_spec_pointer("x11-display",
106 G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
110 gst_vaapi_display_x11_init(GstVaapiDisplayX11 *display)
112 GstVaapiDisplayX11Private *priv = GST_VAAPI_DISPLAY_X11_GET_PRIVATE(display);
114 display->priv = priv;
115 priv->display = NULL;
119 gst_vaapi_display_x11_get_display(GstVaapiDisplayX11 *display)
121 g_return_val_if_fail(GST_VAAPI_IS_DISPLAY_X11(display), NULL);
123 return display->priv->display;
127 gst_vaapi_display_x11_new(Display *x11_display)
129 g_return_val_if_fail(x11_display, NULL);
131 return g_object_new(GST_VAAPI_TYPE_DISPLAY_X11,
132 "x11-display", x11_display,
133 "display", vaGetDisplay(x11_display),