[vlc-devel] [V2 3/3] libvlc: support setting seek mode
Zhao Zhili
quinkblack at foxmail.com
Fri Jun 22 06:52:03 CEST 2018
---
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 9ef1dde..87d3368 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 cd9d3ee..2755048 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 )
--
2.9.5
More information about the vlc-devel
mailing list