Commit 80fdf4c3 authored by Matthew Waters's avatar Matthew Waters 🐨 Committed by Tim-Philipp Müller

[616/906] move window-specific code into seperate subfolders

parent cc1f7348
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)
## 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)
......@@ -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
......
This diff is collapsed.
## 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)
......@@ -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,
......
/*
* GStreamer
* Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
* Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
*
* 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 <gst/gst.h>
#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;
}
......
......@@ -21,11 +21,11 @@
#ifndef __GST_GL_WINDOW_WIN32_EGL_H__
#define __GST_GL_WINDOW_WIN32_EGL_H__
#include "gstglwindow_win32.h"
#include <EGL/egl.h>
#include <gst/gst.h>
#undef UNICODE
#include <windows.h>
#define UNICODE
#include "gstglwindow_win32.h"
G_BEGIN_DECLS
......
## 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)
......@@ -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];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment