]> git.sesse.net Git - vlc/blobdiff - projects/macosx/framework/Sources/VLCMediaPlayer.m
macosx/framework: Don't use deprecated functions, fix style and fix \t.
[vlc] / projects / macosx / framework / Sources / VLCMediaPlayer.m
index f48a727ce9818b0251a747b9c841db5be2ad151e..2359600a22c7849144d1efc153b684acb13994e3 100644 (file)
@@ -72,8 +72,8 @@ static void HandleMediaInstanceVolumeChanged(const libvlc_event_t * event, void
 static void HandleMediaTimeChanged(const libvlc_event_t * event, void * self)
 {
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-    [[VLCEventManager sharedManager] callOnMainThreadObject:self 
-                                                 withMethod:@selector(mediaPlayerTimeChanged:) 
+    [[VLCEventManager sharedManager] callOnMainThreadObject:self
+                                                 withMethod:@selector(mediaPlayerTimeChanged:)
                                        withArgumentAsObject:[NSNumber numberWithLongLong:event->u.media_player_time_changed.new_time]];
 
     [[VLCEventManager sharedManager] callOnMainThreadDelegateOfObject:self
@@ -86,8 +86,8 @@ static void HandleMediaPositionChanged(const libvlc_event_t * event, void * self
 {
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 
-    [[VLCEventManager sharedManager] callOnMainThreadObject:self 
-                                                 withMethod:@selector(mediaPlayerPositionChanged:) 
+    [[VLCEventManager sharedManager] callOnMainThreadObject:self
+                                                 withMethod:@selector(mediaPlayerPositionChanged:)
                                        withArgumentAsObject:[NSNumber numberWithFloat:event->u.media_player_position_changed.new_position]];
     [pool release];
 }
@@ -95,7 +95,7 @@ static void HandleMediaPositionChanged(const libvlc_event_t * event, void * self
 static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * self)
 {
     VLCMediaPlayerState newState;
-    
+
     if( event->type == libvlc_MediaPlayerPlaying )
         newState = VLCMediaPlayerStatePlaying;
     else if( event->type == libvlc_MediaPlayerPaused )
@@ -109,31 +109,31 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
         NSLog(@"%s: Unknown event", __FUNCTION__);
         return;
     }
-    
+
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-    
-    [[VLCEventManager sharedManager] callOnMainThreadObject:self 
-                                                 withMethod:@selector(mediaPlayerStateChanged:) 
+
+    [[VLCEventManager sharedManager] callOnMainThreadObject:self
+                                                 withMethod:@selector(mediaPlayerStateChanged:)
                                        withArgumentAsObject:[NSNumber numberWithInt:newState]];
-    
+
     [[VLCEventManager sharedManager] callOnMainThreadDelegateOfObject:self
                                                    withDelegateMethod:@selector(mediaPlayerStateChanged:)
                                                  withNotificationName:VLCMediaPlayerStateChanged];
-    
+
     [pool release];
-    
+
 }
 
 static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * self)
 {
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-    
-    [[VLCEventManager sharedManager] callOnMainThreadObject:self 
-                                                 withMethod:@selector(mediaPlayerMediaChanged:) 
+
+    [[VLCEventManager sharedManager] callOnMainThreadObject:self
+                                                 withMethod:@selector(mediaPlayerMediaChanged:)
                                        withArgumentAsObject:[VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_player_media_changed.new_media]];
-        
+
     [pool release];
-    
+
 }
 
 
@@ -207,7 +207,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 
 - (void)dealloc
 {
-    NSAssert(libvlc_media_player_get_state(instance, NULL) == libvlc_Stopped, @"You released the media player before ensuring that it is stopped");
+    NSAssert(libvlc_media_player_get_state(instance) == libvlc_Stopped, @"You released the media player before ensuring that it is stopped");
 
     // Always get rid of the delegate first so we can stop sending messages to it
     // TODO: Should we tell the delegate that we're shutting down?
@@ -216,10 +216,10 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     // Clear our drawable as we are going to release it, we don't
     // want the core to use it from this point. This won't happen as
     // the media player must be stopped.
-    libvlc_media_player_set_nsobject(instance, nil, NULL);
+    libvlc_media_player_set_nsobject(instance, nil);
 
     libvlc_media_player_release(instance);
-    
+
     // Get rid of everything else
     [media release];
     [cachedTime release];
@@ -240,7 +240,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 }
 
 - (void)setVideoView:(VLCVideoView *)aVideoView
-{    
+{
     [self setDrawable: aVideoView];
 }
 
@@ -252,19 +252,12 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 - (void)setDrawable:(id)aDrawable
 {
     // Make sure that this instance has been associated with the drawing canvas.
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_media_player_set_nsobject(instance, aDrawable, &ex);
-    catch_exception( &ex );
+    libvlc_media_player_set_nsobject(instance, aDrawable);
 }
 
 - (id)drawable
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    id ret = libvlc_media_player_get_nsobject(instance);
-    catch_exception( &ex );
-    return ret;
+    return libvlc_media_player_get_nsobject(instance);
 }
 
 - (VLCAudio *)audio
@@ -277,49 +270,34 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 
 - (void)setCurrentVideoSubTitleIndex:(NSUInteger)index
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_video_set_spu( instance, (int)index, &ex );
-    catch_exception( &ex );
+    libvlc_video_set_spu(instance, (int)index);
 }
 
 - (NSUInteger)currentVideoSubTitleIndex
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    int count = libvlc_video_get_spu_count( instance, &ex );
-    catch_exception( &ex );
+    NSInteger count = libvlc_video_get_spu_count(instance);
+
     if (count <= 0)
         return NSNotFound;
-    NSUInteger result = libvlc_video_get_spu( instance, &ex );
-    catch_exception( &ex );
-    return result;
+
+    return libvlc_video_get_spu(instance);
 }
 
 - (BOOL)openVideoSubTitlesFromFile:(NSString *)path
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    BOOL result = libvlc_video_set_subtitle_file( instance, [path UTF8String], &ex );
-    catch_exception( &ex );
-    return result;
+    return libvlc_video_set_subtitle_file(instance, [path UTF8String]);
 }
 
 - (NSArray *)videoSubTitles
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    int count = libvlc_video_get_spu_count( instance, &ex );
-    catch_exception( &ex );
+    libvlc_track_description_t *currentTrack = libvlc_video_get_spu_description(instance);
 
-    libvlc_track_description_t *tracks = libvlc_video_get_spu_description( instance, &ex );
     NSMutableArray *tempArray = [NSMutableArray array];
-    NSInteger i;
-    for (i = 0; i < count; i++)
-    {
-        [tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
-        tracks = tracks->p_next;
+    while (currentTrack) {
+        [tempArray addObject:[NSString stringWithUTF8String:currentTrack->psz_name]];
+        currentTrack = currentTrack->p_next;
     }
+    libvlc_track_description_release(currentTrack);
     return [NSArray arrayWithArray: tempArray];
 }
 
@@ -329,131 +307,72 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 
 - (void)setVideoCropGeometry:(char *)value
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_video_set_crop_geometry( instance, value, &ex );
-    catch_exception( &ex );
+    libvlc_video_set_crop_geometry(instance, value);
 }
 
 - (char *)videoCropGeometry
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    char * result = libvlc_video_get_crop_geometry( instance, &ex );
-    catch_exception( &ex );
+    char * result = libvlc_video_get_crop_geometry(instance);
     return result;
 }
 
 - (void)setVideoAspectRatio:(char *)value
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_video_set_aspect_ratio( instance, value, &ex );
-    catch_exception( &ex );
+    libvlc_video_set_aspect_ratio( instance, value );
 }
 
 - (char *)videoAspectRatio
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    char * result = libvlc_video_get_aspect_ratio( instance, &ex );
-    catch_exception( &ex );
+    char * result = libvlc_video_get_aspect_ratio( instance );
     return result;
 }
 
