MacOSX/Framework/VLCLibrary: Code cleanup and use Objective-C 2.0 @property. (Patch...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Wed, 2 Jan 2008 02:34:32 +0000 (02:34 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Wed, 2 Jan 2008 02:34:32 +0000 (02:34 +0000)
extras/MacOSX/Framework/Headers/Internal/VLCLibrary.h
extras/MacOSX/Framework/Sources/VLCLibrary.m

index 237a63b..aa5f12c 100644 (file)
 
 @class VLCAudio;
 
-/*
+/**
  * VLCLibrary object.
+ * TODO: Documentation VLCLibrary
  */
-// TODO: Documentation
 @interface VLCLibrary : NSObject 
 {
-    void *instance;
-    VLCAudio *audio;
+    void * instance;
+    VLCAudio * audio;
 }
 
 /* Factories */
+/**
+ * TODO: Documentation + [VLCLibrary sharedLibrary]
+ */
 + (VLCLibrary *)sharedLibrary;
 
 /* Properties */
-- (VLCAudio *)audio;
+/**
+ * TODO: Documentation VLCLibrary.audio
+ */
+@property (readonly) VLCAudio * audio;
 @end
 
 /*
  * Utility function
  */
 // 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 );
index 2288182..616ee83 100644 (file)
 #include <vlc/vlc.h>
 #include <vlc/libvlc_structures.h>
 
-static VLCLibrary *sharedLibrary = nil;
+static VLCLibrary * sharedLibrary = nil;
 
 // 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 )
 {
-    libvlc_exception_t *ex = (libvlc_exception_t *)e;
+    libvlc_exception_t * ex = (libvlc_exception_t *)e;
     if (libvlc_exception_raised( ex ))
     {
         /* XXX: localization */
@@ -62,7 +62,7 @@ static void * DestroySharedLibraryAtExit( void )
         sharedLibrary = [[self alloc] init];
         
         /* Make sure, this will get released at some point */
-        atexit( (void*)DestroySharedLibraryAtExit );
+        atexit( (void *)DestroySharedLibraryAtExit );
     }
     return [[sharedLibrary retain] autorelease];
 }
@@ -74,7 +74,7 @@ static void * DestroySharedLibraryAtExit( void )
         libvlc_exception_t ex;
         libvlc_exception_init( &ex );
         
-        const char *lib_vlc_params[] = { 
+        const char * lib_vlc_params[] = { 
             "-I", "dummy", "--vout=opengllayer", 
             "--no-video-title-show"
         };
@@ -102,16 +102,13 @@ static void * DestroySharedLibraryAtExit( void )
     [super dealloc];
 }
 
-- (VLCAudio *)audio
-{
-    return audio;
-}
+@synthesize audio;
 @end
 
 @implementation VLCLibrary (VLCLibVLCBridging)
 + (void *)sharedInstance
 {
-    return [[self sharedLibrary] instance];
+    return [self sharedLibrary].instance;
 }
 
 - (void *)instance