]> git.sesse.net Git - vlc/blobdiff - projects/macosx/framework/Sources/VLCLibrary.m
Replace libvlc_exception_get_message with libvlc_errmsg
[vlc] / projects / macosx / framework / Sources / VLCLibrary.m
index b58e011241b97dedd118082d269f74800e00a582..d7d3d38cbd01c0fa368857bdc33415e612d62614 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * VLCLibrary.h: VLC.framework VLCLibrary implementation
+ * VLCLibrary.m: VLCKit.framework VLCLibrary implementation
  *****************************************************************************
  * Copyright (C) 2007 Pierre d'Herbemont
  * Copyright (C) 2007 the VideoLAN team
@@ -42,14 +42,27 @@ void __catch_exception( void * e, const char * function, const char * file, int
         NSException* libvlcException = [NSException
             exceptionWithName:@"LibVLCException"
             reason:[NSString stringWithFormat:@"libvlc has thrown us an error: %s (%s:%d %s)", 
-                libvlc_exception_get_message( ex ), file, line_number, function]
+                libvlc_errmsg(), file, line_number, function]
             userInfo:nil];
         libvlc_exception_clear( ex );
         @throw libvlcException;
     }
 }
 
-static void * DestroySharedLibraryAtExit( void )
+void * CreateSharedLibraryOnStartup( void ) 
+{
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    
+    /* This library is not loaded for no reason, so let's create
+     * a VLCLibrary instance. */
+    [VLCLibrary sharedLibrary];
+    
+    [pool release];
+    
+    return NULL;
+}
+
+void * DestroySharedLibraryAtExit( void )
 {
     /* Release the global object that may have been alloc-ed
      * in -[VLCLibrary init] */
@@ -66,11 +79,8 @@ static void * DestroySharedLibraryAtExit( void )
     {
         /* Initialize a shared instance */
         sharedLibrary = [[self alloc] init];
-        
-        /* Make sure, this will get released at some point */
-        atexit( (void *)DestroySharedLibraryAtExit );
     }
-    return [[sharedLibrary retain] autorelease];
+    return sharedLibrary;
 }
 
 - (id)init 
@@ -81,8 +91,10 @@ static void * DestroySharedLibraryAtExit( void )
         libvlc_exception_init( &ex );
         
         const char * lib_vlc_params[] = { 
-            "-I", "dummy", "--vout=opengllayer", 
-            "--no-video-title-show", "--no-sout-keep"
+            "-I", "dummy", "--vout=minimal_macosx", 
+            "--no-video-title-show", "--no-sout-keep", "--ignore-config",
+                       "--opengl-provider=minimal_macosx",
+                       "-verbose=-1"
             //, "--control=motion", "--motion-use-rotate", "--video-filter=rotate"
         };