-- (void)setVideoTeleText:(int)value
+- (void)saveVideoSnapshotAt:(NSString *)path withWidth:(NSUInteger)width andHeight:(NSUInteger)height
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_video_set_teletext( instance, value, &ex );
-    catch_exception( &ex );
-}
-
-- (int)videoTeleText
-{
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    int result = libvlc_video_get_teletext( instance, &ex );
-    catch_exception( &ex );
-    return result;
+    int failure = libvlc_video_take_snapshot(instance, 0, [path UTF8String], width, height);
+    if (failure)
+        [[NSException exceptionWithName:@"Can't take a video snapshot" reason:@"No video output" userInfo:nil] raise];
 }
 
-- (void)saveVideoSnapshotAt: (NSString *)path withWidth:(NSUInteger)width andHeight:(NSUInteger)height
+- (void)setDeinterlaceFilter:(NSString *)name
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_video_take_snapshot( instance, [path UTF8String], width, height, &ex );
-    catch_exception( &ex );
-}
-
-- (void)setDeinterlaceFilter: (NSString *)name enabled: (BOOL)enabled
-{
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_video_set_deinterlace( instance, (int)enabled , [name UTF8String], &ex );
-    catch_exception( &ex );
+    libvlc_video_set_deinterlace(instance, [name UTF8String]);
 }
 
 - (void)setRate:(float)value
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_media_player_set_rate( instance, value, &ex );
-    catch_exception( &ex );
+    libvlc_media_player_set_rate(instance, value);
 }
 
 - (float)rate
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    float result = libvlc_media_player_get_rate( instance, &ex );
-    catch_exception( &ex );
-    return result;
+    return libvlc_media_player_get_rate(instance);
 }
 
 - (NSSize)videoSize
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    NSSize result = NSMakeSize(libvlc_video_get_height((libvlc_media_player_t *)instance, &ex),
-                               libvlc_video_get_width((libvlc_media_player_t *)instance, &ex));
-    catch_exception( &ex );
-    return result;
+    unsigned height = 0, width = 0;
+    int failure = libvlc_video_get_size(instance, 0, &width, &height);
+    if (failure)
+        [[NSException exceptionWithName:@"Can't get video size" reason:@"No video output" userInfo:nil] raise];
+    return NSMakeSize(width, height);
 }
 
 - (BOOL)hasVideoOut
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    BOOL result = libvlc_media_player_has_vout((libvlc_media_player_t *)instance, &ex);
-    if (libvlc_exception_raised( &ex ))
-    {
-        libvlc_exception_clear( &ex );
-        return NO;
-    }
-    else
-        return result;
+    return libvlc_media_player_has_vout(instance);
 }
 
 - (float)framesPerSecond
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    float result = libvlc_media_player_get_fps( (libvlc_media_player_t *)instance, &ex );
-    catch_exception( &ex );
-    return result;
+    return libvlc_media_player_get_fps(instance);
 }
 
 - (void)setTime:(VLCTime *)value
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
     // Time is managed in seconds, while duration is managed in microseconds
     // TODO: Redo VLCTime to provide value numberAsMilliseconds, numberAsMicroseconds, numberAsSeconds, numberAsMinutes, numberAsHours
