[329/906] Build for Cocoa on darwin, with various fixes

This commit is contained in:
David Schleef 2009-04-12 22:24:06 -07:00 committed by Matthew Waters
parent d164f882be
commit b47fc234ef
3 changed files with 28 additions and 10 deletions

View file

@ -3,18 +3,28 @@ lib_LTLIBRARIES = libgstgl-@GST_MAJORMINOR@.la
EXTRA_DIST = \ EXTRA_DIST = \
gstglwindow_x11.c \ gstglwindow_x11.c \
gstglwindow_win32.c gstglwindow_win32.c \
gstglwindow_cocoa.m
libgstgl_@GST_MAJORMINOR@_la_SOURCES = \ libgstgl_@GST_MAJORMINOR@_la_SOURCES = \
gstglwindow_@GL_BACKEND@.c \
gstgldisplay.c \ gstgldisplay.c \
gstglbuffer.c \ gstglbuffer.c \
gstglfilter.c \ gstglfilter.c \
gstglshader.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@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/gl
libgstgl_@GST_MAJORMINOR@include_HEADERS = \ libgstgl_@GST_MAJORMINOR@include_HEADERS = \
gstglwindow.h \ gstglwindow.h \
gstgldisplay.h \ gstgldisplay.h \
gstglbuffer.h \ gstglbuffer.h \
gstglfilter.h \ gstglfilter.h \
@ -28,6 +38,9 @@ libgstgl_@GST_MAJORMINOR@_la_LIBADD = \
libgstgl_@GST_MAJORMINOR@_la_CFLAGS = \ libgstgl_@GST_MAJORMINOR@_la_CFLAGS = \
$(GL_CFLAGS) $(X_CFLAGS) \ $(GL_CFLAGS) $(X_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_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 = \ libgstgl_@GST_MAJORMINOR@_la_LDFLAGS = \
$(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)

View file

@ -30,8 +30,8 @@
#include "gstgles2.h" #include "gstgles2.h"
/* OpenGL for usual systems */ /* OpenGL for usual systems */
#else #else
#if (!GNUSTEP && MACOS) #if __APPLE__
#include <OpenGL/glew.h> #include <GL/glew.h>
#include <OpenGL/OpenGL.h> #include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#else #else

View file

@ -74,8 +74,8 @@
/* ============================================================= */ /* ============================================================= */
#ifndef GNUSTEP #ifndef GNUSTEP
static BOOL GSRegisterCurrentThread() { return TRUE; }; static BOOL GSRegisterCurrentThread(void) { return TRUE; };
static GSUnregisterCurrentThread() {}; static void GSUnregisterCurrentThread(void) {};
#endif #endif
#define GST_GL_WINDOW_GET_PRIVATE(o) \ #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]; backing: NSBackingStoreBuffered defer: NO screen: nil gstWin: priv];
if (priv->internal_win_id) { if (priv->internal_win_id) {
NSRect windowRect;
NSRect mainRect = [[NSScreen mainScreen] visibleFrame]; NSRect mainRect = [[NSScreen mainScreen] visibleFrame];
GST_DEBUG ("main screen rect: %d %d %d %d", (int) mainRect.origin.x, (int) mainRect.origin.y, 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); (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, GST_DEBUG ("window rect: %d %d %d %d", (int) windowRect.origin.x, (int) windowRect.origin.y,
(int) windowRect.size.width, (int) windowRect.size.height); (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 defer: (BOOL) flag screen: (NSScreen *) aScreen
gstWin: (GstGLWindowPrivate *) priv { gstWin: (GstGLWindowPrivate *) priv {
m_isClosed = NO;
m_priv = priv;
NSOpenGLView *glView = nil; NSOpenGLView *glView = nil;
NSOpenGLPixelFormat *fmt = nil; NSOpenGLPixelFormat *fmt = nil;
NSOpenGLContext *glContext = nil; NSOpenGLContext *glContext = nil;
@ -386,6 +385,9 @@ gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback,
0 0
}; };
m_isClosed = NO;
m_priv = priv;
self = [super initWithContentRect: contentRect self = [super initWithContentRect: contentRect
styleMask: styleMask backing: bufferingType styleMask: styleMask backing: bufferingType
defer: flag screen:aScreen]; 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. * Discarded if you configured your driver to Never-use-V-Sync.
*/ */
NS_DURING { NS_DURING {
#if 0
/* FIXME doesn't compile */
if (glContext) { if (glContext) {
long swapInterval = 1; long swapInterval = 1;
[[glView openGLContext] setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; [[glView openGLContext] setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
} }
#endif
} NS_HANDLER { } NS_HANDLER {
g_debug ("your back-end does not implement NSOpenglContext::setValues"); g_debug ("your back-end does not implement NSOpenglContext::setValues");
} }