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

index 24a7221..1381677 100644 (file)
 
 @class VLCMediaList;
 
+/**
+ * TODO: Documentation
+ */
 @interface VLCMediaLibrary : NSObject
 {
     void * mlib;
     VLCMediaList * allMedia;
 }
+/* Singleton */
 + (id)sharedMediaLibrary;
 
-- (VLCMediaList *)allMedia;
+/* Properties */
+@property (readonly) VLCMediaList * allMedia;
 @end
index 869db75..19b1e21 100644 (file)
 
 #include <vlc/libvlc.h>
 
-static VLCMediaLibrary * sharedMediaLibrary = nil;
-
 @implementation VLCMediaLibrary
 + (id)sharedMediaLibrary
 {
-    if(!sharedMediaLibrary)
+    static VLCMediaLibrary * sharedMediaLibrary = nil;
+    if( !sharedMediaLibrary )
     {
         sharedMediaLibrary = [[VLCMediaLibrary alloc] init];
     }
@@ -50,8 +49,9 @@ static VLCMediaLibrary * sharedMediaLibrary = nil;
         mlib = libvlc_media_library_new( [VLCLibrary sharedInstance], &p_e );
         quit_on_exception( &p_e );
         
-        libvlc_media_library_load(mlib, &p_e);
-        quit_on_exception(&p_e);
+        libvlc_media_library_load( mlib, &p_e );
+        quit_on_exception( &p_e );
+        
         allMedia = nil;
     }
     return self;
@@ -69,10 +69,10 @@ static VLCMediaLibrary * sharedMediaLibrary = nil;
 
 - (VLCMediaList *)allMedia
 {
-    if (!allMedia)
+    if( !allMedia )
     {
-        libvlc_media_list_t *p_mlist = libvlc_media_library_media_list(mlib, NULL);
-        allMedia = [[VLCMediaList mediaListWithLibVLCMediaList: p_mlist] retain];
+        libvlc_media_list_t * p_mlist = libvlc_media_library_media_list( mlib, NULL );
+        allMedia = [[VLCMediaList mediaListWithLibVLCMediaList:p_mlist] retain];
         libvlc_media_list_release(p_mlist);
     }
     return allMedia;