[gst-cvs] gst-plugins-gl: Build for Cocoa on darwin, with various fixes
David Schleef
ds at kemper.freedesktop.org
Sun Apr 12 22:24:09 PDT 2009
Module: gst-plugins-gl
Branch: master
Commit: e2a2334864f0275b2f399bf598e14fa3c640a67a
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-gl/commit/?id=e2a2334864f0275b2f399bf598e14fa3c640a67a
Author: David Schleef <ds at hutch-2.local>
Date: Sun Apr 12 22:24:06 2009 -0700
Build for Cocoa on darwin, with various fixes
---
configure.ac | 15 ++++++++++++++-
gst-libs/gst/gl/Makefile.am | 19 ++++++++++++++++---
gst-libs/gst/gl/gstglwindow.h | 4 ++--
gst-libs/gst/gl/gstglwindow_cocoa.m | 15 ++++++++++-----
4 files changed, 42 insertions(+), 11 deletions(-)
diff --git a/configure.ac b/configure.ac
index 86e426a..c0ecf4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,7 @@ dnl AS_LIBTOOL_TAGS
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
+AC_PROG_OBJC
dnl *** required versions of GStreamer stuff ***
GST_REQ=0.10.15.1
@@ -163,7 +164,7 @@ fi
#dnl Check for OpenGL, GLU and GLEW
echo host is $host
case $host in
- *-linux* | *-darwin*)
+ *-linux*)
AG_GST_CHECK_X
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
@@ -177,6 +178,15 @@ case $host in
LIBS="$save_LIBS"
GL_BACKEND=x11
;;
+ *-darwin*)
+ save_CPPFLAGS="$CPPFLAGS"
+ save_LIBS="$LIBS"
+ AG_GST_CHECK_LIBHEADER(GLEW, GLEW, glewInit,, GL/glew.h,, AC_MSG_ERROR([GLEW is required]))
+ GL_LIBS="$LIBS -lGLEW -framework OpenGL -framework Cocoa"
+ CPPFLAGS="$save_CPPFLAGS -framework OpenGL"
+ LIBS="$save_LIBS"
+ GL_BACKEND=cocoa
+ ;;
*-mingw32*)
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
@@ -195,6 +205,9 @@ case $host in
esac
AC_SUBST(GL_LIBS)
AC_SUBST(GL_BACKEND)
+AM_CONDITIONAL(GL_BACKEND_X11, test "x$GL_BACKEND" = "xx11")
+AM_CONDITIONAL(GL_BACKEND_COCOA, test "x$GL_BACKEND" = "xcocoa")
+AM_CONDITIONAL(GL_BACKEND_WIN32, test "x$GL_BACKEND" = "xwin32")
dnl checks for gstreamer
dnl uninstalled is selected preferentially -- see pkg-config(1)
diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
index ae7e991..23df76e 100644
--- a/gst-libs/gst/gl/Makefile.am
+++ b/gst-libs/gst/gl/Makefile.am
@@ -3,18 +3,28 @@ lib_LTLIBRARIES = libgstgl- at GST_MAJORMINOR@.la
EXTRA_DIST = \
gstglwindow_x11.c \
- gstglwindow_win32.c
+ gstglwindow_win32.c \
+ gstglwindow_cocoa.m
libgstgl_ at GST_MAJORMINOR@_la_SOURCES = \
- gstglwindow_ at GL_BACKEND@.c \
gstgldisplay.c \
gstglbuffer.c \
gstglfilter.c \
gstglshader.c
+if GL_BACKEND_WIN32
+libgstgl_ at GST_MAJORMINOR@_la_SOURCES += gstglwindow_win32.c
+endif
+if GL_BACKEND_COCOA
+libgstgl_ at GST_MAJORMINOR@_la_SOURCES += gstglwindow_cocoa.m
+endif
+if GL_BACKEND_X11
+libgstgl_ at GST_MAJORMINOR@_la_SOURCES += gstglwindow_x11.c
+endif
+
libgstgl_ at GST_MAJORMINOR@includedir = $(includedir)/gstreamer- at GST_MAJORMINOR@/gst/gl
libgstgl_ at GST_MAJORMINOR@include_HEADERS = \
- gstglwindow.h \
+ gstglwindow.h \
gstgldisplay.h \
gstglbuffer.h \
gstglfilter.h \
@@ -28,6 +38,9 @@ libgstgl_ at GST_MAJORMINOR@_la_LIBADD = \
libgstgl_ at GST_MAJORMINOR@_la_CFLAGS = \
$(GL_CFLAGS) $(X_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
+libgstgl_ at GST_MAJORMINOR@_la_OBJCFLAGS = \
+ $(GL_CFLAGS) $(X_CFLAGS) \
+ $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstgl_ at 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 e68333c..dc7da44 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 <OpenGL/glew.h>
+#if __APPLE__
+#include <GL/glew.h>
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#else
diff --git a/gst-libs/gst/gl/gstglwindow_cocoa.m b/gst-libs/gst/gl/gstglwindow_cocoa.m
index 16c3242..7e04bba 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");
}
More information about the Gstreamer-commits
mailing list