From b47fc234efeb678ee611115a02a8490ce44de21b Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sun, 12 Apr 2009 22:24:06 -0700 Subject: [PATCH] [329/906] Build for Cocoa on darwin, with various fixes --- gst-libs/gst/gl/Makefile.am | 19 ++++++++++++++++--- gst-libs/gst/gl/gstglwindow.h | 4 ++-- gst-libs/gst/gl/gstglwindow_cocoa.m | 15 ++++++++++----- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am index ae7e991a44..23df76eaee 100644 --- a/gst-libs/gst/gl/Makefile.am +++ b/gst-libs/gst/gl/Makefile.am @@ -3,18 +3,28 @@ lib_LTLIBRARIES = libgstgl-@GST_MAJORMINOR@.la EXTRA_DIST = \ gstglwindow_x11.c \ - gstglwindow_win32.c + gstglwindow_win32.c \ + gstglwindow_cocoa.m libgstgl_@GST_MAJORMINOR@_la_SOURCES = \ - gstglwindow_@GL_BACKEND@.c \ gstgldisplay.c \ gstglbuffer.c \ gstglfilter.c \ gstglshader.c +if GL_BACKEND_WIN32 +libgstgl_@GST_MAJORMINOR@_la_SOURCES += gstglwindow_win32.c +endif +if GL_BACKEND_COCOA +libgstgl_@GST_MAJORMINOR@_la_SOURCES += gstglwindow_cocoa.m +endif +if GL_BACKEND_X11 +libgstgl_@GST_MAJORMINOR@_la_SOURCES += gstglwindow_x11.c +endif + libgstgl_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/gl libgstgl_@GST_MAJORMINOR@include_HEADERS = \ - gstglwindow.h \ + gstglwindow.h \ gstgldisplay.h \ gstglbuffer.h \ gstglfilter.h \ @@ -28,6 +38,9 @@ libgstgl_@GST_MAJORMINOR@_la_LIBADD = \ libgstgl_@GST_MAJORMINOR@_la_CFLAGS = \ $(GL_CFLAGS) $(X_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) +libgstgl_@GST_MAJORMINOR@_la_OBJCFLAGS = \ + $(GL_CFLAGS) $(X_CFLAGS) \ + $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) libgstgl_@GST_MAJORMINOR@_la_LDFLAGS = \ $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) diff --git a/gst-libs/gst/gl/gstglwindow.h b/gst-libs/gst/gl/gstglwindow.h index e68333c8a7..dc7da44f1a 100644 --- a/gst-libs/gst/gl/gstglwindow.h +++ b/gst-libs/gst/gl/gstglwindow.h @@ -30,8 +30,8 @@ #include "gstgles2.h" /* OpenGL for usual systems */ #else -#if (!GNUSTEP && MACOS) -#include +#if __APPLE__ +#include #include #include #else diff --git a/gst-libs/gst/gl/gstglwindow_cocoa.m b/gst-libs/gst/gl/gstglwindow_cocoa.m index 16c32423a8..7e04bba3c1 100644 --- a/gst-libs/gst/gl/gstglwindow_cocoa.m +++ b/gst-libs/gst/gl/gstglwindow_cocoa.m @@ -74,8 +74,8 @@ /* ============================================================= */ #ifndef GNUSTEP -static BOOL GSRegisterCurrentThread() { return TRUE; }; -static GSUnregisterCurrentThread() {}; +static BOOL GSRegisterCurrentThread(void) { return TRUE; }; +static void GSUnregisterCurrentThread(void) {}; #endif #define GST_GL_WINDOW_GET_PRIVATE(o) \ @@ -185,11 +185,12 @@ gst_gl_window_new (gint width, gint height) backing: NSBackingStoreBuffered defer: NO screen: nil gstWin: priv]; if (priv->internal_win_id) { + NSRect windowRect; NSRect mainRect = [[NSScreen mainScreen] visibleFrame]; GST_DEBUG ("main screen rect: %d %d %d %d", (int) mainRect.origin.x, (int) mainRect.origin.y, (int) mainRect.size.width, (int) mainRect.size.height); - NSRect windowRect = [priv->internal_win_id frame]; + windowRect = [priv->internal_win_id frame]; GST_DEBUG ("window rect: %d %d %d %d", (int) windowRect.origin.x, (int) windowRect.origin.y, (int) windowRect.size.width, (int) windowRect.size.height); @@ -370,8 +371,6 @@ gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback, defer: (BOOL) flag screen: (NSScreen *) aScreen gstWin: (GstGLWindowPrivate *) priv { - m_isClosed = NO; - m_priv = priv; NSOpenGLView *glView = nil; NSOpenGLPixelFormat *fmt = nil; NSOpenGLContext *glContext = nil; @@ -386,6 +385,9 @@ gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback, 0 }; + m_isClosed = NO; + m_priv = priv; + self = [super initWithContentRect: contentRect styleMask: styleMask backing: bufferingType defer: flag screen:aScreen]; @@ -420,10 +422,13 @@ gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback, * Discarded if you configured your driver to Never-use-V-Sync. */ NS_DURING { +#if 0 + /* FIXME doesn't compile */ if (glContext) { long swapInterval = 1; [[glView openGLContext] setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; } +#endif } NS_HANDLER { g_debug ("your back-end does not implement NSOpenglContext::setValues"); }