2 * gstvaapidisplay_glx.c - VA/GLX 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
24 * SECTION:gstvaapidisplay_glx
25 * @short_description: VA/GLX display abstraction
29 #include "gstvaapicompat.h"
30 #include "gstvaapiutils.h"
31 #include "gstvaapiutils_glx.h"
32 #include "gstvaapidisplay_priv.h"
33 #include "gstvaapidisplay_x11_priv.h"
34 #include "gstvaapidisplay_glx.h"
35 #include "gstvaapidisplay_glx_priv.h"
38 #include "gstvaapidebug.h"
40 G_DEFINE_TYPE(GstVaapiDisplayGLX,
41 gst_vaapi_display_glx,
42 GST_VAAPI_TYPE_DISPLAY_X11);
45 gst_vaapi_display_glx_finalize(GObject *object)
47 G_OBJECT_CLASS(gst_vaapi_display_glx_parent_class)->finalize(object);
51 gst_vaapi_display_glx_get_display_info(
52 GstVaapiDisplay *display,
53 GstVaapiDisplayInfo *info
56 GstVaapiDisplayClass * const dpy_class =
57 GST_VAAPI_DISPLAY_CLASS(gst_vaapi_display_glx_parent_class);
59 info->va_display = vaGetDisplayGLX(GST_VAAPI_DISPLAY_XDISPLAY(display));
60 if (!info->va_display)
62 info->display_type = GST_VAAPI_DISPLAY_TYPE_GLX;
63 return dpy_class->get_display(display, info);
67 gst_vaapi_display_glx_class_init(GstVaapiDisplayGLXClass *klass)
69 GObjectClass * const object_class = G_OBJECT_CLASS(klass);
70 GstVaapiDisplayClass * const dpy_class = GST_VAAPI_DISPLAY_CLASS(klass);
72 object_class->finalize = gst_vaapi_display_glx_finalize;
73 dpy_class->get_display = gst_vaapi_display_glx_get_display_info;
77 gst_vaapi_display_glx_init(GstVaapiDisplayGLX *display)
82 * gst_vaapi_display_glx_new:
83 * @display_name: the X11 display name
85 * Opens an X11 #Display using @display_name and returns a newly
86 * allocated #GstVaapiDisplay object. The X11 display will be cloed
87 * when the reference count of the object reaches zero.
89 * Return value: a newly allocated #GstVaapiDisplay object
92 gst_vaapi_display_glx_new(const gchar *display_name)
94 return g_object_new(GST_VAAPI_TYPE_DISPLAY_GLX,
95 "display-name", display_name,
100 * gst_vaapi_display_glx_new_with_display:
101 * @x11_display: an X11 #Display
103 * Creates a #GstVaapiDisplay based on the X11 @x11_display
104 * display. The caller still owns the display and must call
105 * XCloseDisplay() when all #GstVaapiDisplay references are
106 * released. Doing so too early can yield undefined behaviour.
108 * Return value: a newly allocated #GstVaapiDisplay object
111 gst_vaapi_display_glx_new_with_display(Display *x11_display)
113 return g_object_new(GST_VAAPI_TYPE_DISPLAY_GLX,
114 "x11-display", x11_display,