-    libvlc_media_player_set_time( (libvlc_media_player_t *)instance, 
-                                    (value ? [[value numberValue] longLongValue] / 1000 : 0),
-                                    &ex );
-    catch_exception( &ex );
+    libvlc_media_player_set_time(instance, value ? [[value numberValue] longLongValue] : 0);
 }
 
 - (VLCTime *)time
@@ -466,71 +385,53 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     return cachedRemainingTime;
 }
 
-- (int)fps
+- (NSUInteger)fps
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    int result = libvlc_media_player_get_fps( instance, &ex );
-    catch_exception( &ex );
-    return result;
+    return libvlc_media_player_get_fps(instance);
 }
 
 #pragma mark -
 #pragma mark Chapters
 - (void)setCurrentChapterIndex:(NSUInteger)value;
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_media_player_set_chapter( instance, value, &ex );
-    catch_exception( &ex );
+    libvlc_media_player_set_chapter(instance, value);
 }
 
 - (NSUInteger)currentChapterIndex
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    int count = libvlc_media_player_get_chapter_count( instance, &ex );
-    catch_exception( &ex );
+    NSInteger count = libvlc_media_player_get_chapter_count(instance);
     if (count <= 0)
         return NSNotFound;
-    NSUInteger result = libvlc_media_player_get_chapter( instance, &ex );
-    catch_exception( &ex );
+    NSUInteger result = libvlc_media_player_get_chapter(instance);
     return result;
 }
 
 - (void)nextChapter
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_media_player_next_chapter( instance, &ex );
-    catch_exception( &ex );
+    libvlc_media_player_next_chapter(instance);
 }
 
 - (void)previousChapter
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_media_player_previous_chapter( instance, &ex );
-    catch_exception( &ex );
+    libvlc_media_player_previous_chapter(instance);
 }
 
 - (NSArray *)chaptersForTitleIndex:(NSUInteger)title
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    int count = libvlc_media_player_get_chapter_count(instance, &ex);
+    NSInteger count = libvlc_media_player_get_chapter_count(instance);
     if (count <= 0)
         return [NSArray array];
 
