Commit 1ce75d25 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCLibrary: Code cleanup and use Objective-C 2.0 @property....

MacOSX/Framework/VLCLibrary: Code cleanup and use Objective-C 2.0 @property. (Patch by Enrique Osuna).
parent 3767759a
...@@ -29,26 +29,32 @@ ...@@ -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; void * instance;
VLCAudio *audio; 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__ ) #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 ); extern void __quit_on_exception( void * e, const char * function, const char * file, int line_number );
...@@ -28,12 +28,12 @@ ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -102,16 +102,13 @@ static void * DestroySharedLibraryAtExit( void )
[super dealloc]; [super dealloc];
} }
- (VLCAudio *)audio @synthesize audio;
{
return 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
......
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