X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fsdl%2Fconsumer_sdl.c;h=91925c91c6b2670ed1526ab72c6787352a7079b8;hb=f57f631e220282142e35b48c59559051d36a39cb;hp=35c39c88175ed4ea27d3bae4d92c41139ebeaadb;hpb=01d0f9853dd68fc14493db560e4930b2e0e3e0e2;p=melted diff --git a/src/modules/sdl/consumer_sdl.c b/src/modules/sdl/consumer_sdl.c index 35c39c8..91925c9 100644 --- a/src/modules/sdl/consumer_sdl.c +++ b/src/modules/sdl/consumer_sdl.c @@ -29,6 +29,13 @@ #include #include +#ifdef __DARWIN__ +# include "consumer_sdl_osx_hack.h" +# import +# import +#endif + + /** This classes definition. */ @@ -81,6 +88,16 @@ static void consumer_sdl_event( mlt_listener listener, mlt_properties owner, mlt mlt_consumer consumer_sdl_init( char *arg ) { +#ifdef __DARWIN__ + // Initialize Cocoa + NSApplicationLoad(); + [NSApplication sharedApplication]; + + // Spawn a fake thread so that cocoa knows to be multithreaded + DummyThread *dummy = [[DummyThread alloc] init]; + [NSThread detachNewThreadSelector:@selector(startThread:) toTarget:dummy withObject:nil]; +#endif + // Create the consumer object consumer_sdl this = calloc( sizeof( struct consumer_sdl_s ), 1 ); @@ -535,6 +552,10 @@ static void *video_thread( void *arg ) // Identify the arg consumer_sdl this = arg; +#ifdef __DARWIN__ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +#endif + // Obtain time of thread start struct timeval now; int64_t start = 0; @@ -618,6 +639,10 @@ static void *video_thread( void *arg ) mlt_consumer_stopped( &this->parent ); +#ifdef __DARWIN__ + [pool release]; +#endif + return NULL; } @@ -629,6 +654,10 @@ static void *consumer_thread( void *arg ) // Identify the arg consumer_sdl this = arg; +#ifdef __DARWIN__ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +#endif + // Get the consumer mlt_consumer consumer = &this->parent; @@ -738,6 +767,10 @@ static void *consumer_thread( void *arg ) this->sdl_overlay = NULL; this->audio_avail = 0; +#ifdef __DARWIN__ + [pool release]; +#endif + return NULL; } @@ -754,6 +787,7 @@ static int consumer_get_dimensions( int *width, int *height ) // Lock the display sdl_lock_display(); +#ifndef __DARWIN__ // Get the wm structure if ( SDL_GetWMInfo( &wm ) == 1 ) { @@ -778,6 +812,7 @@ static int consumer_get_dimensions( int *width, int *height ) *height = attr.height; } } +#endif // Unlock the display sdl_lock_display();