-    libvlc_track_description_t *tracks = libvlc_video_get_chapter_description( instance, title, &ex );
+    libvlc_track_description_t *tracks = libvlc_video_get_chapter_description(instance, title);
     NSMutableArray *tempArray = [NSMutableArray array];
     NSInteger i;
     for (i = 0; i < count ; i++)
     {
-        [tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
+        [tempArray addObject:[NSString stringWithUTF8String:tracks->psz_name]];
         tracks = tracks->p_next;
     }
-    return [NSArray arrayWithArray: tempArray];
+    libvlc_track_description_release(tracks);
+    return [NSArray arrayWithArray:tempArray];
 }
 
 #pragma mark -
@@ -538,41 +439,27 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 
 - (void)setCurrentTitleIndex:(NSUInteger)value
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );    
-    libvlc_media_player_set_title( instance, value, &ex );
-    catch_exception( &ex );
+    libvlc_media_player_set_title(instance, value);
 }
 
 - (NSUInteger)currentTitleIndex
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-
-    int count = libvlc_media_player_get_title_count( instance, &ex );
-    catch_exception( &ex );
+    NSInteger count = libvlc_media_player_get_title_count(instance);
     if (count <= 0)
         return NSNotFound;
-    
-    NSUInteger result = libvlc_media_player_get_title( instance, &ex );
-    catch_exception( &ex );
-    return result;
+
+    return libvlc_media_player_get_title(instance);
 }
 
-- (int)countOfTitles
+- (NSUInteger)countOfTitles
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    int result = libvlc_media_player_get_title_count( instance, &ex );
-    catch_exception( &ex );
+    NSUInteger result = libvlc_media_player_get_title_count(instance);
     return result;
 }
 
 - (NSArray *)titles
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_track_description_t *tracks = libvlc_video_get_title_description( instance, &ex );
+    libvlc_track_description_t *tracks = libvlc_video_get_title_description(instance);
     NSMutableArray *tempArray = [NSMutableArray array];
     NSInteger i;
     for (i = 0; i < [self countOfTitles] ; i++)
@@ -580,6 +467,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
         [tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
         tracks = tracks->p_next;
     }
+    libvlc_track_description_release(tracks);
     return [NSArray arrayWithArray: tempArray];
 }
 
@@ -587,62 +475,46 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 #pragma mark Audio tracks
 - (void)setCurrentAudioTrackIndex:(NSUInteger)value
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_audio_set_track( instance, (int)value, &ex );
-    catch_exception( &ex );
+    libvlc_audio_set_track( instance, (int)value);
 }
 
 - (NSUInteger)currentAudioTrackIndex
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    int count = libvlc_audio_get_track_count( instance, &ex );
-    catch_exception( &ex );
+    NSInteger count = libvlc_audio_get_track_count(instance);
     if (count <= 0)
         return NSNotFound;
-    
-    NSUInteger result = libvlc_audio_get_track( instance, &ex );
-    catch_exception( &ex );
+
+    NSUInteger result = libvlc_audio_get_track(instance);
     return result;
 }
 
 - (NSArray *)audioTracks
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    int count = libvlc_audio_get_track_count( instance, &ex );
-    catch_exception( &ex );
+    NSInteger count = libvlc_audio_get_track_count(instance);
     if (count <= 0)
         return [NSArray array];
 
-    libvlc_track_description_t *tracks = libvlc_audio_get_track_description( instance, &ex );
+    libvlc_track_description_t *tracks = libvlc_audio_get_track_description(instance);
     NSMutableArray *tempArray = [NSMutableArray array];
-    NSInteger i;
+    NSUInteger i;
     for (i = 0; i < count ; i++)
     {
         [tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
         tracks = tracks->p_next;
     }
+    libvlc_track_description_release(tracks);
 
     return [NSArray arrayWithArray: tempArray];
 }
 
-- (void)setAudioChannel:(int)value
+- (void)setAudioChannel:(NSInteger)value
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_audio_set_channel( instance, value, &ex );
-    catch_exception( &ex );
+    libvlc_audio_set_channel(instance, value);
 }
 
-- (int)audioChannel
+- (NSInteger)audioChannel
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    int result = libvlc_audio_get_channel( instance, &ex );
-    catch_exception( &ex );
-    return result;
+    return libvlc_audio_get_channel(instance);
 }
 
 - (void)setMedia:(VLCMedia *)value
