]> git.sesse.net Git - vlc/blobdiff - projects/macosx/framework/Sources/VLCLibrary.m
osx/framework: use the OS X dialog provider as interface module
[vlc] / projects / macosx / framework / Sources / VLCLibrary.m
index 3bdb76d8c3df977e24e70383f1aaa8f39ee79538..d36dbc0bbd2d4eb29d84c89090260a0a383b5553 100644 (file)
@@ -49,29 +49,6 @@ void __catch_exception( void * e, const char * function, const char * file, int
     }
 }
 
-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] */
-    [sharedLibrary release];
-    sharedLibrary = nil;
-
-    return NULL;
-}
-
 @implementation VLCLibrary
 + (VLCLibrary *)sharedLibrary
 {
@@ -90,27 +67,50 @@ void * DestroySharedLibraryAtExit( void )
         libvlc_exception_t ex;
         libvlc_exception_init( &ex );
         
-        const char * lib_vlc_params[] = { 
-            "-I", "dummy",               // No interface 
-            "--no-video-title-show",     // Don't show the title on overlay when starting to play
-            "--no-sout-keep",
-            "--ignore-config",           // Don't read and write VLC config files.
-                       "--opengl-provider=minimal_macosx", // Use minimal_macosx
-            "--vout=minimal_macosx",
-                       "-verbose=-1",               // Don't polute the log
-            "--play-and-pause"           // When ending a stream pause it instead of stopping it.
-            //, "--control=motion", "--motion-use-rotate", "--video-filter=rotate"
-        };
-        
+        NSArray *vlcParams = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"VLCParams"];
+        if (!vlcParams) {
+            NSMutableArray *defaultParams = [NSMutableArray array];
+            [defaultParams addObject:@"-I macosx_dialog_provider"];                 // No actual interface, just dialogs and nagging
+            [defaultParams addObject:@"--no-video-title-show"];                     // Don't show the title on overlay when starting to play
+            [defaultParams addObject:@"--no-sout-keep"];
+            [defaultParams addObject:@"--ignore-config"];                           // Don't read and write VLC config files
+            [defaultParams addObject:@"--vout=macosx"];
+            [defaultParams addObject:@"--text-renderer=quartztext"];                // our CoreText-based renderer
+            [defaultParams addObject:@"--verbose=-1"];                               // Don't polute the log
+            [defaultParams addObject:@"--no-color"];
+            [defaultParams addObject:@"--no-media-library"];
+            [defaultParams addObject:@"--play-and-pause"];
+            vlcParams = defaultParams;
+        }
+
+        int paramNum = 0;
+        NSUInteger count = [vlcParams count];
+        const char *lib_vlc_params[count];
+        while (paramNum < count) {
+            NSString *vlcParam = [vlcParams objectAtIndex:paramNum];
+            lib_vlc_params[paramNum] = [vlcParam cStringUsingEncoding:NSASCIIStringEncoding];
+            paramNum++;
+        }
         instance = (void *)libvlc_new( sizeof(lib_vlc_params)/sizeof(lib_vlc_params[0]), lib_vlc_params, &ex );
         catch_exception( &ex );
-        
+        NSAssert(instance, @"libvlc failed to initialize");
+
         // Assignment unneeded, as the audio unit will do it for us
         /*audio = */ [[VLCAudio alloc] initWithLibrary:self];
     }
     return self;
 }
 
+- (NSString *)version 
+{
+    return [NSString stringWithUTF8String:libvlc_get_version()];
+}
+
+- (NSString *)changeset 
+{
+    return [NSString stringWithUTF8String:libvlc_get_changeset()];
+}
+
 - (void)dealloc 
 {
     if( instance )