G_DEFINE_TYPE (GstGLContextCocoa, gst_gl_context_cocoa, GST_GL_TYPE_CONTEXT);
-#ifndef GNUSTEP
static GMutex nsapp_lock;
static GCond nsapp_cond;
return TRUE;
}
-#endif
static void
gst_gl_context_cocoa_class_init (GstGLContextCocoaClass * klass)
{
GstGLContextClass *context_class = (GstGLContextClass *) klass;
-
-#ifndef GNUSTEP
NSAutoreleasePool* pool = nil;
-#endif
g_type_class_add_private (klass, sizeof (GstGLContextCocoaPrivate));
context_class->get_gl_platform =
GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_get_gl_platform);
-#ifndef GNUSTEP
pool = [[NSAutoreleasePool alloc] init];
/* [NSApplication sharedApplication] will usually be
}
[pool release];
-#endif
}
static void
GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
__block NSOpenGLContext *glContext = nil;
-#ifndef GNUSTEP
priv->source_id = g_timeout_add (200, gst_gl_window_cocoa_nsapp_iteration, NULL);
-#endif
priv->gl_context = nil;
if (other_context)
pool = [[NSAutoreleasePool alloc] init];
-#ifdef GNUSTEP
- [NSApplication sharedApplication];
-#endif
rect.origin.x = 0;
rect.origin.y = 0;
rect.size.width = 320;
[window_handle setContentView:glView];
-#ifndef GNUSTEP
glContext = [[NSOpenGLContext alloc] initWithFormat:fmt
shareContext:context_cocoa->priv->external_gl_context];
[glContext setView:glView];
-#else
- /* FIXME try to make context sharing work in GNUstep */
- context_cocoa->priv->gl_context = glContext;
-#endif
[pool release];
});
*/
NS_DURING {
if (glContext) {
-#ifdef GNUSTEP
- const long swapInterval = 1;
-#else
const GLint swapInterval = 1;
-#endif
[glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
}
} NS_HANDLER {
x += 20;
y += 20;
-#ifndef GNUSTEP
[priv->internal_win_id setFrame:windowRect display:NO];
GST_DEBUG ("make the window available\n");
[priv->internal_win_id makeMainWindow];
-#endif
[priv->internal_win_id orderFrontRegardless];
}
- (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
window_cocoa = window;
-#ifndef GNUSTEP
[self setWantsLayer:NO];
-#endif
/* Get notified about changes */
[self setPostsFrameChangedNotifications:YES];
static gpointer thread_func (MainWindow* window)
{
-#ifdef GNUSTEP
- GSRegisterCurrentThread();
-#endif
-
g_main_loop_run ([window loop]);
-#ifdef GNUSTEP
- GSUnregisterCurrentThread();
-#endif
return NULL;
}
NSAutoreleasePool *pool=nil;
NSRect rect;
MainWindow *window=nil;
-
-#ifdef GNUSTEP
- GstState state;
-#endif
g_print("app created\n");
if (!ok)
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];
-#ifndef GNUSTEP
[NSApplication sharedApplication];
-#endif
rect.origin.x = 0; rect.origin.y = 0;
rect.size.width = width; rect.size.height = height;
[window orderFront:window];
-#ifndef GNUSTEP
while (![window isClosed]) {
NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate dateWithTimeIntervalSinceNow:1]
if (event)
[NSApp sendEvent:event];
}
-#endif
g_thread_join (loop_thread);
[pool release];
-#ifdef GNUSTEP
- GSUnregisterCurrentThread();
-#endif
-
return 0;
}