From 80fdf4c30c87a606cf40f47143d2c3dd0469a490 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 19 Nov 2012 22:54:19 +1100 Subject: [PATCH] [616/906] move window-specific code into seperate subfolders --- gst-libs/gst/gl/Makefile.am | 68 +- gst-libs/gst/gl/cocoa/Makefile.am | 33 + gst-libs/gst/gl/{ => cocoa}/gstglwindow_cocoa.h | 0 gst-libs/gst/gl/{ => cocoa}/gstglwindow_cocoa.m | 0 gst-libs/gst/gl/gstglwindow.c | 6 +- gst-libs/gst/gl/gstglwindow_winCE.c | 701 --------------------- gst-libs/gst/gl/win32/Makefile.am | 34 + gst-libs/gst/gl/{ => win32}/gstglwindow_win32.c | 24 +- gst-libs/gst/gl/{ => win32}/gstglwindow_win32.h | 0 .../gst/gl/{ => win32}/gstglwindow_win32_egl.c | 46 +- .../gst/gl/{ => win32}/gstglwindow_win32_egl.h | 8 +- .../gst/gl/{ => win32}/gstglwindow_win32_wgl.c | 0 .../gst/gl/{ => win32}/gstglwindow_win32_wgl.h | 0 gst-libs/gst/gl/x11/Makefile.am | 34 + gst-libs/gst/gl/{ => x11}/gstglwindow_x11.c | 52 +- gst-libs/gst/gl/{ => x11}/gstglwindow_x11.h | 0 gst-libs/gst/gl/{ => x11}/gstglwindow_x11_egl.c | 0 gst-libs/gst/gl/{ => x11}/gstglwindow_x11_egl.h | 0 gst-libs/gst/gl/{ => x11}/gstglwindow_x11_glx.c | 0 gst-libs/gst/gl/{ => x11}/gstglwindow_x11_glx.h | 0 20 files changed, 200 insertions(+), 806 deletions(-) create mode 100644 gst-libs/gst/gl/cocoa/Makefile.am rename gst-libs/gst/gl/{ => cocoa}/gstglwindow_cocoa.h (100%) rename gst-libs/gst/gl/{ => cocoa}/gstglwindow_cocoa.m (100%) delete mode 100644 gst-libs/gst/gl/gstglwindow_winCE.c create mode 100644 gst-libs/gst/gl/win32/Makefile.am rename gst-libs/gst/gl/{ => win32}/gstglwindow_win32.c (96%) rename gst-libs/gst/gl/{ => win32}/gstglwindow_win32.h (100%) rename gst-libs/gst/gl/{ => win32}/gstglwindow_win32_egl.c (83%) rename gst-libs/gst/gl/{ => win32}/gstglwindow_win32_egl.h (97%) rename gst-libs/gst/gl/{ => win32}/gstglwindow_win32_wgl.c (100%) rename gst-libs/gst/gl/{ => win32}/gstglwindow_win32_wgl.h (100%) create mode 100644 gst-libs/gst/gl/x11/Makefile.am rename gst-libs/gst/gl/{ => x11}/gstglwindow_x11.c (94%) rename gst-libs/gst/gl/{ => x11}/gstglwindow_x11.h (100%) rename gst-libs/gst/gl/{ => x11}/gstglwindow_x11_egl.c (100%) rename gst-libs/gst/gl/{ => x11}/gstglwindow_x11_egl.h (100%) rename gst-libs/gst/gl/{ => x11}/gstglwindow_x11_glx.c (100%) rename gst-libs/gst/gl/{ => x11}/gstglwindow_x11_glx.h (100%) diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am index 3a06171..26dd2ff 100644 --- a/gst-libs/gst/gl/Makefile.am +++ b/gst-libs/gst/gl/Makefile.am @@ -1,19 +1,7 @@ lib_LTLIBRARIES = libgstgl-@GST_API_VERSION@.la -EXTRA_DIST = \ - gstglwindow_x11.c \ - gstglwindow_x11_glx.c \ - gstglwindow_x11_egl.c \ - gstglwindow_win32.c \ - gstglwindow_win32_wgl.c \ - gstglwindow_win32_egl.c \ - gstglwindow_win32.h \ - gstglwindow_win32_wgl.h \ - gstglwindow_win32_egl.h \ - gstglwindow_x11.h \ - gstglwindow_x11_glx.h \ - gstglwindow_x11_wgl.h +SUBDIRS = libgstgl_@GST_API_VERSION@_la_SOURCES = \ gstgldisplay.c \ @@ -27,31 +15,24 @@ libgstgl_@GST_API_VERSION@_la_SOURCES = \ gstglupload.c \ gstglwindow.c -#SUBDIRS = +libgstgl_@GST_API_VERSION@_la_LIBADD = \ + $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \ + $(GST_BASE_LIBS) $(GST_LIBS) \ + $(GL_LIBS) + if HAVE_WINDOW_WIN32 -libgstgl_@GST_API_VERSION@_la_SOURCES += gstglwindow_win32.c -if USE_WGL -libgstgl_@GST_API_VERSION@_la_SOURCES += gstglwindow_win32_wgl.c -endif -if USE_EGL -libgstgl_@GST_API_VERSION@_la_SOURCES += gstglwindow_win32_egl.c -endif -#SUBDIRS += win32 +SUBDIRS += win32 +libgstgl_@GST_API_VERSION@_la_LIBADD += win32/libgstgl-win32.la endif if HAVE_WINDOW_COCOA -libgstgl_@GST_API_VERSION@_la_SOURCES += gstglwindow_cocoa.m +SUBDIRS += cocoa +libgstgl_@GST_API_VERSION@_la_LIBADD += cocoa/libgstgl-cocoa.la endif if HAVE_WINDOW_X11 -libgstgl_@GST_API_VERSION@_la_SOURCES += gstglwindow_x11.c -if USE_GLX -libgstgl_@GST_API_VERSION@_la_SOURCES += gstglwindow_x11_glx.c -endif -if USE_EGL -libgstgl_@GST_API_VERSION@_la_SOURCES += gstglwindow_x11_egl.c -endif -#SUBDIRS += x11 +SUBDIRS += x11 +libgstgl_@GST_API_VERSION@_la_LIBADD += x11/libgstgl-x11.la endif libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl @@ -69,23 +50,14 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \ gstgldownload.h \ gstglupload.h -libgstgl_@GST_API_VERSION@_la_LIBADD = \ - $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \ - $(GST_BASE_LIBS) $(GST_LIBS) \ - $(GL_LIBS) - libgstgl_@GST_API_VERSION@_la_CFLAGS = \ - $(GL_CFLAGS) $(X_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) -libgstgl_@GST_API_VERSION@_la_OBJCFLAGS = \ - $(GL_CFLAGS) $(X_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) + $(GL_CFLAGS) \ + $(X_CFLAGS) \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) \ + $(GST_CFLAGS) libgstgl_@GST_API_VERSION@_la_LDFLAGS = \ - $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) - -if HAVE_WINDOW_COCOA -libgstgl_@GST_API_VERSION@_la_LIBTOOLFLAGS = --tag=OBJC -else -libgstgl_@GST_API_VERSION@_la_LIBTOOLFLAGS = --tag=CC -endif + $(GST_LIB_LDFLAGS) \ + $(GST_ALL_LDFLAGS) \ + $(GST_LT_LDFLAGS) diff --git a/gst-libs/gst/gl/cocoa/Makefile.am b/gst-libs/gst/gl/cocoa/Makefile.am new file mode 100644 index 0000000..80d9f88 --- /dev/null +++ b/gst-libs/gst/gl/cocoa/Makefile.am @@ -0,0 +1,33 @@ +## Process this file with automake to produce Makefile.in + +noinst_LTLIBRARIES = libgstgl-cocoa.la + +libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl +libgstglcocoaincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/cocoa + +libgstgl_cocoa_la_SOURCES = \ + gstglwindow_cocoa.m + +libgstglcocoainclude_HEADERS = \ + gstglwindow_cocoa.h + +libgstgl_cocoa_la_CFLAGS = \ + $(GL_CFLAGS) \ + $(X_CFLAGS) \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) \ + $(GST_CFLAGS) \ + -I$(top_srcdir)/gst-libs/gst/gl + +libgstgl_cocoa_la_OBJCFLAGS = \ + $(GL_CFLAGS) \ + $(X_CFLAGS) \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) \ + $(GST_CFLAGS) \ + -I$(top_srcdir)/gst-libs/gst/gl + +libgstgl_cocoa_la_LDFLAGS = \ + $(GST_LIB_LDFLAGS) \ + $(GST_ALL_LDFLAGS) \ + $(GST_LT_LDFLAGS) diff --git a/gst-libs/gst/gl/gstglwindow_cocoa.h b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.h similarity index 100% rename from gst-libs/gst/gl/gstglwindow_cocoa.h rename to gst-libs/gst/gl/cocoa/gstglwindow_cocoa.h diff --git a/gst-libs/gst/gl/gstglwindow_cocoa.m b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m similarity index 100% rename from gst-libs/gst/gl/gstglwindow_cocoa.m rename to gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c index 41fd8fb..0252cab 100644 --- a/gst-libs/gst/gl/gstglwindow.c +++ b/gst-libs/gst/gl/gstglwindow.c @@ -25,13 +25,13 @@ #include "gstglwindow.h" #ifdef HAVE_WINDOW_X11 -#include "gstglwindow_x11.h" +#include "x11/gstglwindow_x11.h" #endif #ifdef HAVE_WINDOW_WIN32 -#include "gstglwindow_win32.h" +#include "win32/gstglwindow_win32.h" #endif #ifdef HAVE_WINDOW_COCOA -#include "gstglwindow_cocoa.h" +#include "cocoa/gstglwindow_cocoa.h" #endif #define GST_CAT_DEFAULT gst_gl_window_debug diff --git a/gst-libs/gst/gl/gstglwindow_winCE.c b/gst-libs/gst/gl/gstglwindow_winCE.c deleted file mode 100644 index 66d8648..0000000 --- a/gst-libs/gst/gl/gstglwindow_winCE.c +++ /dev/null @@ -1,701 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2009 Julien Isorce - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "gstglwindow.h" - -#define WM_GST_GL_WINDOW_CUSTOM (WM_APP+1) -#define WM_GST_GL_WINDOW_QUIT (WM_APP+2) - -LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, - LPARAM lParam); -LRESULT FAR PASCAL sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam, - LPARAM lParam); - -const gchar *EGLErrorString (); - -#define GST_GL_WINDOW_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_GL_TYPE_WINDOW, GstGLWindowPrivate)) - -enum -{ - PROP_0 -}; - -struct _GstGLWindowPrivate -{ - EGLNativeWindowType internal_win_id; - EGLDisplay display; - EGLSurface surface; - EGLContext gl_context; - EGLContext external_gl_context; - GstGLWindowCB draw_cb; - gpointer draw_data; - GstGLWindowCB2 resize_cb; - gpointer resize_data; - GstGLWindowCB close_cb; - gpointer close_data; - gboolean is_closed; - gboolean visible; -}; - -G_DEFINE_TYPE (GstGLWindow, gst_gl_window, G_TYPE_OBJECT); - -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "GstGLWindow" - -gboolean _gst_gl_window_debug = FALSE; - -void -gst_gl_window_init_platform () -{ -} - -HHOOK hHook; - -/* Must be called in the gl thread */ -static void -gst_gl_window_finalize (GObject * object) -{ - GstGLWindow *window = GST_GL_WINDOW (object); - GstGLWindowPrivate *priv = window->priv; - - G_OBJECT_CLASS (gst_gl_window_parent_class)->finalize (object); -} - -static void -gst_gl_window_log_handler (const gchar * domain, GLogLevelFlags flags, - const gchar * message, gpointer user_data) -{ - if (_gst_gl_window_debug) { - g_log_default_handler (domain, flags, message, user_data); - } -} - -static void -gst_gl_window_base_init (gpointer g_class) -{ -} - -static void -gst_gl_window_class_init (GstGLWindowClass * klass) -{ - GObjectClass *obj_class = G_OBJECT_CLASS (klass); - WNDCLASS wc; - ATOM atom = 0; - HINSTANCE hinstance = GetModuleHandle (NULL); - - g_type_class_add_private (klass, sizeof (GstGLWindowPrivate)); - - obj_class->finalize = gst_gl_window_finalize; - - atom = GetClassInfo (hinstance, "GSTGL", &wc); - - if (atom == 0) { - ZeroMemory (&wc, sizeof (WNDCLASS)); - - wc.lpfnWndProc = window_proc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hinstance; - wc.hIcon = LoadIcon (NULL, IDI_WINLOGO); - wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; - wc.hCursor = LoadCursor (NULL, IDC_ARROW); - wc.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH); - wc.lpszMenuName = NULL; - wc.lpszClassName = "GSTGL"; - - atom = RegisterClass (&wc); - - if (atom == 0) - g_error ("Failed to register window class %lud\n", GetLastError ()); - } -} - -static void -gst_gl_window_init (GstGLWindow * window) -{ - window->priv = GST_GL_WINDOW_GET_PRIVATE (window); - - if (g_getenv ("GST_GL_WINDOW_DEBUG") != NULL) - _gst_gl_window_debug = TRUE; - - g_log_set_handler ("GstGLWindow", G_LOG_LEVEL_DEBUG, - gst_gl_window_log_handler, NULL); -} - -/* Must be called in the gl thread */ -GstGLWindow * -gst_gl_window_new (guintptr external_gl_context) -{ - GstGLWindow *window = g_object_new (GST_GL_TYPE_WINDOW, NULL); - GstGLWindowPrivate *priv = window->priv; - GstGLWindowClass *klass = GST_GL_WINDOW_GET_CLASS (window); - - HINSTANCE hinstance = GetModuleHandle (NULL); - - static gint x = 0; - static gint y = 0; - - x += 20; - y += 20; - - priv->internal_win_id = 0; - priv->display = 0; - priv->surface = 0; - priv->gl_context = 0; - priv->external_gl_context = (EGLContext) external_gl_context; - priv->draw_cb = NULL; - priv->draw_data = NULL; - priv->resize_cb = NULL; - priv->resize_data = NULL; - priv->close_cb = NULL; - priv->close_data = NULL; - priv->is_closed = FALSE; - priv->visible = FALSE; - - priv->internal_win_id = CreateWindow ("GSTGL", "OpenGL renderer", WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW, //WS_POPUP | WS_BORDER | WS_SYSMENU | WS_CAPTION - x, y, 0, 0, (HWND) NULL, (HMENU) NULL, hinstance, window); - - if (!priv->internal_win_id) { - g_debug ("failed to create gl window\n"); - goto failure; - } - - g_debug ("gl window created: %d\n", priv->internal_win_id); - - //display is set in the window_proc - if (!priv->display) { - g_debug ("failed to create display\n"); - goto failure; - } - - ShowCursor (TRUE); - - return window; - -failure: - g_object_unref (G_OBJECT (window)); - return NULL; -} - -GQuark -gst_gl_window_error_quark (void) -{ - return g_quark_from_static_string ("gst-gl-window-error"); -} - -guintptr -gst_gl_window_get_internal_gl_context (GstGLWindow * window) -{ - GstGLWindowPrivate *priv = window->priv; - return (guintptr) priv->gl_context; -} - -void -callback_activate_gl_context (GstGLWindowPrivate * priv) -{ - if (!eglMakeCurrent (priv->display, priv->surface, priv->surface, - priv->gl_context)) - g_debug ("failed to activate opengl context %lud\n", GetLastError ()); -} - -void -callback_inactivate_gl_context (GstGLWindowPrivate * priv) -{ - if (!eglMakeCurrent (priv->display, EGL_NO_SURFACE, EGL_NO_SURFACE, - EGL_NO_CONTEXT)) - g_debug ("failed to inactivate opengl context %lud\n", GetLastError ()); -} - -void -gst_gl_window_activate_gl_context (GstGLWindow * window, gboolean activate) -{ - GstGLWindowPrivate *priv = window->priv; - if (activate) - gst_gl_window_send_message (window, callback_activate_gl_context, priv); - else - gst_gl_window_send_message (window, callback_inactivate_gl_context, priv); -} - -void -gst_gl_window_set_external_window_id (GstGLWindow * window, guintptr id) -{ - GstGLWindowPrivate *priv = window->priv; - - //retrieve parent if previously set - HWND parent_id = GetProp (priv->internal_win_id, "gl_window_parent_id"); - - if (priv->visible) { - ShowWindow (priv->internal_win_id, SW_HIDE); - priv->visible = FALSE; - } - - if (parent_id) { - WNDPROC parent_proc = GetProp (parent_id, "gl_window_parent_proc"); - - g_debug ("release parent %lud\n", (gulong) parent_id); - - g_return_if_fail (parent_proc); - - SetWindowLongPtr (parent_id, GWL_WNDPROC, (LONG) parent_proc); - SetParent (priv->internal_win_id, NULL); - - RemoveProp (parent_id, "gl_window_parent_proc"); - RemoveProp (priv->internal_win_id, "gl_window_parent_id"); - } - //not 0 - if (id) { - WNDPROC window_parent_proc = - (WNDPROC) GetWindowLongPtr ((HWND) id, GWL_WNDPROC); - RECT rect; - - g_debug ("set parent %lud\n", (gulong) id); - - SetProp (priv->internal_win_id, "gl_window_parent_id", (HWND) id); - SetProp ((HWND) id, "gl_window_id", priv->internal_win_id); - SetProp ((HWND) id, "gl_window_parent_proc", (WNDPROC) window_parent_proc); - SetWindowLongPtr ((HWND) id, GWL_WNDPROC, (LONG_PTR) sub_class_proc); - - SetWindowLongPtr (priv->internal_win_id, GWL_STYLE, WS_CHILD | WS_MAXIMIZE); - SetParent (priv->internal_win_id, (HWND) id); - - //take changes into account: SWP_FRAMECHANGED - GetClientRect ((HWND) id, &rect); - SetWindowPos (priv->internal_win_id, HWND_TOP, rect.left, rect.top, - rect.right, rect.bottom, - SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | - SWP_FRAMECHANGED | SWP_NOACTIVATE); - MoveWindow (priv->internal_win_id, rect.left, rect.top, rect.right, - rect.bottom, FALSE); - } else { - //no parent so the internal window needs borders and system menu - SetWindowLongPtr (priv->internal_win_id, GWL_STYLE, - WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW); - } -} - -/* Must be called in the gl thread */ -void -gst_gl_window_set_draw_callback (GstGLWindow * window, GstGLWindowCB callback, - gpointer data) -{ - GstGLWindowPrivate *priv = window->priv; - - priv->draw_cb = callback; - priv->draw_data = data; -} - -/* Must be called in the gl thread */ -void -gst_gl_window_set_resize_callback (GstGLWindow * window, - GstGLWindowCB2 callback, gpointer data) -{ - GstGLWindowPrivate *priv = window->priv; - - priv->resize_cb = callback; - priv->resize_data = data; -} - -/* Must be called in the gl thread */ -void -gst_gl_window_set_close_callback (GstGLWindow * window, GstGLWindowCB callback, - gpointer data) -{ - GstGLWindowPrivate *priv = window->priv; - - priv->close_cb = callback; - priv->close_data = data; -} - -void -gst_gl_window_draw_unlocked (GstGLWindow * window, gint width, gint height) -{ - gst_gl_window_draw (window, width, height); -} - -/* Thread safe */ -void -gst_gl_window_draw (GstGLWindow * window, gint width, gint height) -{ - GstGLWindowPrivate *priv = window->priv; - - if (!priv->visible) { - HWND parent_id = GetProp (priv->internal_win_id, "gl_window_parent_id"); - /* if no parent the real size has to be set now because this has not been done - * when at window creation */ - if (!parent_id) { - RECT rect; - GetClientRect (priv->internal_win_id, &rect); - width += 2 * GetSystemMetrics (SM_CXSIZEFRAME); - height += - 2 * GetSystemMetrics (SM_CYSIZEFRAME) + - GetSystemMetrics (SM_CYCAPTION); - MoveWindow (priv->internal_win_id, rect.left, rect.top, width, height, - FALSE); - } - ShowWindowAsync (priv->internal_win_id, SW_SHOW); - priv->visible = TRUE; - } - - RedrawWindow (priv->internal_win_id, NULL, NULL, - RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE); -} - -void -gst_gl_window_run_loop (GstGLWindow * window) -{ - GstGLWindowPrivate *priv = window->priv; - gboolean running = TRUE; - gboolean bRet = FALSE; - MSG msg; - - g_debug ("begin loop\n"); - - while (running && (bRet = GetMessage (&msg, NULL, 0, 0)) != 0) { - if (bRet == -1) { - g_error ("Failed to get message %lud\n", GetLastError ()); - running = FALSE; - } else { - TranslateMessage (&msg); - DispatchMessage (&msg); - } - } - - g_debug ("end loop\n"); -} - -/* Thread safe */ -void -gst_gl_window_quit_loop (GstGLWindow * window, GstGLWindowCB callback, - gpointer data) -{ - if (window) { - GstGLWindowPrivate *priv = window->priv; - LRESULT res = PostMessage (priv->internal_win_id, WM_GST_GL_WINDOW_QUIT, - (WPARAM) data, (LPARAM) callback); - g_return_if_fail (SUCCEEDED (res)); - g_debug ("end loop requested\n"); - } -} - -/* Thread safe */ -void -gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback, - gpointer data) -{ - if (window) { - GstGLWindowPrivate *priv = window->priv; - LRESULT res = SendMessage (priv->internal_win_id, WM_GST_GL_WINDOW_CUSTOM, - (WPARAM) data, (LPARAM) callback); - g_return_if_fail (SUCCEEDED (res)); - } -} - -LRESULT CALLBACK -window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - if (uMsg == WM_CREATE) { - - GstGLWindow *window = - (GstGLWindow *) (((LPCREATESTRUCT) lParam)->lpCreateParams); - - g_debug ("WM_CREATE\n"); - - g_assert (window); - - { - EGLint majorVersion; - EGLint minorVersion; - EGLint numConfigs; - EGLConfig config; - EGLint contextAttribs[] = - { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE }; - - EGLint attribList[] = { - EGL_RED_SIZE, 5, - EGL_GREEN_SIZE, 6, - EGL_BLUE_SIZE, 5, - EGL_ALPHA_SIZE, 8, - EGL_DEPTH_SIZE, 8, - EGL_STENCIL_SIZE, 8, - EGL_SAMPLE_BUFFERS, EGL_DONT_CARE, //1 - EGL_NONE - }; - - GstGLWindowPrivate *priv = window->priv; - - priv->display = eglGetDisplay (GetDC (hWnd)); - if (priv->display != EGL_NO_DISPLAY) - g_debug ("display retrieved: %d\n", priv->display); - else - g_debug ("failed to retrieve display %d, %s\n", hWnd, - EGLErrorString ()); - - if (eglInitialize (priv->display, &majorVersion, &minorVersion)) - g_debug ("egl initialized: %d.%d\n", majorVersion, minorVersion); - else - g_debug ("failed to initialize egl %d, %s\n", priv->display, - EGLErrorString ()); - - if (eglGetConfigs (priv->display, NULL, 0, &numConfigs)) - g_debug ("configs retrieved: %d\n", numConfigs); - else - g_debug ("failed to retrieve configs %d, %s\n", priv->display, - EGLErrorString ()); - - if (eglChooseConfig (priv->display, attribList, &config, 1, &numConfigs)) - g_debug ("config set: %d, %d\n", config, numConfigs); - else - g_debug ("failed to set config %d, %s\n", priv->display, - EGLErrorString ()); - - priv->surface = - eglCreateWindowSurface (priv->display, config, - (EGLNativeWindowType) hWnd, NULL); - if (priv->surface != EGL_NO_SURFACE) - g_debug ("surface created: %d\n", priv->surface); - else - g_debug ("failed to create surface %d, %d, %d, %s\n", priv->display, - priv->surface, hWnd, EGLErrorString ()); - - priv->gl_context = - eglCreateContext (priv->display, config, priv->external_gl_context, - contextAttribs); - if (priv->gl_context != EGL_NO_CONTEXT) - g_debug ("gl context created: %lud, external: %lud\n", - (gulong) priv->gl_context, (gulong) priv->external_gl_context); - else - g_debug - ("failed to create glcontext %lud, extenal: %lud, win: %lud, %s\n", - (gulong) priv->gl_context, (gulong) priv->external_gl_context, - (gulong) hWnd, EGLErrorString ()); - - ReleaseDC (hWnd, priv->display); - - if (!eglMakeCurrent (priv->display, priv->surface, priv->surface, - priv->gl_context)) - g_debug ("failed to make opengl context current %d, %s\n", hWnd, - EGLErrorString ()); - } - - SetProp (hWnd, "gl_window", window); - - return 0; - } else if (GetProp (hWnd, "gl_window")) { - - GstGLWindow *window = GetProp (hWnd, "gl_window"); - GstGLWindowPrivate *priv = NULL; - - g_assert (window); - - priv = window->priv; - - g_assert (priv); - - g_assert (priv->internal_win_id == hWnd); - - g_assert (priv->gl_context == eglGetCurrentContext ()); - - switch (uMsg) { - - case WM_SIZE: - { - if (priv->resize_cb) - priv->resize_cb (priv->resize_data, LOWORD (lParam), HIWORD (lParam)); - break; - } - - case WM_PAINT: - { - if (priv->draw_cb) { - priv->draw_cb (priv->draw_data); - eglSwapBuffers (priv->display, priv->surface); - ValidateRect (hWnd, NULL); - } - break; - } - - case WM_CLOSE: - { - ShowWindowAsync (priv->internal_win_id, SW_HIDE); - - if (priv->close_cb) - priv->close_cb (priv->close_data); - - priv->draw_cb = NULL; - priv->draw_data = NULL; - priv->resize_cb = NULL; - priv->resize_data = NULL; - priv->close_cb = NULL; - priv->close_data = NULL; - break; - } - - case WM_GST_GL_WINDOW_QUIT: - { - HWND parent_id = 0; - GstGLWindowCB destroy_cb = (GstGLWindowCB) lParam; - - g_debug ("WM_CLOSE\n"); - - destroy_cb ((gpointer) wParam); - - parent_id = GetProp (hWnd, "gl_window_parent_id"); - if (parent_id) { - WNDPROC parent_proc = GetProp (parent_id, "gl_window_parent_proc"); - - g_assert (parent_proc); - - SetWindowLongPtr (parent_id, GWL_WNDPROC, - (LONG) (guint64) parent_proc); - SetParent (hWnd, NULL); - - RemoveProp (parent_id, "gl_window_parent_proc"); - RemoveProp (hWnd, "gl_window_parent_id"); - } - - priv->is_closed = TRUE; - RemoveProp (hWnd, "gl_window"); - - if (!eglMakeCurrent (priv->display, priv->surface, priv->surface, - EGL_NO_CONTEXT)) - g_debug ("failed to make current null context %d, %s\n", - priv->display, EGLErrorString ()); - - if (priv->gl_context) { - if (!eglDestroyContext (priv->display, priv->gl_context)) - g_debug ("failed to destroy context %d, %s\n", priv->gl_context, - EGLErrorString ()); - priv->gl_context = NULL; - } - - if (priv->surface) { - if (!eglDestroySurface (priv->display, priv->surface)) - g_debug ("failed to destroy surface %d, %s\n", priv->surface, - EGLErrorString ()); - priv->surface = NULL; - } - - if (priv->surface) { - if (!eglTerminate (priv->display)) - g_debug ("failed to terminate display %d, %s\n", priv->display, - EGLErrorString ()); - priv->surface = NULL; - } - - if (priv->internal_win_id) { - if (!DestroyWindow (priv->internal_win_id)) - g_debug ("failed to destroy window %lud, %lud\n", (gulong) hWnd, - GetLastError ()); - } - - PostQuitMessage (0); - break; - } - - case WM_CAPTURECHANGED: - { - g_debug ("WM_CAPTURECHANGED\n"); - if (priv->draw_cb) - priv->draw_cb (priv->draw_data); - break; - } - - case WM_GST_GL_WINDOW_CUSTOM: - { - if (!priv->is_closed) { - GstGLWindowCB custom_cb = (GstGLWindowCB) lParam; - custom_cb ((gpointer) wParam); - } - break; - } - - case WM_ERASEBKGND: - return TRUE; - - default: - { - /* transmit messages to the parrent (ex: mouse/keyboard input) */ - HWND parent_id = GetProp (hWnd, "gl_window_parent_id"); - if (parent_id) - PostMessage (parent_id, uMsg, wParam, lParam); - return DefWindowProc (hWnd, uMsg, wParam, lParam); - } - } - - return 0; - } else - return DefWindowProc (hWnd, uMsg, wParam, lParam); -} - -LRESULT FAR PASCAL -sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - WNDPROC window_parent_proc = GetProp (hWnd, "gl_window_parent_proc"); - - if (uMsg == WM_SIZE) { - HWND gl_window_id = GetProp (hWnd, "gl_window_id"); - MoveWindow (gl_window_id, 0, 0, LOWORD (lParam), HIWORD (lParam), FALSE); - } - - return CallWindowProc (window_parent_proc, hWnd, uMsg, wParam, lParam); -} - -const gchar * -EGLErrorString () -{ - EGLint nErr = eglGetError (); - switch (nErr) { - case EGL_SUCCESS: - return "EGL_SUCCESS"; - case EGL_BAD_DISPLAY: - return "EGL_BAD_DISPLAY"; - case EGL_NOT_INITIALIZED: - return "EGL_NOT_INITIALIZED"; - case EGL_BAD_ACCESS: - return "EGL_BAD_ACCESS"; - case EGL_BAD_ALLOC: - return "EGL_BAD_ALLOC"; - case EGL_BAD_ATTRIBUTE: - return "EGL_BAD_ATTRIBUTE"; - case EGL_BAD_CONFIG: - return "EGL_BAD_CONFIG"; - case EGL_BAD_CONTEXT: - return "EGL_BAD_CONTEXT"; - case EGL_BAD_CURRENT_SURFACE: - return "EGL_BAD_CURRENT_SURFACE"; - case EGL_BAD_MATCH: - return "EGL_BAD_MATCH"; - case EGL_BAD_NATIVE_PIXMAP: - return "EGL_BAD_NATIVE_PIXMAP"; - case EGL_BAD_NATIVE_WINDOW: - return "EGL_BAD_NATIVE_WINDOW"; - case EGL_BAD_PARAMETER: - return "EGL_BAD_PARAMETER"; - case EGL_BAD_SURFACE: - return "EGL_BAD_SURFACE"; - default: - return "unknown"; - } -} diff --git a/gst-libs/gst/gl/win32/Makefile.am b/gst-libs/gst/gl/win32/Makefile.am new file mode 100644 index 0000000..f810ce3 --- /dev/null +++ b/gst-libs/gst/gl/win32/Makefile.am @@ -0,0 +1,34 @@ +## Process this file with automake to produce Makefile.in + +noinst_LTLIBRARIES = libgstgl-win32.la + +libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl +libgstglwin32includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/win32 + +libgstgl_win32_la_SOURCES = \ + gstglwindow_win32.c + +libgstglwin32include_HEADERS = \ + gstglwindow_win32.h + +if USE_WGL +libgstgl_win32_la_SOURCES += gstglwindow_win32_wgl.c +libgstglwin32include_HEADERS += gstglwindow_win32_wgl.h +endif +if USE_EGL +libgstgl_win32_la_SOURCES += gstglwindow_win32_egl.c +libgstglwin32include_HEADERS += gstglwindow_win32_egl.h +endif + +libgstgl_win32_la_CFLAGS = \ + $(GL_CFLAGS) \ + $(X_CFLAGS) \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) \ + $(GST_CFLAGS) \ + -I$(top_srcdir)/gst-libs/gst/gl + +libgstgl_win32_la_LDFLAGS = \ + $(GST_LIB_LDFLAGS) \ + $(GST_ALL_LDFLAGS) \ + $(GST_LT_LDFLAGS) diff --git a/gst-libs/gst/gl/gstglwindow_win32.c b/gst-libs/gst/gl/win32/gstglwindow_win32.c similarity index 96% rename from gst-libs/gst/gl/gstglwindow_win32.c rename to gst-libs/gst/gl/win32/gstglwindow_win32.c index f15271f..ebc4101 100644 --- a/gst-libs/gst/gl/gstglwindow_win32.c +++ b/gst-libs/gst/gl/win32/gstglwindow_win32.c @@ -142,10 +142,27 @@ gst_gl_window_win32_new (GstGLRendererAPI render_api, guintptr external_gl_context) { GstGLWindowWin32 *window = NULL; + const gchar *user_choice; - window = - GST_GL_WINDOW_WIN32 (gst_gl_window_win32_wgl_new (render_api, - external_gl_context)); + user_choice = g_getenv ("GST_GL_PLATFORM"); + +#if HAVE_WGL + if (!window && (!user_choice || g_strstr_len (user_choice, 3, "wgl"))) + window = + GST_GL_WINDOW_WIN32 (gst_gl_window_win32_wgl_new (render_api, + external_gl_context)); +#endif +#if HAVE_EGL + if (!window && (!user_choice || g_strstr_len (user_choice, 3, "egl"))) + window = + GST_GL_WINDOW_WIN32 (gst_gl_window_win32_egl_new (render_api, + external_gl_context)); +#endif + if (!window) { + GST_WARNING ("Failed to create x11 window, user_choice:%s", + user_choice ? user_choice : "NULL"); + return NULL; + } window->priv->render_api = render_api; window->priv->external_gl_context = external_gl_context; @@ -408,7 +425,6 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) priv = window_win32->priv; window_win32->device = GetDC (hWnd); -// gst_gl_window_set_pixel_format (window_win32); window_class->choose_format (window_win32); window_class->create_context (window_win32, priv->render_api, diff --git a/gst-libs/gst/gl/gstglwindow_win32.h b/gst-libs/gst/gl/win32/gstglwindow_win32.h similarity index 100% rename from gst-libs/gst/gl/gstglwindow_win32.h rename to gst-libs/gst/gl/win32/gstglwindow_win32.h diff --git a/gst-libs/gst/gl/gstglwindow_win32_egl.c b/gst-libs/gst/gl/win32/gstglwindow_win32_egl.c similarity index 83% rename from gst-libs/gst/gl/gstglwindow_win32_egl.c rename to gst-libs/gst/gl/win32/gstglwindow_win32_egl.c index 2d49e1d..daff697 100644 --- a/gst-libs/gst/gl/gstglwindow_win32_egl.c +++ b/gst-libs/gst/gl/win32/gstglwindow_win32_egl.c @@ -1,6 +1,7 @@ /* * GStreamer * Copyright (C) 2009 Julien Isorce + * Copyright (C) 2012 Matthew Waters * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -22,7 +23,9 @@ #include "config.h" #endif -#include "gstglwindow.h" +#include + +#include "gstglwindow_win32_egl.h" static guintptr gst_gl_window_win32_wgl_get_gl_context (GstGLWindowWin32 * window_win32); @@ -137,32 +140,32 @@ gst_gl_window_win32_egl_create_context (GstGLWindowWin32 * window_win32, window_egl->display = eglGetDisplay (window_win32->device); if (priv->display != EGL_NO_DISPLAY) - g_debug ("display retrieved: %d\n", window_egl->display); + GST_DEBUG ("display retrieved: %d\n", window_egl->display); else { - g_debug ("failed to retrieve display %s\n", EGLErrorString ()); + GST_DEBUG ("failed to retrieve display %s\n", EGLErrorString ()); goto failure; } if (eglInitialize (priv->display, &majorVersion, &minorVersion)) - g_debug ("egl initialized: %d.%d\n", majorVersion, minorVersion); + GST_DEBUG ("egl initialized: %d.%d\n", majorVersion, minorVersion); else { - g_debug ("failed to initialize egl %d, %s\n", priv->display, + GST_DEBUG ("failed to initialize egl %d, %s\n", priv->display, EGLErrorString ()); goto failure; } if (eglGetConfigs (window_egl->display, NULL, 0, &numConfigs)) - g_debug ("configs retrieved: %d\n", numConfigs); + GST_DEBUG ("configs retrieved: %d\n", numConfigs); else { - g_debug ("failed to retrieve configs %d, %s\n", window_egl->display, + GST_DEBUG ("failed to retrieve configs %d, %s\n", window_egl->display, EGLErrorString ()); goto failure; } if (eglChooseConfig (priv->display, attribList, &config, 1, &numConfigs)) - g_debug ("config set: %d, %d\n", config, numConfigs); + GST_DEBUG ("config set: %d, %d\n", config, numConfigs); else { - g_debug ("failed to set config %d, %s\n", window_egl->display, + GST_DEBUG ("failed to set config %d, %s\n", window_egl->display, EGLErrorString ()); goto failure; } @@ -171,25 +174,24 @@ gst_gl_window_win32_egl_create_context (GstGLWindowWin32 * window_win32, eglCreateWindowSurface (window_egl->display, config, (EGLNativeWindowType) WindowFromDC (window_win32->device), NULL); if (priv->surface != EGL_NO_SURFACE) - g_debug ("surface created: %d\n", window_egl->surface); + GST_DEBUG ("surface created: %d\n", window_egl->surface); else { - g_debug ("failed to create surface %d, %d, %s\n", window_egl->display, + GST_DEBUG ("failed to create surface %d, %d, %s\n", window_egl->display, window_egl->surface, EGLErrorString ()); goto failure; } window_egl->egl_context = - eglCreateContext (window_egl->display, config, - window_egl->external_gl_context, contextAttribs); + eglCreateContext (window_egl->display, config, external_gl_context, + contextAttribs); if (window_egl->egl_context != EGL_NO_CONTEXT) - g_debug ("gl context created: %lud, external: %lud\n", - (gulong) window_egl->egl_context, - (gulong) window_egl->external_gl_context); + GST_DEBUG ("gl context created: %lud, external: %lud\n", + (gulong) window_egl->egl_context, (gulong) external_gl_context); else { - g_debug + GST_DEBUG ("failed to create glcontext %lud, extenal: %lud, %s\n", - (gulong) window_egl->egl_context, - (gulong) window_egl->external_gl_context, EGLErrorString ()); + (gulong) window_egl->egl_context, (gulong) external_gl_context, + EGLErrorString ()); goto failure; } @@ -208,21 +210,21 @@ gst_gl_window_win32_egl_destroy_context (GstGLWindowWin32 * window_win32) if (window_egl->egl_context) { if (!eglDestroyContext (window_egl->display, window_egl->egl_context)) - g_debug ("failed to destroy context %d, %s\n", window_egl->egl_context, + GST_DEBUG ("failed to destroy context %d, %s\n", window_egl->egl_context, EGLErrorString ()); window_egl->egl_context = NULL; } if (window_egl->surface) { if (!eglDestroySurface (window_egl->display, window_egl->surface)) - g_debug ("failed to destroy surface %d, %s\n", window_egl->surface, + GST_DEBUG ("failed to destroy surface %d, %s\n", window_egl->surface, EGLErrorString ()); window_egl->surface = NULL; } if (window_egl->display) { if (!eglTerminate (window_egl->display)) - g_debug ("failed to terminate display %d, %s\n", window_egl->display, + GST_DEBUG ("failed to terminate display %d, %s\n", window_egl->display, EGLErrorString ()); window_egl->display = NULL; } diff --git a/gst-libs/gst/gl/gstglwindow_win32_egl.h b/gst-libs/gst/gl/win32/gstglwindow_win32_egl.h similarity index 97% rename from gst-libs/gst/gl/gstglwindow_win32_egl.h rename to gst-libs/gst/gl/win32/gstglwindow_win32_egl.h index 81899ce..110c390 100644 --- a/gst-libs/gst/gl/gstglwindow_win32_egl.h +++ b/gst-libs/gst/gl/win32/gstglwindow_win32_egl.h @@ -21,11 +21,11 @@ #ifndef __GST_GL_WINDOW_WIN32_EGL_H__ #define __GST_GL_WINDOW_WIN32_EGL_H__ -#include "gstglwindow_win32.h" +#include + +#include -#undef UNICODE -#include -#define UNICODE +#include "gstglwindow_win32.h" G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstglwindow_win32_wgl.c b/gst-libs/gst/gl/win32/gstglwindow_win32_wgl.c similarity index 100% rename from gst-libs/gst/gl/gstglwindow_win32_wgl.c rename to gst-libs/gst/gl/win32/gstglwindow_win32_wgl.c diff --git a/gst-libs/gst/gl/gstglwindow_win32_wgl.h b/gst-libs/gst/gl/win32/gstglwindow_win32_wgl.h similarity index 100% rename from gst-libs/gst/gl/gstglwindow_win32_wgl.h rename to gst-libs/gst/gl/win32/gstglwindow_win32_wgl.h diff --git a/gst-libs/gst/gl/x11/Makefile.am b/gst-libs/gst/gl/x11/Makefile.am new file mode 100644 index 0000000..ffc66a6 --- /dev/null +++ b/gst-libs/gst/gl/x11/Makefile.am @@ -0,0 +1,34 @@ +## Process this file with automake to produce Makefile.in + +noinst_LTLIBRARIES = libgstgl-x11.la + +libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl +libgstglx11includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/x11 + +libgstgl_x11_la_SOURCES = \ + gstglwindow_x11.c + +libgstglx11include_HEADERS = \ + gstglwindow_x11.h + +if USE_GLX +libgstgl_x11_la_SOURCES += gstglwindow_x11_glx.c +libgstglx11include_HEADERS += gstglwindow_x11_glx.h +endif +if USE_EGL +libgstgl_x11_la_SOURCES += gstglwindow_x11_egl.c +libgstglx11include_HEADERS += gstglwindow_x11_egl.h +endif + +libgstgl_x11_la_CFLAGS = \ + $(GL_CFLAGS) \ + $(X_CFLAGS) \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) \ + $(GST_CFLAGS) \ + -I$(top_srcdir)/gst-libs/gst/gl + +libgstgl_x11_la_LDFLAGS = \ + $(GST_LIB_LDFLAGS) \ + $(GST_ALL_LDFLAGS) \ + $(GST_LT_LDFLAGS) diff --git a/gst-libs/gst/gl/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c similarity index 94% rename from gst-libs/gst/gl/gstglwindow_x11.c rename to gst-libs/gst/gl/x11/gstglwindow_x11.c index 0157115..ee27cc3 100644 --- a/gst-libs/gst/gl/gstglwindow_x11.c +++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c @@ -231,32 +231,36 @@ gst_gl_window_x11_new (GstGLRendererAPI render_api, if (render_api == GST_GL_RENDERER_API_OPENGL || render_api == GST_GL_RENDERER_API_OPENGL3 || render_api == GST_GL_RENDERER_API_ANY) { - if (!window && user_glx) + if (!window && (!user_choice + || g_strstr_len (user_choice, 3, "glx") != NULL)) window = GST_GL_WINDOW_X11 (gst_gl_window_x11_glx_new (render_api, external_gl_context)); - if (!window && user_egl) + if (!window && (!user_choice + || g_strstr_len (user_choice, 3, "egl") != NULL)) window = GST_GL_WINDOW_X11 (gst_gl_window_x11_egl_new (render_api, external_gl_context)); } else { /* try EGL first for OpenGL|ES */ - if (!window && user_egl) + if (!window && (!user_choice + || g_strstr_len (user_choice, 3, "egl") != NULL)) window = GST_GL_WINDOW_X11 (gst_gl_window_x11_egl_new (render_api, external_gl_context)); - if (!window && user_glx) + if (!window && (!user_choice + || g_strstr_len (user_choice, 3, "glx") != NULL)) window = GST_GL_WINDOW_X11 (gst_gl_window_x11_glx_new (render_api, external_gl_context)); } #endif /* HAVE_EGL */ - if (!window && user_glx) + if (!window && (!user_choice || g_strstr_len (user_choice, 3, "glx") != NULL)) window = GST_GL_WINDOW_X11 (gst_gl_window_x11_glx_new (render_api, external_gl_context)); #endif /* HAVE_GLX */ #ifdef HAVE_EGL - if (!window && user_egl) + if (!window && (!user_choice || g_strstr_len (user_choice, 3, "egl") != NULL)) window = GST_GL_WINDOW_X11 (gst_gl_window_x11_egl_new (render_api, external_gl_context)); @@ -648,13 +652,13 @@ gst_gl_window_x11_run (GstGLWindow * window) if (window_x11->running) { #if SIZEOF_VOID_P == 8 GstGLWindowCB custom_cb = - (GstGLWindowCB) (((event.xclient. - data.l[0] & 0xffffffff) << 32) | (event.xclient. - data.l[1] & 0xffffffff)); + (GstGLWindowCB) (((event.xclient.data. + l[0] & 0xffffffff) << 32) | (event.xclient.data. + l[1] & 0xffffffff)); gpointer custom_data = - (gpointer) (((event.xclient. - data.l[2] & 0xffffffff) << 32) | (event.xclient. - data.l[3] & 0xffffffff)); + (gpointer) (((event.xclient.data. + l[2] & 0xffffffff) << 32) | (event.xclient.data. + l[3] & 0xffffffff)); #else GstGLWindowCB custom_cb = (GstGLWindowCB) event.xclient.data.l[0]; gpointer custom_data = (gpointer) event.xclient.data.l[1]; @@ -683,13 +687,13 @@ gst_gl_window_x11_run (GstGLWindow * window) && event.xclient.message_type == wm_quit_loop) { #if SIZEOF_VOID_P == 8 GstGLWindowCB destroy_cb = - (GstGLWindowCB) (((event.xclient. - data.l[0] & 0xffffffff) << 32) | (event.xclient. - data.l[1] & 0xffffffff)); + (GstGLWindowCB) (((event.xclient.data. + l[0] & 0xffffffff) << 32) | (event.xclient.data. + l[1] & 0xffffffff)); gpointer destroy_data = - (gpointer) (((event.xclient. - data.l[2] & 0xffffffff) << 32) | (event.xclient. - data.l[3] & 0xffffffff)); + (gpointer) (((event.xclient.data. + l[2] & 0xffffffff) << 32) | (event.xclient.data. + l[3] & 0xffffffff)); #else GstGLWindowCB destroy_cb = (GstGLWindowCB) event.xclient.data.l[0]; gpointer destroy_data = (gpointer) event.xclient.data.l[1]; @@ -707,13 +711,13 @@ gst_gl_window_x11_run (GstGLWindow * window) &pending_event)) { #if SIZEOF_VOID_P == 8 GstGLWindowCB custom_cb = - (GstGLWindowCB) (((event.xclient. - data.l[0] & 0xffffffff) << 32) | (event.xclient. - data.l[1] & 0xffffffff)); + (GstGLWindowCB) (((event.xclient.data. + l[0] & 0xffffffff) << 32) | (event.xclient.data. + l[1] & 0xffffffff)); gpointer custom_data = - (gpointer) (((event.xclient. - data.l[2] & 0xffffffff) << 32) | (event.xclient. - data.l[3] & 0xffffffff)); + (gpointer) (((event.xclient.data. + l[2] & 0xffffffff) << 32) | (event.xclient.data. + l[3] & 0xffffffff)); #else GstGLWindowCB custom_cb = (GstGLWindowCB) event.xclient.data.l[0]; gpointer custom_data = (gpointer) event.xclient.data.l[1]; diff --git a/gst-libs/gst/gl/gstglwindow_x11.h b/gst-libs/gst/gl/x11/gstglwindow_x11.h similarity index 100% rename from gst-libs/gst/gl/gstglwindow_x11.h rename to gst-libs/gst/gl/x11/gstglwindow_x11.h diff --git a/gst-libs/gst/gl/gstglwindow_x11_egl.c b/gst-libs/gst/gl/x11/gstglwindow_x11_egl.c similarity index 100% rename from gst-libs/gst/gl/gstglwindow_x11_egl.c rename to gst-libs/gst/gl/x11/gstglwindow_x11_egl.c diff --git a/gst-libs/gst/gl/gstglwindow_x11_egl.h b/gst-libs/gst/gl/x11/gstglwindow_x11_egl.h similarity index 100% rename from gst-libs/gst/gl/gstglwindow_x11_egl.h rename to gst-libs/gst/gl/x11/gstglwindow_x11_egl.h diff --git a/gst-libs/gst/gl/gstglwindow_x11_glx.c b/gst-libs/gst/gl/x11/gstglwindow_x11_glx.c similarity index 100% rename from gst-libs/gst/gl/gstglwindow_x11_glx.c rename to gst-libs/gst/gl/x11/gstglwindow_x11_glx.c diff --git a/gst-libs/gst/gl/gstglwindow_x11_glx.h b/gst-libs/gst/gl/x11/gstglwindow_x11_glx.h similarity index 100% rename from gst-libs/gst/gl/gstglwindow_x11_glx.h rename to gst-libs/gst/gl/x11/gstglwindow_x11_glx.h -- 2.7.4