Commit 3e27f238 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCMediaLibrary: Code cleanup and use Objective-C 2.0...

MacOSX/Framework/VLCMediaLibrary: Code cleanup and use Objective-C 2.0 @property. (Patch by Enrique Osuna).
parent 70e77275
...@@ -27,12 +27,17 @@ ...@@ -27,12 +27,17 @@
@class VLCMediaList; @class VLCMediaList;
/**
* TODO: Documentation
*/
@interface VLCMediaLibrary : NSObject @interface VLCMediaLibrary : NSObject
{ {
void * mlib; void * mlib;
VLCMediaList * allMedia; VLCMediaList * allMedia;
} }
/* Singleton */
+ (id)sharedMediaLibrary; + (id)sharedMediaLibrary;
- (VLCMediaList *)allMedia; /* Properties */
@property (readonly) VLCMediaList * allMedia;
@end @end
...@@ -29,12 +29,11 @@ ...@@ -29,12 +29,11 @@
#include <vlc/libvlc.h> #include <vlc/libvlc.h>
static VLCMediaLibrary * sharedMediaLibrary = nil;
@implementation VLCMediaLibrary @implementation VLCMediaLibrary
+ (id)sharedMediaLibrary + (id)sharedMediaLibrary
{ {
if(!sharedMediaLibrary) static VLCMediaLibrary * sharedMediaLibrary = nil;
if( !sharedMediaLibrary )
{ {
sharedMediaLibrary = [[VLCMediaLibrary alloc] init]; sharedMediaLibrary = [[VLCMediaLibrary alloc] init];
} }
...@@ -50,8 +49,9 @@ static VLCMediaLibrary * sharedMediaLibrary = nil; ...@@ -50,8 +49,9 @@ static VLCMediaLibrary * sharedMediaLibrary = nil;
mlib = libvlc_media_library_new( [VLCLibrary sharedInstance], &p_e ); mlib = libvlc_media_library_new( [VLCLibrary sharedInstance], &p_e );
quit_on_exception( &p_e ); quit_on_exception( &p_e );
libvlc_media_library_load(mlib, &p_e); libvlc_media_library_load( mlib, &p_e );
quit_on_exception(&p_e); quit_on_exception( &p_e );
allMedia = nil; allMedia = nil;
} }
return self; return self;
...@@ -69,10 +69,10 @@ static VLCMediaLibrary * sharedMediaLibrary = nil; ...@@ -69,10 +69,10 @@ static VLCMediaLibrary * sharedMediaLibrary = nil;
- (VLCMediaList *)allMedia - (VLCMediaList *)allMedia
{ {
if (!allMedia) if( !allMedia )
{ {
libvlc_media_list_t *p_mlist = libvlc_media_library_media_list(mlib, NULL); libvlc_media_list_t * p_mlist = libvlc_media_library_media_list( mlib, NULL );
allMedia = [[VLCMediaList mediaListWithLibVLCMediaList: p_mlist] retain]; allMedia = [[VLCMediaList mediaListWithLibVLCMediaList:p_mlist] retain];
libvlc_media_list_release(p_mlist); libvlc_media_list_release(p_mlist);
} }
return allMedia; return allMedia;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment