[vlc-devel] [RFC V2 2/2] libvlc: support setting seek mode

Zhao Zhili quinkblack at foxmail.com
Tue Jun 19 06:01:45 CEST 2018


Ping for more review.


On 2018年06月18日 14:46, Steve Lhomme wrote:
> Nevermind, I found the other thread.
>
>
> On 2018-06-18 8:43 AM, Steve Lhomme wrote:
>> Can't you do path 2/2 without 1/2 ?
>>
>>
>> On 2018-06-15 2:57 PM, Zhao Zhili wrote:
>>> ---
>>>   include/vlc/libvlc_media_player.h | 10 ++++++++--
>>>   lib/media_player.c                | 22 ++++++++++++++--------
>>>   2 files changed, 22 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..c523b27 100644
>>> --- a/lib/media_player.c
>>> +++ b/lib/media_player.c
>>> @@ -1325,30 +1325,36 @@ 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 )
>>>   {
>>> +    int ret = -1;
>>>       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) );
>>> +    if( input_SetTime( p_input_thread, to_mtime(i_time), b_fast ) 
>>> == VLC_SUCCESS )
>>> +        ret = 0;
>>>       vlc_object_release( p_input_thread );
>>> +    return ret;
>>>   }
>>>   -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 )
>>>   {
>>> +    int ret = -1;
>>>       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 );
>>> +    if( input_SetPosition( p_input_thread, position, b_fast ) == 
>>> VLC_SUCCESS )
>>> +        ret = 0;
>>>       vlc_object_release( p_input_thread );
>>> +    return ret;
>>>   }
>>>     float libvlc_media_player_get_position( libvlc_media_player_t 
>>> *p_mi )
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel





More information about the vlc-devel mailing list