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 @@
@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 );
......@@ -28,12 +28,12 @@
#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
......
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