@@ -651,14 +523,11 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     {
         if (media && [media compare:value] == NSOrderedSame)
             return;
-        
+
         [media release];
         media = [value retain];
 
-        libvlc_exception_t ex;
-        libvlc_exception_init( &ex );
-        libvlc_media_player_set_media( instance, [media libVLCMediaDescriptor], &ex );
-        catch_exception( &ex );
+        libvlc_media_player_set_media(instance, [media libVLCMediaDescriptor]);
     }
 }
 
@@ -668,11 +537,8 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 }
 
 - (BOOL)play
-{    
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_media_player_play( (libvlc_media_player_t *)instance, &ex );
-    catch_exception( &ex );
+{
+    libvlc_media_player_play(instance);
     return YES;
 }
 
@@ -682,31 +548,25 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     {
         /* Hack because we create a dead lock here, when the vout is stopped
          * and tries to recontact us on the main thread */
-        /* FIXME: to do this properly we need to do some locking. We may want 
+        /* FIXME: to do this properly we need to do some locking. We may want
          * to move that to libvlc */
         [self performSelectorInBackground:@selector(pause) withObject:nil];
         return;
     }
 
     // Pause the stream
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_media_player_pause( (libvlc_media_player_t *)instance, &ex );
-
-    // fail gracefully
-    // in most cases, it's just EOF so let's stop
-    if (libvlc_exception_raised(&ex))
-        [self stop];
-
-    libvlc_exception_clear(&ex);
+    libvlc_media_player_pause(instance);
 }
 
 - (void)stop
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_media_player_stop((libvlc_media_player_t *)instance, &ex);
-    catch_exception( &ex );
+    libvlc_media_player_stop(instance);
+}
+
+- (void)gotoNextFrame
+{
+    libvlc_media_player_next_frame(instance);
+
 }
 
 - (void)fastForward
@@ -733,7 +593,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 {
     if( [self isSeekable] )
     {
-        interval = interval * 1000000;
+        interval = interval * 1000;
         [self setTime: [VLCTime timeWithInt: ([[self time] intValue] - interval)]];
     }
 }
@@ -742,7 +602,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 {
     if( [self isSeekable] )
     {
-        interval = interval * 1000000;
+        interval = interval * 1000;
         [self setTime: [VLCTime timeWithInt: ([[self time] intValue] + interval)]];
     }
 }
@@ -801,16 +661,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 
 - (BOOL)willPlay
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    BOOL ret = libvlc_media_player_will_play( (libvlc_media_player_t *)instance, &ex );
-    if (libvlc_exception_raised(&ex))
-    {
-        libvlc_exception_clear(&ex);
-        return NO;
-    }
-    else
-        return ret;
+    return libvlc_media_player_will_play(instance);
 }
 
 static const VLCMediaPlayerState libvlc_to_local_state[] =
@@ -836,28 +687,17 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
 
 - (void)setPosition:(float)newPosition
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    libvlc_media_player_set_position( instance, newPosition, &ex );
-    catch_exception( &ex );
+    libvlc_media_player_set_position(instance, newPosition);
 }
 
 - (BOOL)isSeekable
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    BOOL ret = libvlc_media_player_is_seekable( instance, &ex );
-    catch_exception( &ex );
-    return ret;
+    return libvlc_media_player_is_seekable(instance);
 }
 
 - (BOOL)canPause
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-    BOOL ret = libvlc_media_player_can_pause( instance, &ex );
-    catch_exception( &ex );
-    return ret;
+    return libvlc_media_player_can_pause(instance);
 }
 
 - (void *)libVLCMediaPlayer
@@ -883,11 +723,11 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
         // instance
         libvlc_exception_t ex;
         libvlc_exception_init( &ex );
-        instance = (void *)libvlc_media_player_new([VLCLibrary sharedInstance], &ex);
+        instance = libvlc_media_player_new([VLCLibrary sharedInstance]);
         catch_exception( &ex );
-        
+
         [self registerObservers];
-        
+
         [self setDrawable:aDrawable];
     }
     return self;
@@ -895,32 +735,28 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
 
 - (void)registerObservers
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init( &ex );
-
     // Attach event observers into the media instance
