diff options
author | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2014-01-01 12:11:43 -0800 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-01-02 10:01:54 +0100 |
commit | 2bc631bcd0051cbb6cf2e519bf103cfdf3c33f08 (patch) | |
tree | 7c1ff955c8ed7b7630a40cf4b9a46f75549931b9 | |
parent | 6fe2115d77b2c67bf5f12a52f456f92496e6556a (diff) | |
download | gstreamer-plugins-good-2bc631bcd0051cbb6cf2e519bf103cfdf3c33f08.tar.gz |
osxvideo: unifdef -DRUN_NS_APP_THREAD
-rw-r--r-- | sys/osxvideo/Makefile.am | 4 | ||||
-rw-r--r-- | sys/osxvideo/osxvideosink.h | 6 | ||||
-rw-r--r-- | sys/osxvideo/osxvideosink.m | 28 |
3 files changed, 2 insertions, 36 deletions
diff --git a/sys/osxvideo/Makefile.am b/sys/osxvideo/Makefile.am index 994b48c88..d7f23c8f5 100644 --- a/sys/osxvideo/Makefile.am +++ b/sys/osxvideo/Makefile.am @@ -3,9 +3,9 @@ plugin_LTLIBRARIES = libgstosxvideosink.la libgstosxvideosink_la_SOURCES = osxvideosink.m cocoawindow.m libgstosxvideosink_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) -DRUN_NS_APP_THREAD + $(GST_PLUGINS_BASE_CFLAGS) libgstosxvideosink_la_OBJCFLAGS = $(GST_OBJCFLAGS) $(GST_BASE_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) -DRUN_NS_APP_THREAD + $(GST_PLUGINS_BASE_CFLAGS) libgstosxvideosink_la_LIBADD = \ $(GST_LIBS) \ $(GST_BASE_LIBS) \ diff --git a/sys/osxvideo/osxvideosink.h b/sys/osxvideo/osxvideosink.h index 92e318f6d..ab5733854 100644 --- a/sys/osxvideo/osxvideosink.h +++ b/sys/osxvideo/osxvideosink.h @@ -89,11 +89,7 @@ struct _GstOSXVideoSinkClass { GstVideoSinkClass parent_class; GstOSXVideoSinkRunLoopState run_loop_state; -#ifdef RUN_NS_APP_THREAD NSThread *ns_app_thread; -#else - guint cocoa_timeout; -#endif }; GType gst_osx_video_sink_get_type(void); @@ -132,11 +128,9 @@ GType gst_osx_video_sink_get_type(void); -(void) destroy; -(void) showFrame: (GstBufferObject*) buf; -(void) setView: (NSView*) view; -#ifdef RUN_NS_APP_THREAD + (BOOL) isMainThread; -(void) nsAppThread; -(void) checkMainRunLoop; -#endif @end G_END_DECLS diff --git a/sys/osxvideo/osxvideosink.m b/sys/osxvideo/osxvideosink.m index af3b147e2..6e29cb765 100644 --- a/sys/osxvideo/osxvideosink.m +++ b/sys/osxvideo/osxvideosink.m @@ -48,11 +48,9 @@ GST_DEBUG_CATEGORY (gst_debug_osx_video_sink); #define GST_CAT_DEFAULT gst_debug_osx_video_sink -#ifdef RUN_NS_APP_THREAD #include <pthread.h> extern void _CFRunLoopSetCurrent (CFRunLoopRef rl); extern pthread_t _CFMainPThread; -#endif @@ -112,12 +110,8 @@ run_ns_app_loop (void) { NSAutoreleasePool *pool =[[NSAutoreleasePool alloc] init]; NSDate *pollTime = nil; -#ifdef RUN_NS_APP_THREAD /* when running the loop in a thread we want to sleep as long as possible */ pollTime = [NSDate distantFuture]; -#else - pollTime = [NSDate distantPast]; -#endif do { event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:pollTime @@ -197,7 +191,6 @@ gst_osx_video_sink_run_cocoa_loop (GstOSXVideoSink * sink ) } if (sink_class->ns_app_thread == NULL) { -#ifdef RUN_NS_APP_THREAD /* run the main runloop in a separate thread */ /* override [NSThread isMainThread] with our own implementation so that we can @@ -218,12 +211,6 @@ gst_osx_video_sink_run_cocoa_loop (GstOSXVideoSink * sink ) g_mutex_lock (&_run_loop_mutex); g_cond_wait (&_run_loop_cond, &_run_loop_mutex); g_mutex_unlock (&_run_loop_mutex); -#else - /* assume that there is a GMainLoop and iterate the main runloop from there - */ - sink_class->cocoa_timeout = g_timeout_add (10, - (GSourceFunc) run_ns_app_loop, NULL); -#endif } g_mutex_unlock (&_run_loop_check_mutex); @@ -232,10 +219,6 @@ gst_osx_video_sink_run_cocoa_loop (GstOSXVideoSink * sink ) static void gst_osx_video_sink_stop_cocoa_loop (GstOSXVideoSink * osxvideosink) { -#ifndef RUN_NS_APP_THREAD - if (sink_class->cocoa_timeout) - g_source_remove(sink_klass->cocoa_timeout); -#endif } /* This function handles osx window creation */ @@ -811,13 +794,6 @@ gst_osx_video_sink_get_type (void) rect.size.width = (float) osxwindow->width; rect.size.height = (float) osxwindow->height; -#ifndef RUN_NS_APP_THREAD - if (!osxvideosink->app_started) { - [NSApplication sharedApplication]; - [NSApp finishLaunching]; - osxvideosink->app_started = TRUE; - } -#endif if (!GetCurrentProcess(&psn)) { TransformProcessType(&psn, kProcessTransformToForegroundApplication); @@ -838,13 +814,11 @@ gst_osx_video_sink_get_type (void) } -#ifdef RUN_NS_APP_THREAD + (BOOL) isMainThread { /* FIXME: ideally we should return YES only for ->ns_app_thread here */ return YES; } -#endif - (void) setView: (NSView*)view { @@ -973,7 +947,6 @@ no_texture_buffer: [pool release]; } -#ifdef RUN_NS_APP_THREAD -(void) nsAppThread { NSAutoreleasePool *pool; @@ -1003,7 +976,6 @@ no_texture_buffer: [pool release]; } -#endif -(void) checkMainRunLoop { |