[vlc-commits] libvlc: support setting seek mode

Zhao Zhili git at videolan.org
Fri Jun 29 13:56:27 CEST 2018


vlc | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Mon Jun 25 16:03:50 2018 +0800| [cca06c4a3a0a7a61fbc05d392a17436566bef44b] | committer: Thomas Guillem

libvlc: support setting seek mode

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 include/vlc/libvlc_media_player.h | 10 ++++++++--
 lib/media_player.c                | 18 ++++++++++--------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 9ef1ddec24..87d3368bf3 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -785,9 +785,12 @@ LIBVLC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_
  * Not all formats and protocols support this.
  *
  * \param p_mi the Media Player
+ * \param b_fast prefer fast seeking or precise seeking
  * \param i_time the movie time (in ms).
+ * \return 0 on success, -1 on error
  */
-LIBVLC_API void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, libvlc_time_t i_time );
+LIBVLC_API int libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
+                                             libvlc_time_t i_time, bool b_fast );
 
 /**
  * Get movie position as percentage between 0.0 and 1.0.
@@ -803,9 +806,12 @@ LIBVLC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi )
  * This might not work depending on the underlying input format and protocol.
  *
  * \param p_mi the Media Player
+ * \param b_fast prefer fast seeking or precise seeking
  * \param f_pos the position
+ * \return 0 on success, -1 on error
  */
-LIBVLC_API void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, float f_pos );
+LIBVLC_API int libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
+                                                 float f_pos, bool b_fast );
 
 /**
  * Set movie chapter (if applicable).
diff --git a/lib/media_player.c b/lib/media_player.c
index cd9d3eea31..2755048162 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1325,30 +1325,32 @@ libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi )
     return i_time;
 }
 
-void libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
-                                   libvlc_time_t i_time )
+int libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
+                                   libvlc_time_t i_time, bool b_fast )
 {
     input_thread_t *p_input_thread;
 
     p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
-        return;
+        return -1;
 
-    var_SetInteger( p_input_thread, "time", to_mtime(i_time) );
+    input_SetTime( p_input_thread, to_mtime(i_time), b_fast );
     vlc_object_release( p_input_thread );
+    return 0;
 }
 
-void libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
-                                       float position )
+int libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
+                                       float position, bool b_fast )
 {
     input_thread_t *p_input_thread;
 
     p_input_thread = libvlc_get_input_thread ( p_mi );
     if( !p_input_thread )
-        return;
+        return -1;
 
-    var_SetFloat( p_input_thread, "position", position );
+    input_SetPosition( p_input_thread, position, b_fast );
     vlc_object_release( p_input_thread );
+    return 0;
 }
 
 float libvlc_media_player_get_position( libvlc_media_player_t *p_mi )



More information about the vlc-commits mailing list