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 @@
@class VLCMediaList;
/**
* TODO: Documentation
*/
@interface VLCMediaLibrary : NSObject
{
void * mlib;
VLCMediaList * allMedia;
}
/* Singleton */
+ (id)sharedMediaLibrary;
- (VLCMediaList *)allMedia;
/* Properties */
@property (readonly) VLCMediaList * allMedia;
@end
......@@ -29,12 +29,11 @@
#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;
......
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