<TITLE>GstVaapiDisplayX11</TITLE>
GstVaapiDisplayX11
GstVaapiDisplayX11Class
-GST_VAAPI_DISPLAY_XDISPLAY
gst_vaapi_display_x11_new
gst_vaapi_display_x11_new_with_display
gst_vaapi_display_x11_get_display
+gst_vaapi_display_x11_get_screen
<SUBSECTION Standard>
GST_VAAPI_DISPLAY_X11
GST_VAAPI_IS_DISPLAY_X11
libgstvaapi_x11_source_priv_h = \
gstvaapicompat.h \
+ gstvaapidisplay_x11_priv.h \
gstvaapiutils.h \
gstvaapiutils_x11.h \
$(NULL)
libgstvaapi_glx_source_priv_h = \
gstvaapicompat.h \
+ gstvaapidisplay_glx_priv.h \
gstvaapiutils.h \
gstvaapiutils_glx.h \
gstvaapiutils_x11.h \
#include "config.h"
#include "gstvaapicompat.h"
#include "gstvaapiutils.h"
-#include "gstvaapidisplay_glx.h"
+#include "gstvaapiutils_glx.h"
#include "gstvaapidisplay_priv.h"
+#include "gstvaapidisplay_x11_priv.h"
+#include "gstvaapidisplay_glx.h"
+#include "gstvaapidisplay_glx_priv.h"
#define DEBUG 1
#include "gstvaapidebug.h"
--- /dev/null
+/*
+ * gstvaapidisplay_glx_priv.h - Internal VA/GLX interface
+ *
+ * gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef GST_VAAPI_DISPLAY_GLX_PRIV_H
+#define GST_VAAPI_DISPLAY_GLX_PRIV_H
+
+#include <gst/vaapi/gstvaapiutils_glx.h>
+#include <gst/vaapi/gstvaapidisplay_glx.h>
+
+G_BEGIN_DECLS
+
+#define GST_VAAPI_DISPLAY_GLX_CAST(display) ((GstVaapiDisplayGLX *)(display))
+
+G_END_DECLS
+
+#endif /* GST_VAAPI_DISPLAY_GLX_PRIV_H */
* Macro that evaluates to the #VADisplay of @display.
* This is an internal macro that does not do any run-time type check.
*/
+#undef GST_VAAPI_DISPLAY_VADISPLAY
#define GST_VAAPI_DISPLAY_VADISPLAY(display_) \
GST_VAAPI_DISPLAY_CAST(display_)->priv->display
*
* Locks @display
*/
+#undef GST_VAAPI_DISPLAY_LOCK
#define GST_VAAPI_DISPLAY_LOCK(display) \
- gst_vaapi_display_lock(display)
+ gst_vaapi_display_lock(GST_VAAPI_DISPLAY_CAST(display))
/**
* GST_VAAPI_DISPLAY_UNLOCK:
*
* Unlocks @display
*/
+#undef GST_VAAPI_DISPLAY_UNLOCK
#define GST_VAAPI_DISPLAY_UNLOCK(display) \
- gst_vaapi_display_unlock(display)
+ gst_vaapi_display_unlock(GST_VAAPI_DISPLAY_CAST(display))
/**
* GstVaapiDisplayPrivate:
#include "config.h"
#include "gstvaapiutils.h"
-#include "gstvaapidisplay_x11.h"
#include "gstvaapidisplay_priv.h"
+#include "gstvaapidisplay_x11.h"
+#include "gstvaapidisplay_x11_priv.h"
#define DEBUG 1
#include "gstvaapidebug.h"
gst_vaapi_display_x11,
GST_VAAPI_TYPE_DISPLAY);
-#define GST_VAAPI_DISPLAY_X11_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
- GST_VAAPI_TYPE_DISPLAY_X11, \
- GstVaapiDisplayX11Private))
-
-struct _GstVaapiDisplayX11Private {
- gchar *display_name;
- Display *x11_display;
- int x11_screen;
- guint create_display : 1;
- guint synchronous : 1;
-};
-
enum {
PROP_0,
PROP_SYNCHRONOUS,
PROP_DISPLAY_NAME,
- PROP_X11_DISPLAY
+ PROP_X11_DISPLAY,
+ PROP_X11_SCREEN
};
static void
case PROP_X11_DISPLAY:
display->priv->x11_display = g_value_get_pointer(value);
break;
+ case PROP_X11_SCREEN:
+ display->priv->x11_screen = g_value_get_int(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
case PROP_X11_DISPLAY:
g_value_set_pointer(value, gst_vaapi_display_x11_get_display(display));
break;
+ case PROP_X11_SCREEN:
+ g_value_set_int(value, gst_vaapi_display_x11_get_screen(display));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
GST_VAAPI_DISPLAY_X11(display)->priv;
/* XXX: maintain an X11 display cache */
- if (!priv->x11_display && priv->create_display)
+ if (priv->create_display) {
priv->x11_display = XOpenDisplay(priv->display_name);
+ if (!priv->x11_display)
+ return FALSE;
+ priv->x11_screen = DefaultScreen(priv->x11_display);
+ }
if (!priv->x11_display)
return FALSE;
if (priv->synchronous)
XSynchronize(priv->x11_display, True);
-
- priv->x11_screen = DefaultScreen(priv->x11_display);
return TRUE;
}
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
/**
+ * GstVaapiDisplayX11:x11-screen:
+ *
+ * The X11 screen that was created by gst_vaapi_display_x11_new()
+ * or that was bound from gst_vaapi_display_x11_new_with_display().
+ */
+ g_object_class_install_property
+ (object_class,
+ PROP_X11_SCREEN,
+ g_param_spec_int("x11-screen",
+ "X11 screen",
+ "X11 screen",
+ 0, G_MAXINT32, 0,
+ G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
+
+ /**
* GstVaapiDisplayX11:display-name:
*
* The X11 display name.
GstVaapiDisplay *
gst_vaapi_display_x11_new_with_display(Display *x11_display)
{
+ g_return_val_if_fail(x11_display, NULL);
+
return g_object_new(GST_VAAPI_TYPE_DISPLAY_X11,
"x11-display", x11_display,
+ "x11-screen", DefaultScreen(x11_display),
NULL);
}
return display->priv->x11_display;
}
+
+/**
+ * gst_vaapi_display_x11_get_screen:
+ * @display: a #GstVaapiDisplayX11
+ *
+ * Returns the default X11 screen that was created by
+ * gst_vaapi_display_x11_new() or that was bound from
+ * gst_vaapi_display_x11_new_with_display().
+ *
+ * Return value: the X11 #Display attached to @display
+ */
+int
+gst_vaapi_display_x11_get_screen(GstVaapiDisplayX11 *display)
+{
+ g_return_val_if_fail(GST_VAAPI_IS_DISPLAY_X11(display), -1);
+
+ return display->priv->x11_screen;
+}
GST_VAAPI_TYPE_DISPLAY_X11, \
GstVaapiDisplayX11Class))
-/**
- * GST_VAAPI_DISPLAY_XDISPLAY:
- * @display: a #GstVaapiDisplay
- *
- * Macro that evaluates to the underlying X11 #Display of @display
- */
-#define GST_VAAPI_DISPLAY_XDISPLAY(display) \
- gst_vaapi_display_x11_get_display(GST_VAAPI_DISPLAY_X11(display))
-
typedef struct _GstVaapiDisplayX11 GstVaapiDisplayX11;
typedef struct _GstVaapiDisplayX11Private GstVaapiDisplayX11Private;
typedef struct _GstVaapiDisplayX11Class GstVaapiDisplayX11Class;
Display *
gst_vaapi_display_x11_get_display(GstVaapiDisplayX11 *display);
+int
+gst_vaapi_display_x11_get_screen(GstVaapiDisplayX11 *display);
+
G_END_DECLS
#endif /* GST_VAAPI_DISPLAY_X11_H */
--- /dev/null
+/*
+ * gstvaapidisplay_x11_priv.h - Internal VA/X11 interface
+ *
+ * gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef GST_VAAPI_DISPLAY_X11_PRIV_H
+#define GST_VAAPI_DISPLAY_X11_PRIV_H
+
+#include <gst/vaapi/gstvaapiutils_x11.h>
+#include <gst/vaapi/gstvaapidisplay_x11.h>
+
+G_BEGIN_DECLS
+
+#define GST_VAAPI_DISPLAY_X11_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
+ GST_VAAPI_TYPE_DISPLAY_X11, \
+ GstVaapiDisplayX11Private))
+
+#define GST_VAAPI_DISPLAY_X11_CAST(display) ((GstVaapiDisplayX11 *)(display))
+
+/**
+ * GST_VAAPI_DISPLAY_XDISPLAY:
+ * @display: a #GstVaapiDisplay
+ *
+ * Macro that evaluates to the underlying X11 #Display of @display
+ */
+#undef GST_VAAPI_DISPLAY_XDISPLAY
+#define GST_VAAPI_DISPLAY_XDISPLAY(display) \
+ GST_VAAPI_DISPLAY_X11_CAST(display)->priv->x11_display
+
+/**
+ * GST_VAAPI_DISPLAY_XSCREEN:
+ * @display: a #GstVaapiDisplay
+ *
+ * Macro that evaluates to the underlying X11 screen of @display
+ */
+#undef GST_VAAPI_DISPLAY_XSCREEN
+#define GST_VAAPI_DISPLAY_XSCREEN(display) \
+ GST_VAAPI_DISPLAY_X11_CAST(display)->priv->x11_screen
+
+struct _GstVaapiDisplayX11Private {
+ gchar *display_name;
+ Display *x11_display;
+ int x11_screen;
+ guint create_display : 1;
+ guint synchronous : 1;
+};
+
+G_END_DECLS
+
+#endif /* GST_VAAPI_DISPLAY_X11_PRIV_H */
GST_VAAPI_OBJECT_CAST(object)->priv->display
/**
+ * GST_VAAPI_OBJECT_ID:
+ * @object: a #GstVaapiObject
+ *
+ * Macro that evaluates to the #GstVaapiID contained in @object.
+ * This is an internal macro that does not do any run-time type checks.
+ */
+#define GST_VAAPI_OBJECT_ID(object) \
+ GST_VAAPI_OBJECT_CAST(object)->priv->id
+
+/**
+ * GST_VAAPI_OBJECT_DISPLAY_X11:
+ * @object: a #GstVaapiObject
+ *
+ * Macro that evaluates to the #GstVaapiDisplayX11 the @object is bound to.
+ * This is an internal macro that does not do any run-time type check
+ * and requires #include "gstvaapidisplay_x11_priv.h"
+ */
+#define GST_VAAPI_OBJECT_DISPLAY_X11(object) \
+ GST_VAAPI_DISPLAY_X11_CAST(GST_VAAPI_OBJECT_DISPLAY(object))
+
+/**
+ * GST_VAAPI_OBJECT_DISPLAY_GLX:
+ * @object: a #GstVaapiObject
+ *
+ * Macro that evaluates to the #GstVaapiDisplayGLX the @object is bound to.
+ * This is an internal macro that does not do any run-time type check
+ * and requires #include "gstvaapidisplay_glx_priv.h".
+ */
+#define GST_VAAPI_OBJECT_DISPLAY_GLX(object) \
+ GST_VAAPI_DISPLAY_GLX_CAST(GST_VAAPI_OBJECT_DISPLAY(object))
+
+/**
* GST_VAAPI_OBJECT_VADISPLAY:
* @object: a #GstVaapiObject
*
* Macro that evaluates to the #VADisplay of @display.
- * This is an internal macro that does not do any run-time type check.
+ * This is an internal macro that does not do any run-time type check
+ * and requires #include "gstvaapidisplay_priv.h".
*/
#define GST_VAAPI_OBJECT_VADISPLAY(object) \
GST_VAAPI_DISPLAY_VADISPLAY(GST_VAAPI_OBJECT_DISPLAY(object))
* @object: a #GstVaapiObject
*
* Macro that evaluates to the underlying X11 #Display of @display.
- * This is an internal macro that does not do any run-time type check.
- * Besides, this is only valid within libgstvaapi-x11.
+ * This is an internal macro that does not do any run-time type check
+ * and requires #include "gstvaapidisplay_x11_priv.h".
*/
#define GST_VAAPI_OBJECT_XDISPLAY(object) \
GST_VAAPI_DISPLAY_XDISPLAY(GST_VAAPI_OBJECT_DISPLAY(object))
/**
+ * GST_VAAPI_OBJECT_XSCREEN:
+ * @object: a #GstVaapiObject
+ *
+ * Macro that evaluates to the underlying X11 screen of @display.
+ * This is an internal macro that does not do any run-time type check
+ * and requires #include "gstvaapidisplay_x11_priv.h".
+ */
+#define GST_VAAPI_OBJECT_XSCREEN(object) \
+ GST_VAAPI_DISPLAY_XSCREEN(GST_VAAPI_OBJECT_DISPLAY(object))
+
+/**
* GST_VAAPI_OBJECT_LOCK_DISPLAY:
* @object: a #GstVaapiObject
*
GST_VAAPI_DISPLAY_UNLOCK(GST_VAAPI_OBJECT_DISPLAY(object))
/**
- * GST_VAAPI_OBJECT_ID:
- * @object: a #GstVaapiObject
- *
- * Macro that evaluates to the #GstVaapiID contained in @object.
- * This is an internal macro that does not do any run-time type checks.
- */
-#define GST_VAAPI_OBJECT_ID(object) \
- GST_VAAPI_OBJECT_CAST(object)->priv->id
-
-/**
* GstVaapiObjectPrivate:
*
* VA object base.
#include "gstvaapiutils_glx.h"
#include "gstvaapidisplay_glx.h"
#include "gstvaapi_priv.h"
+#include "gstvaapidisplay_x11_priv.h"
#define DEBUG 1
#include "gstvaapidebug.h"
gl_get_current_context(&old_cs);
priv->gl_context = gl_create_context(
GST_VAAPI_OBJECT_XDISPLAY(texture),
- DefaultScreen(GST_VAAPI_OBJECT_XDISPLAY(texture)),
+ GST_VAAPI_OBJECT_XSCREEN(texture),
&old_cs
);
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(texture);
#include "config.h"
#include "gstvaapiwindow_glx.h"
#include "gstvaapidisplay_x11.h"
+#include "gstvaapidisplay_x11_priv.h"
#include "gstvaapiutils_x11.h"
#include "gstvaapiutils_glx.h"
#include "gstvaapi_priv.h"
parent_cs.context = foreign_context;
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
- priv->gl_context = gl_create_context(dpy, DefaultScreen(dpy), &parent_cs);
+ priv->gl_context = gl_create_context(
+ dpy,
+ GST_VAAPI_OBJECT_XSCREEN(window),
+ &parent_cs
+ );
if (!priv->gl_context) {
GST_DEBUG("could not create GLX context");
goto end;
GST_VAAPI_OBJECT_LOCK_DISPLAY(window);
x11_trap_errors();
/* XXX: add a GstVaapiDisplayX11:x11-screen property? */
- screen = DefaultScreen(dpy);
+ screen = GST_VAAPI_OBJECT_XSCREEN(window);
priv->cmap = XCreateColormap(
dpy,
RootWindow(dpy, screen),
#include "gstvaapicompat.h"
#include "gstvaapiwindow_x11.h"
#include "gstvaapidisplay_x11.h"
+#include "gstvaapidisplay_x11_priv.h"
#include "gstvaapiutils.h"
#include "gstvaapiutils_x11.h"
#include "gstvaapi_priv.h"
g_print("# Create window with gst_vaapi_window_x11_new_with_xid()\n");
g_print("#\n");
{
- Display * const dpy = GST_VAAPI_DISPLAY_XDISPLAY(display);
+ Display * const dpy = gst_vaapi_display_x11_get_display(GST_VAAPI_DISPLAY_X11(display));
Window rootwin, win;
int screen;
unsigned long white_pixel, black_pixel;