Browse Source

MacOSX/Framework/VLCLibrary.m: libvlc type briding should be in the (VLCLibVLCBridging) category. No need to compute the applicationPath by now.(Patch by Enrique Osuna).

Pierre d'Herbemont 17 years ago
parent
commit
f73833932f
3 changed files with 32 additions and 26 deletions
  1. 15 1
      Headers/Internal/VLCLibVLCBridging.h
  2. 1 3
      Headers/Internal/VLCLibrary.h
  3. 16 22
      Sources/VLCLibrary.m

+ 15 - 1
Headers/Internal/VLCLibVLCBridging.h

@@ -3,7 +3,7 @@
 *****************************************************************************
 * Copyright (C) 2007 Pierre d'Herbemont
 * Copyright (C) 2007 the VideoLAN team
-* $Id: VLCEventManager.h 21564 2007-08-29 21:09:27Z pdherbemont $
+* $Id$
 *
 * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
 *
@@ -22,6 +22,8 @@
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/
 
+#include "VLCLibrary.h"
+
 // TODO: Documentation
 @interface VLCMediaList (LibVLCBridging)
 + (id)medialistWithLibVLCMediaList:(void *)p_new_mlist;
@@ -61,7 +63,19 @@
 @end
 
 // TODO: Documentation
+@interface VLCLibrary (VLCLibVLCBridging)
++ (void *)sharedInstance;
+- (void *)instance;
+@end
+
+// TODO: Documentation
 @interface VLCLibrary (VLCAudioBridging)
 - (void)setAudio:(VLCAudio *)value;
 @end
 
+// TODO: Documentation
+@interface VLCAudio (VLCAudioBridging)
+- (id)initWithLibrary:(VLCLibrary *)library;
+@end
+
+

+ 1 - 3
Headers/Internal/VLCLibrary.h

@@ -30,7 +30,7 @@
 @class VLCAudio;
 
 /*
- * VLCLibrary object.  Internal use only.
+ * VLCLibrary object.
  */
 // TODO: Documentation
 @interface VLCLibrary : NSObject 
@@ -41,10 +41,8 @@
 
 /* Factories */
 + (VLCLibrary *)sharedLibrary;
-+ (void *)sharedInstance;
 
 /* Properties */
-- (void *)instance;
 - (VLCAudio *)audio;
 @end
 

+ 16 - 22
Sources/VLCLibrary.m

@@ -23,6 +23,7 @@
  *****************************************************************************/
 
 #import "VLCLibrary.h"
+#import "VLCLibVLCBridging.h"
 
 #include <vlc/vlc.h>
 #include <vlc/libvlc_structures.h>
@@ -59,18 +60,13 @@ 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];
 }
 
-+ (void *)sharedInstance
-{
-    return [[self sharedLibrary] instance];
-}
-
 - (id)init 
 {
     if (self = [super init]) 
@@ -78,25 +74,16 @@ static void * DestroySharedLibraryAtExit( void )
         libvlc_exception_t ex;
         libvlc_exception_init( &ex );
         
-        // Figure out the frameworks path
-        char *applicationPath = strdup( [[NSString stringWithFormat:@"%@/Versions/Current/VLC", 
-            [[NSBundle bundleForClass:[VLCLibrary class]] bundlePath]] UTF8String] );
-        // TODO: Raise error if there is no memory available
-        
-        char *lib_vlc_params[] = { 
-            applicationPath, "-I", "dummy", "-vvvv", 
-            "--opengl-provider", "minimal_macosx", 
+        const char *lib_vlc_params[] = { 
+            "-I", "dummy", "-vvvv", "--opengl-provider", "minimal_macosx", 
             "--no-video-title-show", NULL
         };
         
-        instance = (void *)libvlc_new( 7, lib_vlc_params, &ex );
+        instance = (void *)libvlc_new( 6, lib_vlc_params, &ex );
         quit_on_exception( &ex );
         
         // Assignment unneeded, as the audio unit will do it for us
         /*audio = */ [[VLCAudio alloc] initWithLibrary:self];
-        
-        // free allocated resources
-        free( applicationPath );
     }
     return self;
 }
@@ -115,14 +102,21 @@ static void * DestroySharedLibraryAtExit( void )
     [super dealloc];
 }
 
-- (void *)instance
+- (VLCAudio *)audio
 {
-    return instance;
+    return audio;
 }
+@end
 
-- (VLCAudio *)audio
+@implementation VLCLibrary (VLCLibVLCBridging)
++ (void *)sharedInstance
 {
-    return audio;
+    return [[self sharedLibrary] instance];
+}
+
+- (void *)instance
+{
+    return instance;
 }
 @end