[vlc-commits] input: use DEMUX_CAN_SEEK instead of STREAM_CAN_SEEK

Rémi Denis-Courmont git at videolan.org
Tue Oct 20 19:52:35 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Oct 20 20:49:30 2015 +0300| [987fc6e9c27e824ba11465752e0e31c22cbacc27] | committer: Rémi Denis-Courmont

input: use DEMUX_CAN_SEEK instead of STREAM_CAN_SEEK

Some demuxers support seeking even if the underlying byte stream is not
seekable (e.g. subtitles). Also some demuxers do not support seeking
regardless of the underlying byte stream.

So it makes more sense to check the status from the demuxer. Most
demuxers just copy or forward the value from the byte stream.

Note: if in doubt, a demuxer can always claim seek support, and
eventually fail both DEMUX_SET_TIME and DEMUX_SET_POSITION. The seek is
only used as a hint for user interfaces; it has no effects on the input
thread as such.

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

 src/input/input.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 42aa157..de5bc92 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2217,11 +2217,6 @@ static int InputSourceInit( input_thread_t *p_input,
         var_SetBool( p_input, "can-pause", in->b_can_pause || !in->b_can_pace_control ); /* XXX temporary because of es_out_timeshift*/
         var_SetBool( p_input, "can-rate", !in->b_can_pace_control || in->b_can_rate_control ); /* XXX temporary because of es_out_timeshift*/
         var_SetBool( p_input, "can-rewind", !in->b_rescale_ts && !in->b_can_pace_control && in->b_can_rate_control );
-
-        bool b_can_seek;
-        if( demux_Control( in->p_demux, DEMUX_CAN_SEEK, &b_can_seek ) )
-            b_can_seek = false;
-        var_SetBool( p_input, "can-seek", b_can_seek );
     }
     else
     {   /* Now try a real access */
@@ -2312,8 +2307,6 @@ static int InputSourceInit( input_thread_t *p_input,
 
         if( !p_input->b_preparsing )
         {
-            bool b;
-
             stream_Control( p_stream, STREAM_CAN_CONTROL_PACE,
                             &in->b_can_pace_control );
             in->b_can_rate_control = in->b_can_pace_control;
@@ -2327,9 +2320,6 @@ static int InputSourceInit( input_thread_t *p_input,
             var_SetBool( p_input, "can-rewind",
                          !in->b_rescale_ts && !in->b_can_pace_control );
 
-            stream_Control( p_stream, STREAM_CAN_SEEK, &b );
-            var_SetBool( p_input, "can-seek", b );
-
             in->b_title_demux = false;
 
             stream_Control( p_stream, STREAM_GET_PTS_DELAY, &i_pts_delay );
@@ -2379,6 +2369,11 @@ static int InputSourceInit( input_thread_t *p_input,
     free( psz_var_demux );
     free( psz_dup );
 
+    bool b_can_seek;
+    if( demux_Control( in->p_demux, DEMUX_CAN_SEEK, &b_can_seek ) )
+        b_can_seek = false;
+    var_SetBool( p_input, "can-seek", b_can_seek );
+
     /* Set record capabilities */
     if( demux_Control( in->p_demux, DEMUX_CAN_RECORD, &in->b_can_stream_record ) )
         in->b_can_stream_record = false;



More information about the vlc-commits mailing list