mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-25 07:26:29 +00:00
gl/cocoa: Remove GNUStep support
Until gcc and GNUStep properly support Objective-C blocks and other "new" features of Objective-C we can't properly support them without making the code much more ugly. https://bugzilla.gnome.org/show_bug.cgi?id=739152
This commit is contained in:
parent
6c3b3bef4e
commit
13c8517570
4 changed files with 1 additions and 118 deletions
56
configure.ac
56
configure.ac
|
@ -615,7 +615,7 @@ AC_ARG_ENABLE([glx],
|
||||||
esac],[NEED_GLX=auto])
|
esac],[NEED_GLX=auto])
|
||||||
|
|
||||||
AC_ARG_ENABLE([cocoa],
|
AC_ARG_ENABLE([cocoa],
|
||||||
[ --enable-cocoa Enable Cocoa support (using GNUstep on non OS X platforms) @<:@default=auto@:>@],
|
[ --enable-cocoa Enable Cocoa support @<:@default=auto@:>@],
|
||||||
[case "${enableval}" in
|
[case "${enableval}" in
|
||||||
yes) NEED_COCOA=yes ;;
|
yes) NEED_COCOA=yes ;;
|
||||||
no) NEED_COCOA=no ;;
|
no) NEED_COCOA=no ;;
|
||||||
|
@ -657,7 +657,6 @@ save_LIBS="$LIBS"
|
||||||
HAVE_GL=no
|
HAVE_GL=no
|
||||||
HAVE_GLES2=no
|
HAVE_GLES2=no
|
||||||
HAVE_GLU=no
|
HAVE_GLU=no
|
||||||
HAVE_GNUSTEP_COCOA=no
|
|
||||||
HAVE_WAYLAND_EGL=no
|
HAVE_WAYLAND_EGL=no
|
||||||
|
|
||||||
HAVE_EGL_RPI=no
|
HAVE_EGL_RPI=no
|
||||||
|
@ -754,35 +753,6 @@ case $host in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case $host in
|
|
||||||
*-darwin* ) ;;
|
|
||||||
*)
|
|
||||||
AC_PATH_PROG([GNUSTEP_CONFIG],[gnustep-config])
|
|
||||||
if test "x$GNUSTEP_CONFIG" != "x"; then
|
|
||||||
GNUSTEP_HOST="`$GNUSTEP_CONFIG --variable=GNUSTEP_HOST`"
|
|
||||||
case $host in
|
|
||||||
*-mingw* )
|
|
||||||
case $GNUSTEP_HOST in
|
|
||||||
*-mingw* )
|
|
||||||
HAVE_GNUSTEP_COCOA=yes
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
HAVE_GNUSTEP_COCOA=yes
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([for GNUstep])
|
|
||||||
if test "x$HAVE_GNUSTEP_COCOA" = "xyes" ; then
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
fi
|
|
||||||
|
|
||||||
CPPFLAGS="$save_CPPFLAGS"
|
CPPFLAGS="$save_CPPFLAGS"
|
||||||
LIBS="$save_LIBS"
|
LIBS="$save_LIBS"
|
||||||
|
|
||||||
|
@ -1015,19 +985,6 @@ case $host in
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl GNUstep provides the Cocoa API on unix
|
|
||||||
if test "x$NEED_COCOA" != "xno"; then
|
|
||||||
if test "x$HAVE_GNUSTEP_COCOA" = "xyes" ; then
|
|
||||||
GNUSTEP_OBJCFLAGS="`$GNUSTEP_CONFIG --objc-flags`"
|
|
||||||
GNUSTEP_LIBS="`$GNUSTEP_CONFIG --gui-libs`"
|
|
||||||
GL_LIBS="$GL_LIBS $GNUSTEP_LIBS -lgnustep-gui -lgnustep-base"
|
|
||||||
GL_OBJCFLAGS="$GL_OBJCFLAGS $GNUSTEP_OBJCFLAGS"
|
|
||||||
|
|
||||||
USE_COCOA=yes
|
|
||||||
HAVE_WINDOW_COCOA=yes
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*-darwin*)
|
*-darwin*)
|
||||||
if test "x$HAVE_IOS" = "xyes"; then
|
if test "x$HAVE_IOS" = "xyes"; then
|
||||||
|
@ -1120,17 +1077,6 @@ case $host in
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl GNUstep provides the Cocoa API on win32
|
|
||||||
if test "x$HAVE_GNUSTEP_COCOA" = "xyes" ; then
|
|
||||||
GNUSTEP_CFLAGS="`$GNUSTEP_CONFIG --objc-flags`"
|
|
||||||
GNUSTEP_LIBS="`$GNUSTEP_CONFIG --gui-libs`"
|
|
||||||
GL_LIBS="$GL_LIBS $GNUSTEP_LIBS -lgnustep-gui -lgnustep-base"
|
|
||||||
GL_OBJCFLAGS="$OBJCFLAGS $GNUSTEP_CFLAGS"
|
|
||||||
|
|
||||||
USE_COCOA=yes
|
|
||||||
HAVE_WINDOW_COCOA=yes
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AC_MSG_WARN([Don't know how to check for OpenGL on your platform.])
|
AC_MSG_WARN([Don't know how to check for OpenGL on your platform.])
|
||||||
|
|
|
@ -40,7 +40,6 @@ static GstGLPlatform gst_gl_context_cocoa_get_gl_platform (GstGLContext * contex
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstGLContextCocoa, gst_gl_context_cocoa, GST_GL_TYPE_CONTEXT);
|
G_DEFINE_TYPE (GstGLContextCocoa, gst_gl_context_cocoa, GST_GL_TYPE_CONTEXT);
|
||||||
|
|
||||||
#ifndef GNUSTEP
|
|
||||||
static GMutex nsapp_lock;
|
static GMutex nsapp_lock;
|
||||||
static GCond nsapp_cond;
|
static GCond nsapp_cond;
|
||||||
|
|
||||||
|
@ -96,16 +95,12 @@ gst_gl_window_cocoa_nsapp_iteration (gpointer data)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_context_cocoa_class_init (GstGLContextCocoaClass * klass)
|
gst_gl_context_cocoa_class_init (GstGLContextCocoaClass * klass)
|
||||||
{
|
{
|
||||||
GstGLContextClass *context_class = (GstGLContextClass *) klass;
|
GstGLContextClass *context_class = (GstGLContextClass *) klass;
|
||||||
|
|
||||||
#ifndef GNUSTEP
|
|
||||||
NSAutoreleasePool* pool = nil;
|
NSAutoreleasePool* pool = nil;
|
||||||
#endif
|
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GstGLContextCocoaPrivate));
|
g_type_class_add_private (klass, sizeof (GstGLContextCocoaPrivate));
|
||||||
|
|
||||||
|
@ -121,7 +116,6 @@ gst_gl_context_cocoa_class_init (GstGLContextCocoaClass * klass)
|
||||||
context_class->get_gl_platform =
|
context_class->get_gl_platform =
|
||||||
GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_get_gl_platform);
|
GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_get_gl_platform);
|
||||||
|
|
||||||
#ifndef GNUSTEP
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
/* [NSApplication sharedApplication] will usually be
|
/* [NSApplication sharedApplication] will usually be
|
||||||
|
@ -191,7 +185,6 @@ gst_gl_context_cocoa_class_init (GstGLContextCocoaClass * klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -219,9 +212,7 @@ gst_gl_context_cocoa_create_context (GstGLContext *context, GstGLAPI gl_api,
|
||||||
GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
|
GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
|
||||||
__block NSOpenGLContext *glContext = nil;
|
__block NSOpenGLContext *glContext = nil;
|
||||||
|
|
||||||
#ifndef GNUSTEP
|
|
||||||
priv->source_id = g_timeout_add (200, gst_gl_window_cocoa_nsapp_iteration, NULL);
|
priv->source_id = g_timeout_add (200, gst_gl_window_cocoa_nsapp_iteration, NULL);
|
||||||
#endif
|
|
||||||
|
|
||||||
priv->gl_context = nil;
|
priv->gl_context = nil;
|
||||||
if (other_context)
|
if (other_context)
|
||||||
|
@ -243,9 +234,6 @@ gst_gl_context_cocoa_create_context (GstGLContext *context, GstGLAPI gl_api,
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
#ifdef GNUSTEP
|
|
||||||
[NSApplication sharedApplication];
|
|
||||||
#endif
|
|
||||||
rect.origin.x = 0;
|
rect.origin.x = 0;
|
||||||
rect.origin.y = 0;
|
rect.origin.y = 0;
|
||||||
rect.size.width = 320;
|
rect.size.width = 320;
|
||||||
|
@ -265,7 +253,6 @@ gst_gl_context_cocoa_create_context (GstGLContext *context, GstGLAPI gl_api,
|
||||||
|
|
||||||
[window_handle setContentView:glView];
|
[window_handle setContentView:glView];
|
||||||
|
|
||||||
#ifndef GNUSTEP
|
|
||||||
glContext = [[NSOpenGLContext alloc] initWithFormat:fmt
|
glContext = [[NSOpenGLContext alloc] initWithFormat:fmt
|
||||||
shareContext:context_cocoa->priv->external_gl_context];
|
shareContext:context_cocoa->priv->external_gl_context];
|
||||||
|
|
||||||
|
@ -275,10 +262,6 @@ gst_gl_context_cocoa_create_context (GstGLContext *context, GstGLAPI gl_api,
|
||||||
|
|
||||||
[glContext setView:glView];
|
[glContext setView:glView];
|
||||||
|
|
||||||
#else
|
|
||||||
/* FIXME try to make context sharing work in GNUstep */
|
|
||||||
context_cocoa->priv->gl_context = glContext;
|
|
||||||
#endif
|
|
||||||
[pool release];
|
[pool release];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -300,11 +283,7 @@ gst_gl_context_cocoa_create_context (GstGLContext *context, GstGLAPI gl_api,
|
||||||
*/
|
*/
|
||||||
NS_DURING {
|
NS_DURING {
|
||||||
if (glContext) {
|
if (glContext) {
|
||||||
#ifdef GNUSTEP
|
|
||||||
const long swapInterval = 1;
|
|
||||||
#else
|
|
||||||
const GLint swapInterval = 1;
|
const GLint swapInterval = 1;
|
||||||
#endif
|
|
||||||
[glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
|
[glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
|
||||||
}
|
}
|
||||||
} NS_HANDLER {
|
} NS_HANDLER {
|
||||||
|
|
|
@ -257,11 +257,9 @@ draw_cb (gpointer data)
|
||||||
x += 20;
|
x += 20;
|
||||||
y += 20;
|
y += 20;
|
||||||
|
|
||||||
#ifndef GNUSTEP
|
|
||||||
[priv->internal_win_id setFrame:windowRect display:NO];
|
[priv->internal_win_id setFrame:windowRect display:NO];
|
||||||
GST_DEBUG ("make the window available\n");
|
GST_DEBUG ("make the window available\n");
|
||||||
[priv->internal_win_id makeMainWindow];
|
[priv->internal_win_id makeMainWindow];
|
||||||
#endif
|
|
||||||
|
|
||||||
[priv->internal_win_id orderFrontRegardless];
|
[priv->internal_win_id orderFrontRegardless];
|
||||||
|
|
||||||
|
@ -457,17 +455,6 @@ close_window_cb (gpointer data)
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) applicationWillTerminate:(NSNotification *)aNotification {
|
- (void) applicationWillTerminate:(NSNotification *)aNotification {
|
||||||
#ifdef GNUSTEP
|
|
||||||
/* fixes segfault with gst-launch-1.0 -e ... and sending SIGINT (Ctrl-C)
|
|
||||||
* which causes GNUstep to run a signal handler in the main thread.
|
|
||||||
* However that thread has never been 'registered' with GNUstep so
|
|
||||||
* the autorelease magic of objective-c causes a segfault from accessing
|
|
||||||
* a null NSThread object somewhere deep in GNUstep.
|
|
||||||
*
|
|
||||||
* I put it here because this is the first time we can register the thread.
|
|
||||||
*/
|
|
||||||
GSRegisterCurrentThread();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -488,9 +475,7 @@ close_window_cb (gpointer data)
|
||||||
|
|
||||||
window_cocoa = window;
|
window_cocoa = window;
|
||||||
|
|
||||||
#ifndef GNUSTEP
|
|
||||||
[self setWantsLayer:NO];
|
[self setWantsLayer:NO];
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Get notified about changes */
|
/* Get notified about changes */
|
||||||
[self setPostsFrameChangedNotifications:YES];
|
[self setPostsFrameChangedNotifications:YES];
|
||||||
|
|
|
@ -136,15 +136,8 @@ static void end_stream_cb(GstBus* bus, GstMessage* message, MainWindow* window)
|
||||||
|
|
||||||
static gpointer thread_func (MainWindow* window)
|
static gpointer thread_func (MainWindow* window)
|
||||||
{
|
{
|
||||||
#ifdef GNUSTEP
|
|
||||||
GSRegisterCurrentThread();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_main_loop_run ([window loop]);
|
g_main_loop_run ([window loop]);
|
||||||
|
|
||||||
#ifdef GNUSTEP
|
|
||||||
GSUnregisterCurrentThread();
|
|
||||||
#endif
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,10 +165,6 @@ int main(int argc, char **argv)
|
||||||
NSAutoreleasePool *pool=nil;
|
NSAutoreleasePool *pool=nil;
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
MainWindow *window=nil;
|
MainWindow *window=nil;
|
||||||
|
|
||||||
#ifdef GNUSTEP
|
|
||||||
GstState state;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_print("app created\n");
|
g_print("app created\n");
|
||||||
|
|
||||||
|
@ -203,18 +192,8 @@ int main(int argc, char **argv)
|
||||||
if (!ok)
|
if (!ok)
|
||||||
g_warning("could not link videosrc to videosink\n");
|
g_warning("could not link videosrc to videosink\n");
|
||||||
|
|
||||||
#ifdef GNUSTEP
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
||||||
state = GST_STATE_PAUSED;
|
|
||||||
gst_element_get_state (pipeline, &state, &state, GST_CLOCK_TIME_NONE);
|
|
||||||
g_print("pipeline paused\n");
|
|
||||||
GSRegisterCurrentThread();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
#ifndef GNUSTEP
|
|
||||||
[NSApplication sharedApplication];
|
[NSApplication sharedApplication];
|
||||||
#endif
|
|
||||||
|
|
||||||
rect.origin.x = 0; rect.origin.y = 0;
|
rect.origin.x = 0; rect.origin.y = 0;
|
||||||
rect.size.width = width; rect.size.height = height;
|
rect.size.width = width; rect.size.height = height;
|
||||||
|
@ -236,7 +215,6 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
[window orderFront:window];
|
[window orderFront:window];
|
||||||
|
|
||||||
#ifndef GNUSTEP
|
|
||||||
while (![window isClosed]) {
|
while (![window isClosed]) {
|
||||||
NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask
|
NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask
|
||||||
untilDate:[NSDate dateWithTimeIntervalSinceNow:1]
|
untilDate:[NSDate dateWithTimeIntervalSinceNow:1]
|
||||||
|
@ -244,7 +222,6 @@ int main(int argc, char **argv)
|
||||||
if (event)
|
if (event)
|
||||||
[NSApp sendEvent:event];
|
[NSApp sendEvent:event];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
g_thread_join (loop_thread);
|
g_thread_join (loop_thread);
|
||||||
|
|
||||||
|
@ -252,9 +229,5 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
#ifdef GNUSTEP
|
|
||||||
GSUnregisterCurrentThread();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue