Browse Source

macosx/framework: Export -gotoNextFrame.

Pierre d'Herbemont 15 years ago
parent
commit
830b82fc77
2 changed files with 19 additions and 1 deletions
  1. 5 0
      Headers/Public/VLCMediaPlayer.h
  2. 14 1
      Sources/VLCMediaPlayer.m

+ 5 - 0
Headers/Public/VLCMediaPlayer.h

@@ -243,6 +243,11 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
 - (void)stop;
 
 /**
+ * Advance one frame.
+ */
+- (void)gotoNextFrame;
+
+/**
  * Fast forwards through the feed at the standard 1x rate.
  */
 - (void)fastForward;

+ 14 - 1
Sources/VLCMediaPlayer.m

@@ -396,7 +396,11 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
     float result = libvlc_media_player_get_rate( instance, &ex );
-    catch_exception( &ex );
+    if (libvlc_exception_raised(&ex))
+    {
+        result = 1;
+        libvlc_exception_clear(&ex);
+    }
     return result;
 }
 
@@ -692,6 +696,15 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     libvlc_media_player_stop(instance);
 }
 
+- (void)gotoNextFrame
+{
+    libvlc_exception_t e;
+    libvlc_exception_init(&e);
+    libvlc_media_player_next_frame(instance, &e);
+    catch_exception(&e);
+
+}
+
 - (void)fastForward
 {
     [self fastForwardAtRate: 2.0];