Commit 6dda19c8 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework: Very minor identation changes.

parent 702edfe8
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
@interface VLCMediaLibrary : NSObject @interface VLCMediaLibrary : NSObject
{ {
void *mlib; void * mlib;
VLCMediaList *allMedia; VLCMediaList * allMedia;
} }
+ (id)sharedMediaLibrary; + (id)sharedMediaLibrary;
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
#import "VLCMedia.h" #import "VLCMedia.h"
/* Notification Messages */ /* Notification Messages */
extern NSString *VLCMediaListItemAdded; extern NSString * VLCMediaListItemAdded;
extern NSString *VLCMediaListItemDeleted; extern NSString * VLCMediaListItemDeleted;
@class VLCMedia; @class VLCMedia;
@class VLCMediaList; @class VLCMediaList;
...@@ -59,7 +59,7 @@ extern NSString *VLCMediaListItemDeleted; ...@@ -59,7 +59,7 @@ extern NSString *VLCMediaListItemDeleted;
- (int)indexOfMedia:(VLCMedia *)media; - (int)indexOfMedia:(VLCMedia *)media;
- (int)count; - (int)count;
#if 0 /* Disabled until this get fixed in libvlc #if 0 /* Disabled until this get fixed in libvlc */
- (NSArray *)sublists; //< A way to see the same media list. Only sub media list. - (NSArray *)sublists; //< A way to see the same media list. Only sub media list.
- (NSArray *)flatMediaView; //< A way to see the same media list. Only media. - (NSArray *)flatMediaView; //< A way to see the same media list. Only media.
- (VLCMedia *)providerMedia; //< If a media was at the origin of this media list, here it is. - (VLCMedia *)providerMedia; //< If a media was at the origin of this media list, here it is.
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#import "VLCMedia.h" #import "VLCMedia.h"
/* Notification Messages */ /* Notification Messages */
extern NSString *VLCMediaPlayerTimeChanged; extern NSString * VLCMediaPlayerTimeChanged;
extern NSString *VLCMediaPlayerStateChanged; extern NSString * VLCMediaPlayerStateChanged;
// TODO: Documentation // TODO: Documentation
typedef enum VLCMediaPlayerState typedef enum VLCMediaPlayerState
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
/* Notifications */ /* Notifications */
extern NSString *VLCVideoViewEnteredFullScreen; extern NSString * VLCVideoViewEnteredFullScreen;
extern NSString *VLCVideoViewLeftFullScreen; extern NSString * VLCVideoViewLeftFullScreen;
@protocol VLCVideoViewDelegate @protocol VLCVideoViewDelegate
// Notifications defined in VLCVideoView.h // Notifications defined in VLCVideoView.h
...@@ -49,7 +49,7 @@ extern NSString *VLCVideoViewLeftFullScreen; ...@@ -49,7 +49,7 @@ extern NSString *VLCVideoViewLeftFullScreen;
@interface VLCVideoView : NSView <VLCOpenGLVoutEmbedding> @interface VLCVideoView : NSView <VLCOpenGLVoutEmbedding>
{ {
id delegate; id delegate;
NSColor *backColor; NSColor * backColor;
BOOL stretchesVideo; BOOL stretchesVideo;
// TODO: Allow for view to report transparency to do some cool effects // TODO: Allow for view to report transparency to do some cool effects
......
...@@ -37,7 +37,7 @@ void __quit_on_exception( void * e, const char * function, const char * file, in ...@@ -37,7 +37,7 @@ void __quit_on_exception( void * e, const char * function, const char * file, in
{ {
/* XXX: localization */ /* XXX: localization */
NSRunCriticalAlertPanel( @"Error", [NSString stringWithFormat:@"libvlc has thrown us an error: %s (%s:%d %s)", NSRunCriticalAlertPanel( @"Error", [NSString stringWithFormat:@"libvlc has thrown us an error: %s (%s:%d %s)",
libvlc_exception_get_message(ex), file, line_number, function], @"Quit", nil, nil ); libvlc_exception_get_message( ex ), file, line_number, function], @"Quit", nil, nil );
exit( ex->i_code ); exit( ex->i_code );
} }
} }
...@@ -61,7 +61,7 @@ static void *DestroySharedLibraryAtExit() ...@@ -61,7 +61,7 @@ static void *DestroySharedLibraryAtExit()
[[self alloc] init]; [[self alloc] init];
// Register a function to gracefully destroy the shared library on exit. // Register a function to gracefully destroy the shared library on exit.
atexit((void*)DestroySharedLibraryAtExit); atexit( (void*)DestroySharedLibraryAtExit );
} }
return sharedLibrary; return sharedLibrary;
} }
...@@ -79,8 +79,8 @@ static void *DestroySharedLibraryAtExit() ...@@ -79,8 +79,8 @@ static void *DestroySharedLibraryAtExit()
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
// Figure out the frameworks path // Figure out the frameworks path
char *applicationPath = strdup([[NSString stringWithFormat:@"%@/Versions/Current/VLC", char *applicationPath = strdup( [[NSString stringWithFormat:@"%@/Versions/Current/VLC",
[[NSBundle bundleForClass:[VLCLibrary class]] bundlePath]] UTF8String]); [[NSBundle bundleForClass:[VLCLibrary class]] bundlePath]] UTF8String] );
// TODO: Raise error if there is no memory available // TODO: Raise error if there is no memory available
char *lib_vlc_params[] = { char *lib_vlc_params[] = {
...@@ -89,7 +89,7 @@ static void *DestroySharedLibraryAtExit() ...@@ -89,7 +89,7 @@ static void *DestroySharedLibraryAtExit()
"--no-video-title-show", NULL "--no-video-title-show", NULL
}; };
instance = (void *)libvlc_new(7, lib_vlc_params, &ex); instance = (void *)libvlc_new( 7, lib_vlc_params, &ex );
quit_on_exception( &ex ); quit_on_exception( &ex );
if (!sharedLibrary) if (!sharedLibrary)
...@@ -99,7 +99,7 @@ static void *DestroySharedLibraryAtExit() ...@@ -99,7 +99,7 @@ static void *DestroySharedLibraryAtExit()
/*audio = */ [[VLCAudio alloc] initWithLibrary:self]; /*audio = */ [[VLCAudio alloc] initWithLibrary:self];
// free allocated resources // free allocated resources
free(applicationPath); free( applicationPath );
} }
return self; return self;
} }
...@@ -114,9 +114,9 @@ static void *DestroySharedLibraryAtExit() ...@@ -114,9 +114,9 @@ static void *DestroySharedLibraryAtExit()
if (instance) if (instance)
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
libvlc_destroy(instance, &ex); libvlc_destroy( instance, &ex );
} }
} }
@finally @finally
......
...@@ -219,7 +219,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) ...@@ -219,7 +219,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
[subitems release]; [subitems release];
[metaDictionary release]; [metaDictionary release];
libvlc_media_descriptor_release(p_md); libvlc_media_descriptor_release( p_md );
[super dealloc]; [super dealloc];
} }
...@@ -257,7 +257,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) ...@@ -257,7 +257,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
if (!length) if (!length)
{ {
// Try figuring out what the length is // Try figuring out what the length is
long long duration = libvlc_media_descriptor_get_duration(p_md, NULL); long long duration = libvlc_media_descriptor_get_duration( p_md, NULL );
if (duration > -1) if (duration > -1)
{ {
[self setLength:[VLCTime timeWithNumber:[NSNumber numberWithLongLong:duration]]]; [self setLength:[VLCTime timeWithNumber:[NSNumber numberWithLongLong:duration]]];
...@@ -278,7 +278,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) ...@@ -278,7 +278,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
{ {
while (!length && ![self isPreparsed] && [aDate timeIntervalSinceNow] > 0) while (!length && ![self isPreparsed] && [aDate timeIntervalSinceNow] > 0)
{ {
usleep(THREAD_SLEEP); usleep( THREAD_SLEEP );
} }
// So we're done waiting, but sometimes we trap the fact that the parsing // So we're done waiting, but sometimes we trap the fact that the parsing
...@@ -294,7 +294,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) ...@@ -294,7 +294,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
- (BOOL)isPreparsed - (BOOL)isPreparsed
{ {
return libvlc_media_descriptor_is_preparsed(p_md, NULL); return libvlc_media_descriptor_is_preparsed( p_md, NULL );
} }
- (NSDictionary *)metaDictionary - (NSDictionary *)metaDictionary
...@@ -320,10 +320,10 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) ...@@ -320,10 +320,10 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
VLCMedia *media = (VLCMedia *)libvlc_media_descriptor_get_user_data(md, &ex); VLCMedia *media = (VLCMedia *)libvlc_media_descriptor_get_user_data( md, &ex );
if (!media || libvlc_exception_raised(&ex)) if (!media || libvlc_exception_raised( &ex ))
{ {
libvlc_exception_clear(&ex); libvlc_exception_clear( &ex );
return [[[VLCMedia alloc] initWithLibVLCMediaDescriptor:md] autorelease]; return [[[VLCMedia alloc] initWithLibVLCMediaDescriptor:md] autorelease];
} }
else else
...@@ -344,18 +344,18 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) ...@@ -344,18 +344,18 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
{ {
return [self retain]; return [self retain];
} }
libvlc_exception_clear(&ex); // Just in case an exception was raised, lets release it libvlc_exception_clear( &ex ); // Just in case an exception was raised, lets release it
if (self = [super init]) if (self = [super init])
{ {
char * p_url; char * p_url;
p_url = libvlc_media_descriptor_get_mrl(md, &ex); p_url = libvlc_media_descriptor_get_mrl( md, &ex );
quit_on_exception( &ex ); quit_on_exception( &ex );
url = [NSString stringWithCString:p_url]; url = [NSString stringWithCString:p_url];
libvlc_media_descriptor_retain(md); libvlc_media_descriptor_retain( md );
p_md = md; p_md = md;
[self initInternalMediaDescriptor]; [self initInternalMediaDescriptor];
...@@ -419,27 +419,27 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) ...@@ -419,27 +419,27 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
- (void)initInternalMediaDescriptor - (void)initInternalMediaDescriptor
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
libvlc_media_descriptor_set_user_data(p_md, (void*)self, &ex); libvlc_media_descriptor_set_user_data( p_md, (void*)self, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
// TODO: Should these events be caught by VLCMediaList's notification hooks? // TODO: Should these events be caught by VLCMediaList's notification hooks?
libvlc_event_manager_t *p_em = libvlc_media_descriptor_event_manager(p_md, &ex); libvlc_event_manager_t *p_em = libvlc_media_descriptor_event_manager( p_md, &ex );
// libvlc_event_attach(p_em, libvlc_MediaDescriptorSubItemAdded, HandleMediaSubItemAdded, self, &ex); // libvlc_event_attach(p_em, libvlc_MediaDescriptorSubItemAdded, HandleMediaSubItemAdded, self, &ex);
// libvlc_event_attach(p_em, libvlc_MediaDescriptorSubItemRemoved, HandleMediaSubItemRemoved, self, &ex); // libvlc_event_attach(p_em, libvlc_MediaDescriptorSubItemRemoved, HandleMediaSubItemRemoved, self, &ex);
// libvlc_event_attach(p_em, libvlc_MediaDescriptorMetaChanged, HandleMediaMetaChanged, self, &ex); // libvlc_event_attach(p_em, libvlc_MediaDescriptorMetaChanged, HandleMediaMetaChanged, self, &ex);
// libvlc_event_attach(p_em, libvlc_MediaDescriptorDurationChanged, HandleMediaDurationChanged, self, &ex); // libvlc_event_attach(p_em, libvlc_MediaDescriptorDurationChanged, HandleMediaDurationChanged, self, &ex);
quit_on_exception(&ex); quit_on_exception( &ex );
libvlc_media_list_t *p_mlist = libvlc_media_descriptor_subitems(p_md, NULL); libvlc_media_list_t *p_mlist = libvlc_media_descriptor_subitems( p_md, NULL );
if (!p_mlist) if (!p_mlist)
subitems = nil; subitems = nil;
else else
{ {
[subitems release]; [subitems release];
subitems = [[VLCMediaList medialistWithLibVLCMediaList:p_mlist] retain]; subitems = [[VLCMediaList medialistWithLibVLCMediaList:p_mlist] retain];
libvlc_media_list_release(p_mlist); libvlc_media_list_release( p_mlist );
} }
[self fetchMetaInformation]; [self fetchMetaInformation];
} }
...@@ -471,7 +471,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) ...@@ -471,7 +471,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
} }
result = YES; result = YES;
} }
free(value); free( value );
return result; return result;
} }
...@@ -480,9 +480,9 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) ...@@ -480,9 +480,9 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
// TODO: Only fetch meta data that has been requested. Just don't fetch // TODO: Only fetch meta data that has been requested. Just don't fetch
// it, just because. // it, just because.
[self setMetaValue:libvlc_media_descriptor_get_meta(p_md, libvlc_meta_Title, NULL) forKey:[VLCMedia metaTypeToString:libvlc_meta_Title]]; [self setMetaValue:libvlc_media_descriptor_get_meta( p_md, libvlc_meta_Title, NULL ) forKey:[VLCMedia metaTypeToString:libvlc_meta_Title]];
[self setMetaValue:libvlc_media_descriptor_get_meta(p_md, libvlc_meta_Artist, NULL) forKey:[VLCMedia metaTypeToString:libvlc_meta_Artist]]; [self setMetaValue:libvlc_media_descriptor_get_meta( p_md, libvlc_meta_Artist, NULL ) forKey:[VLCMedia metaTypeToString:libvlc_meta_Artist]];
[self setMetaValue:libvlc_media_descriptor_get_meta(p_md, libvlc_meta_ArtworkURL, NULL) forKey:[VLCMedia metaTypeToString:libvlc_meta_ArtworkURL]]; [self setMetaValue:libvlc_media_descriptor_get_meta( p_md, libvlc_meta_ArtworkURL, NULL ) forKey:[VLCMedia metaTypeToString:libvlc_meta_ArtworkURL]];
} }
- (void)fetchMetaInformationForArtWorkWithURL:(NSString *)anURL - (void)fetchMetaInformationForArtWorkWithURL:(NSString *)anURL
......
...@@ -84,7 +84,7 @@ static VLCMediaLibrary * sharedMediaLibrary = nil; ...@@ -84,7 +84,7 @@ static VLCMediaLibrary * sharedMediaLibrary = nil;
{ {
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 );
VLCMediaList *medialist = [VLCMediaList medialistWithLibVLCMediaList:p_mlist]; VLCMediaList *medialist = [VLCMediaList medialistWithLibVLCMediaList:p_mlist];
libvlc_media_list_release(p_mlist); libvlc_media_list_release( p_mlist );
NSArray *ret = [medialist sublists]; NSArray *ret = [medialist sublists];
return ret; return ret;
......
...@@ -124,12 +124,12 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -124,12 +124,12 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (void)lock - (void)lock
{ {
libvlc_media_list_lock(p_mlist); libvlc_media_list_lock( p_mlist );
} }
- (void)unlock - (void)unlock
{ {
libvlc_media_list_unlock(p_mlist); libvlc_media_list_unlock( p_mlist );
} }
- (int)addMedia:(VLCMedia *)media - (int)addMedia:(VLCMedia *)media
...@@ -146,8 +146,8 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -146,8 +146,8 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
// Add it to the libvlc's medialist // Add it to the libvlc's medialist
libvlc_exception_t p_e; libvlc_exception_t p_e;
libvlc_exception_init( &p_e ); libvlc_exception_init( &p_e );
libvlc_media_list_insert_media_descriptor(p_mlist, [media libVLCMediaDescriptor], index, &p_e); libvlc_media_list_insert_media_descriptor( p_mlist, [media libVLCMediaDescriptor], index, &p_e );
quit_on_exception(&p_e); quit_on_exception( &p_e );
} }
- (void)removeMediaAtIndex:(int)index - (void)removeMediaAtIndex:(int)index
...@@ -156,17 +156,17 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -156,17 +156,17 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
// Remove it from the libvlc's medialist // Remove it from the libvlc's medialist
libvlc_exception_t p_e; libvlc_exception_t p_e;
libvlc_exception_init(&p_e); libvlc_exception_init( &p_e );
libvlc_media_list_remove_index(p_mlist, index, &p_e); libvlc_media_list_remove_index( p_mlist, index, &p_e );
quit_on_exception(&p_e); quit_on_exception( &p_e );
} }
- (VLCMedia *)mediaAtIndex:(int)index - (VLCMedia *)mediaAtIndex:(int)index
{ {
libvlc_exception_t p_e; libvlc_exception_t p_e;
libvlc_exception_init(&p_e); libvlc_exception_init( &p_e );
libvlc_media_descriptor_t *p_md = libvlc_media_list_item_at_index(p_mlist, index, &p_e); libvlc_media_descriptor_t *p_md = libvlc_media_list_item_at_index( p_mlist, index, &p_e );
quit_on_exception(&p_e); quit_on_exception( &p_e );
// Returns local object for media descriptor, searchs for user data first. If not found it creates a // Returns local object for media descriptor, searchs for user data first. If not found it creates a
// new cocoa object representation of the media descriptor. // new cocoa object representation of the media descriptor.
...@@ -176,9 +176,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -176,9 +176,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (int)count - (int)count
{ {
libvlc_exception_t p_e; libvlc_exception_t p_e;
libvlc_exception_init(&p_e); libvlc_exception_init( &p_e );
int result = libvlc_media_list_count(p_mlist, &p_e); int result = libvlc_media_list_count( p_mlist, &p_e );
quit_on_exception(&p_e); quit_on_exception( &p_e );
return result; return result;
} }
...@@ -186,9 +186,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -186,9 +186,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (int)indexOfMedia:(VLCMedia *)media - (int)indexOfMedia:(VLCMedia *)media
{ {
libvlc_exception_t p_e; libvlc_exception_t p_e;
libvlc_exception_init(&p_e); libvlc_exception_init( &p_e );
int result = libvlc_media_list_index_of_item(p_mlist, [media libVLCMediaDescriptor], &p_e); int result = libvlc_media_list_index_of_item( p_mlist, [media libVLCMediaDescriptor], &p_e );
quit_on_exception(&p_e); quit_on_exception( &p_e );
return result; return result;
} }
...@@ -199,22 +199,22 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -199,22 +199,22 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
int i, count; int i, count;
libvlc_exception_t p_e; libvlc_exception_t p_e;
libvlc_exception_init(&p_e); libvlc_exception_init( &p_e );
count = libvlc_media_list_count(p_mlist, &p_e); count = libvlc_media_list_count( p_mlist, &p_e );
quit_on_exception(&p_e); quit_on_exception( &p_e );
for(i = 0; i < count; i++) for(i = 0; i < count; i++)
{ {
libvlc_media_descriptor_t *p_md; libvlc_media_descriptor_t *p_md;
libvlc_media_list_t *p_submlist; libvlc_media_list_t *p_submlist;
p_md = libvlc_media_list_item_at_index(p_mlist, i, NULL); p_md = libvlc_media_list_item_at_index( p_mlist, i, NULL );
p_submlist = libvlc_media_descriptor_subitems(p_md, NULL); p_submlist = libvlc_media_descriptor_subitems( p_md, NULL );
if(p_submlist) if (p_submlist)
{ {
[ret addObject:[VLCMediaList medialistWithLibVLCMediaList:p_submlist]]; [ret addObject:[VLCMediaList medialistWithLibVLCMediaList:p_submlist]];
libvlc_media_list_release(p_submlist); libvlc_media_list_release( p_submlist );
} }
libvlc_media_descriptor_release(p_md); libvlc_media_descriptor_release( p_md );
} }
return [ret autorelease]; return [ret autorelease];
} }
...@@ -275,9 +275,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -275,9 +275,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
libvlc_exception_t p_e; libvlc_exception_t p_e;
libvlc_exception_init(&p_e); libvlc_exception_init(&p_e);
libvlc_event_manager_t *p_em = libvlc_media_list_event_manager(p_mlist, &p_e); libvlc_event_manager_t *p_em = libvlc_media_list_event_manager( p_mlist, &p_e );
libvlc_event_attach(p_em, libvlc_MediaListItemAdded, HandleMediaListItemAdded, self, &p_e); libvlc_event_attach( p_em, libvlc_MediaListItemAdded, HandleMediaListItemAdded, self, &p_e );
libvlc_event_attach(p_em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self, &p_e); libvlc_event_attach( p_em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self, &p_e );
[self unlock]; [self unlock];
quit_on_exception( &p_e ); quit_on_exception( &p_e );
......
...@@ -94,9 +94,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state) ...@@ -94,9 +94,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
// it will change depending on the media descriptor provided to the media // it will change depending on the media descriptor provided to the media
// instance // instance
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
instance = (void *)libvlc_media_instance_new([VLCLibrary sharedInstance], &ex); instance = (void *)libvlc_media_instance_new([VLCLibrary sharedInstance], &ex);
quit_on_exception(&ex); quit_on_exception( &ex );
[self registerObservers]; [self registerObservers];
...@@ -139,11 +139,11 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state) ...@@ -139,11 +139,11 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
// Make sure that this instance has been associated with the drawing canvas. // Make sure that this instance has been associated with the drawing canvas.
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
libvlc_media_instance_set_drawable ((libvlc_media_instance_t *)instance, libvlc_media_instance_set_drawable ((libvlc_media_instance_t *)instance,
(libvlc_drawable_t)videoView, (libvlc_drawable_t)videoView,
&ex); &ex);
quit_on_exception(&ex); quit_on_exception( &ex );
} }
- (VLCVideoView *)videoView - (VLCVideoView *)videoView
...@@ -159,100 +159,100 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state) ...@@ -159,100 +159,100 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
- (BOOL)fullscreen - (BOOL)fullscreen
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
int result = libvlc_get_fullscreen(instance, &ex); int result = libvlc_get_fullscreen( instance, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
return result; return result;
} }
- (void)setVideoAspectRatio:(char *)value - (void)setVideoAspectRatio:(char *)value
{ {
libvlc_video_set_aspect_ratio(instance, value, NULL); libvlc_video_set_aspect_ratio( instance, value, NULL );
} }
- (char *)videoAspectRatio - (char *)videoAspectRatio
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
char *result = libvlc_video_get_aspect_ratio(instance, &ex); char *result = libvlc_video_get_aspect_ratio( instance, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
return result; return result;
} }
- (void)setVideoSubTitles:(int)value - (void)setVideoSubTitles:(int)value
{ {
libvlc_video_set_spu(instance, value, NULL); libvlc_video_set_spu( instance, value, NULL );
} }
- (int)videoSubTitles - (int)videoSubTitles
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
int result = libvlc_video_get_spu(instance, &ex); int result = libvlc_video_get_spu( instance, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
return result; return result;
} }
- (void)setVideoCropGeometry:(char *)value - (void)setVideoCropGeometry:(char *)value
{ {
libvlc_video_set_crop_geometry(instance, value, NULL); libvlc_video_set_crop_geometry( instance, value, NULL );
} }
- (char *)videoCropGeometry - (char *)videoCropGeometry
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
char *result = libvlc_video_get_crop_geometry(instance, &ex); char *result = libvlc_video_get_crop_geometry( instance, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
return result; return result;
} }
- (void)setVideoTeleText:(int)value - (void)setVideoTeleText:(int)value
{ {
libvlc_video_set_teletext(instance, value, NULL); libvlc_video_set_teletext( instance, value, NULL );
} }
- (int)videoTeleText - (int)videoTeleText
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
int result = libvlc_video_get_teletext(instance, &ex); int result = libvlc_video_get_teletext( instance, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
return result; return result;
} }
- (void)setRate:(int)value - (void)setRate:(int)value
{ {
libvlc_media_instance_set_rate(instance, value, NULL); libvlc_media_instance_set_rate( instance, value, NULL );
} }
- (int)rate - (int)rate
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
float result = libvlc_media_instance_get_rate(instance, &ex); float result = libvlc_media_instance_get_rate( instance, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
return result; return result;
} }
- (NSSize)videoSize - (NSSize)videoSize
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
NSSize result = NSMakeSize(libvlc_video_get_height((libvlc_media_instance_t *)instance, &ex), NSSize result = NSMakeSize(libvlc_video_get_height((libvlc_media_instance_t *)instance, &ex),
libvlc_video_get_width((libvlc_media_instance_t *)instance, &ex)); libvlc_video_get_width((libvlc_media_instance_t *)instance, &ex));
quit_on_exception(&ex); quit_on_exception( &ex );
return result; return result;
} }
- (BOOL)hasVideoOut - (BOOL)hasVideoOut
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
BOOL result = libvlc_media_instance_has_vout((libvlc_media_instance_t *)instance, &ex); BOOL result = libvlc_media_instance_has_vout((libvlc_media_instance_t *)instance, &ex);
if (libvlc_exception_raised(&ex)) if (libvlc_exception_raised( &ex ))
{ {
libvlc_exception_clear(&ex); libvlc_exception_clear( &ex );
return NO; return NO;
} }
else else
...@@ -262,34 +262,34 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state) ...@@ -262,34 +262,34 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
- (float)framesPerSecond - (float)framesPerSecond
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
float result = libvlc_media_instance_get_fps((libvlc_media_instance_t *)instance, &ex); float result = libvlc_media_instance_get_fps( (libvlc_media_instance_t *)instance, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
return result; return result;
} }
- (void)setTime:(VLCTime *)value - (void)setTime:(VLCTime *)value
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
// Time is managed in seconds, while duration is managed in microseconds // Time is managed in seconds, while duration is managed in microseconds
// TODO: Redo VLCTime to provide value numberAsMilliseconds, numberAsMicroseconds, numberAsSeconds, numberAsMinutes, numberAsHours // TODO: Redo VLCTime to provide value numberAsMilliseconds, numberAsMicroseconds, numberAsSeconds, numberAsMinutes, numberAsHours
libvlc_media_instance_set_time((libvlc_media_instance_t *)instance, libvlc_media_instance_set_time( (libvlc_media_instance_t *)instance,
(value ? [[value numberValue] longLongValue] / 1000 : 0), (value ? [[value numberValue] longLongValue] / 1000 : 0),
&ex); &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
} }
- (VLCTime *)time - (VLCTime *)time
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
// Results are returned in seconds...duration is returned in milliseconds // Results are returned in seconds...duration is returned in milliseconds
long long time = libvlc_media_instance_get_time((libvlc_media_instance_t *)instance, &ex) * 1000; long long time = libvlc_media_instance_get_time( (libvlc_media_instance_t *)instance, &ex ) * 1000;
if (libvlc_exception_raised(&ex)) if (libvlc_exception_raised( &ex ))
{ {
libvlc_exception_clear(&ex); libvlc_exception_clear( &ex );
return [VLCTime nullTime]; // Error in obtaining the time, return a null time defintition (--:--:--) return [VLCTime nullTime]; // Error in obtaining the time, return a null time defintition (--:--:--)
} }
else else
...@@ -298,29 +298,29 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state) ...@@ -298,29 +298,29 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
- (void)setAudioTrack:(int)value - (void)setAudioTrack:(int)value
{ {
libvlc_audio_set_track(instance, value, NULL); libvlc_audio_set_track( instance, value, NULL );
} }
- (int)audioTrack - (int)audioTrack
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
int result = libvlc_audio_get_track(instance, &ex); int result = libvlc_audio_get_track( instance, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
return result; return result;
} }
- (void)setAudioChannel:(int)value - (void)setAudioChannel:(int)value
{ {
libvlc_audio_set_channel(instance, value, NULL); libvlc_audio_set_channel( instance, value, NULL );
} }
- (int)audioChannel - (int)audioChannel
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
int result = libvlc_audio_get_channel(instance, &ex); int result = libvlc_audio_get_channel( instance, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
return result; return result;
} }
...@@ -347,9 +347,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state) ...@@ -347,9 +347,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
[self didChangeValueForKey:@"media"]; [self didChangeValueForKey:@"media"];
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
libvlc_media_instance_set_media_descriptor(instance, [media libVLCMediaDescriptor], &ex); libvlc_media_instance_set_media_descriptor( instance, [media libVLCMediaDescriptor], &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
if (media) { if (media) {
if (wasPlaying) if (wasPlaying)
...@@ -370,10 +370,10 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state) ...@@ -370,10 +370,10 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
return [self isPlaying]; return [self isPlaying];
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
libvlc_media_instance_play((libvlc_media_instance_t *)instance, &ex); libvlc_media_instance_play( (libvlc_media_instance_t *)instance, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
return YES; return YES;
} }
...@@ -391,9 +391,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state) ...@@ -391,9 +391,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
// Pause the stream // Pause the stream
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
libvlc_media_instance_pause((libvlc_media_instance_t *)instance, &ex); libvlc_media_instance_pause( (libvlc_media_instance_t *)instance, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
// TODO: Should we record the time in case the media instance is destroyed // TODO: Should we record the time in case the media instance is destroyed
// then rebuilt? // then rebuilt?
...@@ -409,9 +409,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state) ...@@ -409,9 +409,9 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
// The following is not implemented in the core, should I fix it or just // The following is not implemented in the core, should I fix it or just
// compensate? // compensate?
// libvlc_exception_t ex; // libvlc_exception_t ex;
// libvlc_exception_init(&ex); // libvlc_exception_init( &ex );
// libvlc_media_instance_stop((libvlc_media_instance_t *)instance, &ex); // libvlc_media_instance_stop((libvlc_media_instance_t *)instance, &ex);
// quit_on_exception(&ex); // quit_on_exception( &ex );
// Pause and reposition to the begining of the stream. // Pause and reposition to the begining of the stream.
[self pause]; [self pause];
...@@ -434,8 +434,8 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state) ...@@ -434,8 +434,8 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
- (BOOL)willPlay - (BOOL)willPlay
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
BOOL ret = libvlc_media_instance_will_play((libvlc_media_instance_t *)instance, &ex); BOOL ret = libvlc_media_instance_will_play( (libvlc_media_instance_t *)instance, &ex );
if (libvlc_exception_raised(&ex)) if (libvlc_exception_raised(&ex))
{ {
libvlc_exception_clear(&ex); libvlc_exception_clear(&ex);
...@@ -445,15 +445,15 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state) ...@@ -445,15 +445,15 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
return ret; return ret;
} }
static VLCMediaPlayerState libvlc_to_local_state [] = static VLCMediaPlayerState libvlc_to_local_state[] =
{ {
[libvlc_Stopped] = VLCMediaPlayerStateStopped, [libvlc_Stopped] = VLCMediaPlayerStateStopped,
[libvlc_Opening] = VLCMediaPlayerStateOpening, [libvlc_Opening] = VLCMediaPlayerStateOpening,
[libvlc_Buffering] = VLCMediaPlayerStateBuffering, [libvlc_Buffering] = VLCMediaPlayerStateBuffering,
[libvlc_Playing] = VLCMediaPlayerStatePlaying, [libvlc_Playing] = VLCMediaPlayerStatePlaying,
[libvlc_Paused] = VLCMediaPlayerStatePaused, [libvlc_Paused] = VLCMediaPlayerStatePaused,
[libvlc_Ended] = VLCMediaPlayerStateEnded, [libvlc_Ended] = VLCMediaPlayerStateEnded,
[libvlc_Error] = VLCMediaPlayerStateError [libvlc_Error] = VLCMediaPlayerStateError
}; };
- (VLCMediaPlayerState)state - (VLCMediaPlayerState)state
...@@ -463,11 +463,11 @@ static VLCMediaPlayerState libvlc_to_local_state [] = ...@@ -463,11 +463,11 @@ static VLCMediaPlayerState libvlc_to_local_state [] =
return VLCMediaPlayerStateStopped; return VLCMediaPlayerStateStopped;
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
libvlc_state_t libvlc_state = libvlc_media_instance_get_state((libvlc_media_instance_t *)instance, &ex); libvlc_state_t libvlc_state = libvlc_media_instance_get_state( (libvlc_media_instance_t *)instance, &ex );
if (libvlc_exception_raised(&ex)) if (libvlc_exception_raised( &ex ))
{ {
libvlc_exception_clear(&ex); libvlc_exception_clear( &ex );
return VLCMediaPlayerStateError; return VLCMediaPlayerStateError;
} }
else else
...@@ -479,23 +479,23 @@ static VLCMediaPlayerState libvlc_to_local_state [] = ...@@ -479,23 +479,23 @@ static VLCMediaPlayerState libvlc_to_local_state [] =
- (void)registerObservers - (void)registerObservers
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init( &ex );
// Attach event observers into the media instance // Attach event observers into the media instance
libvlc_event_manager_t *p_em = libvlc_media_instance_event_manager(instance, &ex); libvlc_event_manager_t *p_em = libvlc_media_instance_event_manager( instance, &ex );
libvlc_event_attach(p_em, libvlc_MediaInstancePlayed, HandleMediaInstanceStateChanged, self, &ex); libvlc_event_attach( p_em, libvlc_MediaInstancePlayed, HandleMediaInstanceStateChanged, self, &ex );
libvlc_event_attach(p_em, libvlc_MediaInstancePaused, HandleMediaInstanceStateChanged, self, &ex); libvlc_event_attach( p_em, libvlc_MediaInstancePaused, HandleMediaInstanceStateChanged, self, &ex );
libvlc_event_attach(p_em, libvlc_MediaInstanceReachedEnd, HandleMediaInstanceStateChanged, self, &ex); libvlc_event_attach( p_em, libvlc_MediaInstanceReachedEnd, HandleMediaInstanceStateChanged, self, &ex );
libvlc_event_attach(p_em, libvlc_MediaInstancePositionChanged, HandleMediaTimeChanged, self, &ex); libvlc_event_attach( p_em, libvlc_MediaInstancePositionChanged, HandleMediaTimeChanged, self, &ex );
quit_on_exception(&ex); quit_on_exception( &ex );
} }
- (void)unregisterObservers - (void)unregisterObservers
{ {
libvlc_event_manager_t *p_em = libvlc_media_instance_event_manager(instance, NULL); libvlc_event_manager_t *p_em = libvlc_media_instance_event_manager( instance, NULL );
libvlc_event_detach(p_em, libvlc_MediaInstancePlayed, HandleMediaInstanceStateChanged, self, NULL); libvlc_event_detach( p_em, libvlc_MediaInstancePlayed, HandleMediaInstanceStateChanged, self, NULL );
libvlc_event_detach(p_em, libvlc_MediaInstancePaused, HandleMediaInstanceStateChanged, self, NULL); libvlc_event_detach( p_em, libvlc_MediaInstancePaused, HandleMediaInstanceStateChanged, self, NULL );
libvlc_event_detach(p_em, libvlc_MediaInstanceReachedEnd, HandleMediaInstanceStateChanged, self, NULL); libvlc_event_detach( p_em, libvlc_MediaInstanceReachedEnd, HandleMediaInstanceStateChanged, self, NULL );
libvlc_event_detach(p_em, libvlc_MediaInstancePositionChanged, HandleMediaTimeChanged, self, NULL); libvlc_event_detach( p_em, libvlc_MediaInstancePositionChanged, HandleMediaTimeChanged, self, NULL );
} }
@end @end
\ No newline at end of file
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