[vlc-devel] commit: osx/framework: added convenience methods for jumps within a stream ( Felix Paul Kühne )

git version control git at videolan.org
Fri Oct 9 17:16:35 CEST 2009


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Oct  9 17:16:20 2009 +0200| [55a60c20e9132c7f4b3cfde1d8bfd11728c7f81b] | committer: Felix Paul Kühne 

osx/framework: added convenience methods for jumps within a stream

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=55a60c20e9132c7f4b3cfde1d8bfd11728c7f81b
---

 .../framework/Headers/Public/VLCMediaPlayer.h      |   52 +++++++++++++++++
 projects/macosx/framework/Sources/VLCMediaPlayer.m |   60 +++++++++++++++++++-
 2 files changed, 111 insertions(+), 1 deletions(-)

diff --git a/projects/macosx/framework/Headers/Public/VLCMediaPlayer.h b/projects/macosx/framework/Headers/Public/VLCMediaPlayer.h
index b282b90..34e31a1 100644
--- a/projects/macosx/framework/Headers/Public/VLCMediaPlayer.h
+++ b/projects/macosx/framework/Headers/Public/VLCMediaPlayer.h
@@ -190,6 +190,58 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
  */
 - (void)rewindAtRate:(float)rate;
 
+/**
+ * Jumps shortly backward in current stream if seeking is supported.
+ * \param interval to skip, in sec.
+ */
+- (void)jumpBackward:(NSInteger)interval;
+
+/**
+ * Jumps shortly forward in current stream if seeking is supported.
+ * \param interval to skip, in sec.
+ */
+- (void)jumpForward:(NSInteger)interval;
+
+/**
+ * Jumps shortly backward in current stream if seeking is supported.
+ */
+- (void)extraShortJumpBackward;
+
+/**
+ * Jumps shortly forward in current stream if seeking is supported.
+ */
+- (void)extraShortJumpForward;
+
+/**
+ * Jumps shortly backward in current stream if seeking is supported.
+ */
+- (void)shortJumpBackward;
+
+/**
+ * Jumps shortly forward in current stream if seeking is supported.
+ */
+- (void)shortJumpForward;
+
+/**
+ * Jumps shortly backward in current stream if seeking is supported.
+ */
+- (void)mediumJumpBackward;
+
+/**
+ * Jumps shortly forward in current stream if seeking is supported.
+ */
+- (void)mediumJumpForward;
+
+/**
+ * Jumps shortly backward in current stream if seeking is supported.
+ */
+- (void)longJumpBackward;
+
+/**
+ * Jumps shortly forward in current stream if seeking is supported.
+ */
+- (void)longJumpForward;
+
 /* Playback Information */
 /**
  * Playback state flag identifying that the stream is currently playing.
diff --git a/projects/macosx/framework/Sources/VLCMediaPlayer.m b/projects/macosx/framework/Sources/VLCMediaPlayer.m
index a386b62..f0ac85b 100644
--- a/projects/macosx/framework/Sources/VLCMediaPlayer.m
+++ b/projects/macosx/framework/Sources/VLCMediaPlayer.m
@@ -325,7 +325,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
     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;    
+    return result;
 }
 
 - (BOOL)hasVideoOut
@@ -516,6 +516,64 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
     [self setRate: -rate];
 }
 
+- (void)jumpBackward:(NSInteger)interval
+{
+    if( [self isSeekable] )
+    {
+        interval = interval * 1000000;
+        [self setTime: [VLCTime timeWithInt: ([[self time] intValue] - interval)]];
+    }
+}
+
+- (void)jumpForward:(NSInteger)interval
+{
+    if( [self isSeekable] )
+    {
+        interval = interval * 1000000;
+        [self setTime: [VLCTime timeWithInt: ([[self time] intValue] + interval)]];
+    }
+}
+
+- (void)extraShortJumpBackward
+{
+    [self jumpBackward:3];
+}
+
+- (void)extraShortJumpForward
+{
+    [self jumpForward:3];
+}
+
+- (void)shortJumpBackward
+{
+    [self jumpBackward:10];
+}
+
+- (void)shortJumpForward
+{
+    [self jumpForward:10];
+}
+
+- (void)mediumJumpBackward
+{
+    [self jumpBackward:60];
+}
+
+- (void)mediumJumpForward
+{
+    [self jumpForward:60];
+}
+
+- (void)longJumpBackward
+{
+    [self jumpBackward:300];
+}
+
+- (void)longJumpForward
+{
+    [self jumpForward:300];
+}
+
 + (NSSet *)keyPathsForValuesAffectingIsPlaying
 {
     return [NSSet setWithObjects:@"state", nil];




More information about the vlc-devel mailing list