Commit 0a04dcca authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework: Properly convert libvlc Exception to NSException. Rename...

MacOSX/Framework: Properly convert libvlc Exception to NSException. Rename quit_on_exception to catch_exception.
parent 72934aec
...@@ -55,6 +55,5 @@ ...@@ -55,6 +55,5 @@
/* /*
* Utility function * Utility function
*/ */
// TODO: Figure out a better way to raise error messages #define catch_exception( ex ) __catch_exception( (void *)(ex), __FUNCTION__, __FILE__, __LINE__ )
#define quit_on_exception( ex ) __quit_on_exception( (void *)(ex), __FUNCTION__, __FILE__, __LINE__ ) extern void __catch_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 );
...@@ -58,7 +58,7 @@ NSString * VLCMediaPlayerVolumeChanged = @"VLCMediaPlayerVolumeChanged"; ...@@ -58,7 +58,7 @@ NSString * VLCMediaPlayerVolumeChanged = @"VLCMediaPlayerVolumeChanged";
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
BOOL result = libvlc_audio_get_mute([library instance], &ex); BOOL result = libvlc_audio_get_mute([library instance], &ex);
quit_on_exception(&ex); catch_exception(&ex);
return result; return result;
} }
...@@ -77,7 +77,7 @@ NSString * VLCMediaPlayerVolumeChanged = @"VLCMediaPlayerVolumeChanged"; ...@@ -77,7 +77,7 @@ NSString * VLCMediaPlayerVolumeChanged = @"VLCMediaPlayerVolumeChanged";
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
int result = libvlc_audio_get_volume([library instance], &ex); int result = libvlc_audio_get_volume([library instance], &ex);
quit_on_exception(&ex); catch_exception(&ex);
return result; return result;
} }
@end @end
...@@ -31,15 +31,17 @@ ...@@ -31,15 +31,17 @@
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 __catch_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 */ NSException* libvlcException = [NSException
NSRunCriticalAlertPanel( @"Error", [NSString stringWithFormat:@"libvlc has thrown us an error: %s (%s:%d %s)", exceptionWithName:@"LibVLCException"
libvlc_exception_get_message( ex ), file, line_number, function], @"Quit", nil, nil ); reason:[NSString stringWithFormat:@"libvlc has thrown us an error: %s (%s:%d %s)",
exit( ex->i_code ); libvlc_exception_get_message( ex ), file, line_number, function]
userInfo:nil];
@throw libvlcException;
} }
} }
...@@ -80,7 +82,7 @@ static void * DestroySharedLibraryAtExit( void ) ...@@ -80,7 +82,7 @@ static void * DestroySharedLibraryAtExit( void )
}; };
instance = (void *)libvlc_new( sizeof(lib_vlc_params)/sizeof(lib_vlc_params[0]), lib_vlc_params, &ex ); instance = (void *)libvlc_new( sizeof(lib_vlc_params)/sizeof(lib_vlc_params[0]), lib_vlc_params, &ex );
quit_on_exception( &ex ); catch_exception( &ex );
// Assignment unneeded, as the audio unit will do it for us // Assignment unneeded, as the audio unit will do it for us
/*audio = */ [[VLCAudio alloc] initWithLibrary:self]; /*audio = */ [[VLCAudio alloc] initWithLibrary:self];
......
...@@ -173,7 +173,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -173,7 +173,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
p_md = libvlc_media_descriptor_new([VLCLibrary sharedInstance], p_md = libvlc_media_descriptor_new([VLCLibrary sharedInstance],
[aPath UTF8String], [aPath UTF8String],
&ex); &ex);
quit_on_exception(&ex); catch_exception(&ex);
url = [aPath copy]; url = [aPath copy];
delegate = nil; delegate = nil;
...@@ -198,7 +198,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -198,7 +198,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
p_md = libvlc_media_descriptor_new_as_node([VLCLibrary sharedInstance], p_md = libvlc_media_descriptor_new_as_node([VLCLibrary sharedInstance],
[aName UTF8String], [aName UTF8String],
&ex); &ex);
quit_on_exception(&ex); catch_exception(&ex);
url = [aName copy]; url = [aName copy];
delegate = nil; delegate = nil;
...@@ -332,7 +332,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -332,7 +332,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
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 ); catch_exception( &ex );
url = [[NSString stringWithUTF8String:p_url] retain]; url = [[NSString stringWithUTF8String:p_url] retain];
free( p_url ); free( p_url );
...@@ -418,14 +418,14 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -418,14 +418,14 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
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 ); catch_exception( &ex );
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_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);
libvlc_event_attach(p_em, libvlc_MediaDescriptorStateChanged, HandleMediaStateChanged, self, &ex); libvlc_event_attach(p_em, libvlc_MediaDescriptorStateChanged, HandleMediaStateChanged, self, &ex);
libvlc_event_attach(p_em, libvlc_MediaDescriptorSubItemAdded, HandleMediaSubItemAdded, self, &ex); libvlc_event_attach(p_em, libvlc_MediaDescriptorSubItemAdded, HandleMediaSubItemAdded, self, &ex);
quit_on_exception( &ex ); catch_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 );
......
...@@ -93,7 +93,7 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use ...@@ -93,7 +93,7 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
mdis = libvlc_media_discoverer_new_from_name( [VLCLibrary sharedInstance], mdis = libvlc_media_discoverer_new_from_name( [VLCLibrary sharedInstance],
[aServiceName UTF8String], [aServiceName UTF8String],
&ex ); &ex );
quit_on_exception( &ex ); catch_exception( &ex );
libvlc_event_manager_t * p_em = libvlc_media_discoverer_event_manager(mdis); libvlc_event_manager_t * p_em = libvlc_media_discoverer_event_manager(mdis);
libvlc_event_attach(p_em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, self, NULL); libvlc_event_attach(p_em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, self, NULL);
......
...@@ -47,10 +47,10 @@ ...@@ -47,10 +47,10 @@
libvlc_exception_t p_e; libvlc_exception_t p_e;
libvlc_exception_init( &p_e ); libvlc_exception_init( &p_e );
mlib = libvlc_media_library_new( [VLCLibrary sharedInstance], &p_e ); mlib = libvlc_media_library_new( [VLCLibrary sharedInstance], &p_e );
quit_on_exception( &p_e ); catch_exception( &p_e );
libvlc_media_library_load( mlib, &p_e ); libvlc_media_library_load( mlib, &p_e );
quit_on_exception( &p_e ); catch_exception( &p_e );
allMedia = nil; allMedia = nil;
} }
......
...@@ -76,7 +76,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -76,7 +76,7 @@ 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 );
p_mlist = libvlc_media_list_new( [VLCLibrary sharedInstance], &p_e ); p_mlist = libvlc_media_list_new( [VLCLibrary sharedInstance], &p_e );
quit_on_exception( &p_e ); catch_exception( &p_e );
// Initialize internals to defaults // Initialize internals to defaults
cachedMedia = [[NSMutableArray alloc] init]; cachedMedia = [[NSMutableArray alloc] init];
...@@ -152,7 +152,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -152,7 +152,7 @@ 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_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 ); catch_exception( &p_e );
} }
- (void)removeMediaAtIndex:(int)index - (void)removeMediaAtIndex:(int)index
...@@ -163,7 +163,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -163,7 +163,7 @@ 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_media_list_remove_index( p_mlist, index, &p_e ); libvlc_media_list_remove_index( p_mlist, index, &p_e );
quit_on_exception( &p_e ); catch_exception( &p_e );
} }
- (VLCMedia *)mediaAtIndex:(int)index - (VLCMedia *)mediaAtIndex:(int)index
...@@ -176,7 +176,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -176,7 +176,7 @@ 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 );
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 ); catch_exception( &p_e );
return result; return result;
} }
...@@ -204,7 +204,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -204,7 +204,7 @@ 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 );
BOOL isReadOnly = libvlc_media_list_is_readonly( p_mlist ); BOOL isReadOnly = libvlc_media_list_is_readonly( p_mlist );
quit_on_exception( &p_e ); catch_exception( &p_e );
return isReadOnly; return isReadOnly;
} }
...@@ -290,7 +290,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -290,7 +290,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
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 );
quit_on_exception( &p_e ); catch_exception( &p_e );
} }
- (void)mediaListItemAdded:(NSArray *)arrayOfArgs - (void)mediaListItemAdded:(NSArray *)arrayOfArgs
......
...@@ -125,7 +125,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void * ...@@ -125,7 +125,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
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_view_item_at_index( p_mlv, index, &p_e ); libvlc_media_descriptor_t * p_md = libvlc_media_list_view_item_at_index( p_mlv, index, &p_e );
quit_on_exception( &p_e ); catch_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.
...@@ -137,7 +137,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void * ...@@ -137,7 +137,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
libvlc_exception_t p_e; libvlc_exception_t p_e;
libvlc_exception_init( &p_e ); libvlc_exception_init( &p_e );
libvlc_media_list_view_t * p_sub_mlv = libvlc_media_list_view_children_at_index( p_mlv, index, &p_e ); libvlc_media_list_view_t * p_sub_mlv = libvlc_media_list_view_children_at_index( p_mlv, index, &p_e );
quit_on_exception( &p_e ); catch_exception( &p_e );
if( !p_sub_mlv ) if( !p_sub_mlv )
return nil; return nil;
...@@ -159,7 +159,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void * ...@@ -159,7 +159,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
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_view_count( p_mlv, &p_e ); int result = libvlc_media_list_view_count( p_mlv, &p_e );
quit_on_exception( &p_e ); catch_exception( &p_e );
return result; return result;
} }
...@@ -242,7 +242,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void * ...@@ -242,7 +242,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
/* Add internal callback */ /* Add internal callback */
libvlc_event_attach( p_em, libvlc_MediaListViewItemAdded, HandleMediaListViewItemAdded, self, &e ); libvlc_event_attach( p_em, libvlc_MediaListViewItemAdded, HandleMediaListViewItemAdded, self, &e );
libvlc_event_attach( p_em, libvlc_MediaListViewItemDeleted, HandleMediaListViewItemDeleted, self, &e ); libvlc_event_attach( p_em, libvlc_MediaListViewItemDeleted, HandleMediaListViewItemDeleted, self, &e );
quit_on_exception( &e ); catch_exception( &e );
} }
- (void)mediaListViewItemAdded:(NSArray *)arrayOfArgs - (void)mediaListViewItemAdded:(NSArray *)arrayOfArgs
......
...@@ -144,7 +144,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -144,7 +144,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
[self registerObservers]; [self registerObservers];
...@@ -203,7 +203,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -203,7 +203,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
} }
- (VLCVideoView *)videoView - (VLCVideoView *)videoView
...@@ -221,7 +221,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -221,7 +221,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
return result; return result;
} }
...@@ -235,7 +235,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -235,7 +235,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
return result; return result;
} }
...@@ -249,7 +249,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -249,7 +249,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
return result; return result;
} }
...@@ -263,7 +263,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -263,7 +263,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
return result; return result;
} }
...@@ -277,7 +277,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -277,7 +277,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
return result; return result;
} }
...@@ -291,7 +291,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -291,7 +291,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
return result; return result;
} }
...@@ -301,7 +301,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -301,7 +301,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
return result; return result;
} }
...@@ -324,7 +324,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -324,7 +324,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
return result; return result;
} }
...@@ -337,7 +337,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -337,7 +337,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
} }
- (VLCTime *)time - (VLCTime *)time
...@@ -355,7 +355,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -355,7 +355,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
int result = libvlc_media_instance_get_chapter( instance, &ex ); int result = libvlc_media_instance_get_chapter( instance, &ex );
quit_on_exception( &ex ); catch_exception( &ex );
return result; return result;
} }
...@@ -364,7 +364,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -364,7 +364,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
int result = libvlc_media_instance_get_chapter_count( instance, &ex ); int result = libvlc_media_instance_get_chapter_count( instance, &ex );
quit_on_exception( &ex ); catch_exception( &ex );
return result; return result;
} }
...@@ -378,7 +378,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -378,7 +378,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
return result; return result;
} }
...@@ -387,7 +387,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -387,7 +387,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
int result = libvlc_audio_get_track_count( instance, &ex ); int result = libvlc_audio_get_track_count( instance, &ex );
quit_on_exception( &ex ); catch_exception( &ex );
return result; return result;
} }
...@@ -401,7 +401,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -401,7 +401,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
return result; return result;
} }
...@@ -428,7 +428,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -428,7 +428,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
} }
} }
...@@ -442,7 +442,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -442,7 +442,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_exception( &ex );
return YES; return YES;
} }
...@@ -461,7 +461,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -461,7 +461,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
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 ); catch_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?
...@@ -479,7 +479,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -479,7 +479,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
// 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 ); // catch_exception( &ex );
// Pause and reposition to the begining of the stream. // Pause and reposition to the begining of the stream.
[self pause]; [self pause];
...@@ -539,7 +539,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] = ...@@ -539,7 +539,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
libvlc_media_instance_set_position( instance, newPosition, &ex ); libvlc_media_instance_set_position( instance, newPosition, &ex );
quit_on_exception( &ex ); catch_exception( &ex );
} }
- (BOOL)isSeekable - (BOOL)isSeekable
...@@ -547,7 +547,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] = ...@@ -547,7 +547,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
BOOL ret = libvlc_media_instance_is_seekable( instance, &ex ); BOOL ret = libvlc_media_instance_is_seekable( instance, &ex );
quit_on_exception( &ex ); catch_exception( &ex );
return ret; return ret;
} }
...@@ -567,7 +567,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] = ...@@ -567,7 +567,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
/* FIXME: We may want to turn that off when none is interested by that */ /* FIXME: We may want to turn that off when none is interested by that */
libvlc_event_attach( p_em, libvlc_MediaInstancePositionChanged, HandleMediaPositionChanged, self, &ex ); libvlc_event_attach( p_em, libvlc_MediaInstancePositionChanged, HandleMediaPositionChanged, self, &ex );
libvlc_event_attach( p_em, libvlc_MediaInstanceTimeChanged, HandleMediaTimeChanged, self, &ex ); libvlc_event_attach( p_em, libvlc_MediaInstanceTimeChanged, HandleMediaTimeChanged, self, &ex );
quit_on_exception( &ex ); catch_exception( &ex );
} }
- (void)unregisterObservers - (void)unregisterObservers
......
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