-    libvlc_event_manager_t * p_em = libvlc_media_player_event_manager( instance, &ex );
-    libvlc_event_attach( p_em, libvlc_MediaPlayerPlaying,          HandleMediaInstanceStateChanged, self, &ex );
-    libvlc_event_attach( p_em, libvlc_MediaPlayerPaused,           HandleMediaInstanceStateChanged, self, &ex );
-    libvlc_event_attach( p_em, libvlc_MediaPlayerEncounteredError, HandleMediaInstanceStateChanged, self, &ex );
-    libvlc_event_attach( p_em, libvlc_MediaPlayerEndReached,       HandleMediaInstanceStateChanged, self, &ex );
+    libvlc_event_manager_t * p_em = libvlc_media_player_event_manager(instance);
+    libvlc_event_attach(p_em, libvlc_MediaPlayerPlaying,          HandleMediaInstanceStateChanged, self);
+    libvlc_event_attach(p_em, libvlc_MediaPlayerPaused,           HandleMediaInstanceStateChanged, self);
+    libvlc_event_attach(p_em, libvlc_MediaPlayerEncounteredError, HandleMediaInstanceStateChanged, self);
+    libvlc_event_attach(p_em, libvlc_MediaPlayerEndReached,       HandleMediaInstanceStateChanged, self);
     /* FIXME: We may want to turn that off when none is interested by that */
-    libvlc_event_attach( p_em, libvlc_MediaPlayerPositionChanged, HandleMediaPositionChanged,      self, &ex );
-    libvlc_event_attach( p_em, libvlc_MediaPlayerTimeChanged,     HandleMediaTimeChanged,          self, &ex );
-    libvlc_event_attach( p_em, libvlc_MediaPlayerMediaChanged,     HandleMediaPlayerMediaChanged,  self, &ex );
-    catch_exception( &ex );
+    libvlc_event_attach(p_em, libvlc_MediaPlayerPositionChanged, HandleMediaPositionChanged,      self);
+    libvlc_event_attach(p_em, libvlc_MediaPlayerTimeChanged,     HandleMediaTimeChanged,          self);
+    libvlc_event_attach(p_em, libvlc_MediaPlayerMediaChanged,    HandleMediaPlayerMediaChanged,  self);
 }
 
 - (void)unregisterObservers
 {
-    libvlc_event_manager_t * p_em = libvlc_media_player_event_manager( instance, NULL );
-    libvlc_event_detach( p_em, libvlc_MediaPlayerPlaying,          HandleMediaInstanceStateChanged, self, NULL );
-    libvlc_event_detach( p_em, libvlc_MediaPlayerPaused,           HandleMediaInstanceStateChanged, self, NULL );
-    libvlc_event_detach( p_em, libvlc_MediaPlayerEncounteredError, HandleMediaInstanceStateChanged, self, NULL );
-    libvlc_event_detach( p_em, libvlc_MediaPlayerEndReached,       HandleMediaInstanceStateChanged, self, NULL );
-    libvlc_event_detach( p_em, libvlc_MediaPlayerPositionChanged,  HandleMediaPositionChanged,      self, NULL );
-    libvlc_event_detach( p_em, libvlc_MediaPlayerTimeChanged,      HandleMediaTimeChanged,          self, NULL );
-    libvlc_event_attach( p_em, libvlc_MediaPlayerMediaChanged,     HandleMediaPlayerMediaChanged,   self, NULL );
+    libvlc_event_manager_t * p_em = libvlc_media_player_event_manager(instance);
+    libvlc_event_detach(p_em, libvlc_MediaPlayerPlaying,          HandleMediaInstanceStateChanged, self);
+    libvlc_event_detach(p_em, libvlc_MediaPlayerPaused,           HandleMediaInstanceStateChanged, self);
+    libvlc_event_detach(p_em, libvlc_MediaPlayerEncounteredError, HandleMediaInstanceStateChanged, self);
+    libvlc_event_detach(p_em, libvlc_MediaPlayerEndReached,       HandleMediaInstanceStateChanged, self);
+    libvlc_event_detach(p_em, libvlc_MediaPlayerPositionChanged,  HandleMediaPositionChanged,      self);
+    libvlc_event_detach(p_em, libvlc_MediaPlayerTimeChanged,      HandleMediaTimeChanged,          self);
+    libvlc_event_detach(p_em, libvlc_MediaPlayerMediaChanged,     HandleMediaPlayerMediaChanged,   self);
 }
 
 - (void)mediaPlayerTimeChanged:(NSNumber *)newTime