Browse Source

MacOSX/Framework/VLCLibrary: Code cleanup and use Objective-C 2.0 @property. (Patch by Enrique Osuna).

Pierre d'Herbemont 17 years ago
parent
commit
bcf714747a
2 changed files with 19 additions and 16 deletions
  1. 13 7
      Headers/Internal/VLCLibrary.h
  2. 6 9
      Sources/VLCLibrary.m

+ 13 - 7
Headers/Internal/VLCLibrary.h

@@ -29,26 +29,32 @@
 
 
 @class VLCAudio;
 @class VLCAudio;
 
 
-/*
+/**
  * VLCLibrary object.
  * VLCLibrary object.
+ * TODO: Documentation VLCLibrary
  */
  */
-// TODO: Documentation
 @interface VLCLibrary : NSObject 
 @interface VLCLibrary : NSObject 
 {
 {
-    void *instance;
-    VLCAudio *audio;
+    void * instance;
+    VLCAudio * audio;
 }
 }
 
 
 /* Factories */
 /* Factories */
+/**
+ * TODO: Documentation + [VLCLibrary sharedLibrary]
+ */
 + (VLCLibrary *)sharedLibrary;
 + (VLCLibrary *)sharedLibrary;
 
 
 /* Properties */
 /* Properties */
-- (VLCAudio *)audio;
+/**
+ * TODO: Documentation VLCLibrary.audio
+ */
+@property (readonly) VLCAudio * audio;
 @end
 @end
 
 
 /*
 /*
  * Utility function
  * Utility function
  */
  */
 // TODO: Figure out a better way to raise error messages
 // TODO: Figure out a better way to raise error messages
-#define quit_on_exception( ex ) __quit_on_exception( (void*)(ex), __FUNCTION__, __FILE__, __LINE__ )
-extern void __quit_on_exception( void* e, const char *function, const char *file, int line_number );
+#define quit_on_exception( ex ) __quit_on_exception( (void *)(ex), __FUNCTION__, __FILE__, __LINE__ )
+extern void __quit_on_exception( void * e, const char * function, const char * file, int line_number );

+ 6 - 9
Sources/VLCLibrary.m

@@ -28,12 +28,12 @@
 #include <vlc/vlc.h>
 #include <vlc/vlc.h>
 #include <vlc/libvlc_structures.h>
 #include <vlc/libvlc_structures.h>
 
 
-static VLCLibrary *sharedLibrary = nil;
+static VLCLibrary * sharedLibrary = nil;
 
 
 // TODO: Change from a terminal error to raising an exception?
 // TODO: Change from a terminal error to raising an exception?
 void __quit_on_exception( void * e, const char * function, const char * file, int line_number )
 void __quit_on_exception( void * e, const char * function, const char * file, int line_number )
 {
 {
-    libvlc_exception_t *ex = (libvlc_exception_t *)e;
+    libvlc_exception_t * ex = (libvlc_exception_t *)e;
     if (libvlc_exception_raised( ex ))
     if (libvlc_exception_raised( ex ))
     {
     {
         /* XXX: localization */
         /* XXX: localization */
@@ -62,7 +62,7 @@ static void * DestroySharedLibraryAtExit( void )
         sharedLibrary = [[self alloc] init];
         sharedLibrary = [[self alloc] init];
         
         
         /* Make sure, this will get released at some point */
         /* Make sure, this will get released at some point */
-        atexit( (void*)DestroySharedLibraryAtExit );
+        atexit( (void *)DestroySharedLibraryAtExit );
     }
     }
     return [[sharedLibrary retain] autorelease];
     return [[sharedLibrary retain] autorelease];
 }
 }
@@ -74,7 +74,7 @@ static void * DestroySharedLibraryAtExit( void )
         libvlc_exception_t ex;
         libvlc_exception_t ex;
         libvlc_exception_init( &ex );
         libvlc_exception_init( &ex );
         
         
-        const char *lib_vlc_params[] = { 
+        const char * lib_vlc_params[] = { 
             "-I", "dummy", "--vout=opengllayer", 
             "-I", "dummy", "--vout=opengllayer", 
             "--no-video-title-show"
             "--no-video-title-show"
         };
         };
@@ -102,16 +102,13 @@ static void * DestroySharedLibraryAtExit( void )
     [super dealloc];
     [super dealloc];
 }
 }
 
 
-- (VLCAudio *)audio
-{
-    return audio;
-}
+@synthesize audio;
 @end
 @end
 
 
 @implementation VLCLibrary (VLCLibVLCBridging)
 @implementation VLCLibrary (VLCLibVLCBridging)
 + (void *)sharedInstance
 + (void *)sharedInstance
 {
 {
-    return [[self sharedLibrary] instance];
+    return [self sharedLibrary].instance;
 }
 }
 
 
 - (void *)instance
 - (void *)instance