]> git.sesse.net Git - vlc/blobdiff - src/input/input.c
input: remove write-only demux-polled flag
[vlc] / src / input / input.c
index 36d3b6d2d0cfd2126cf92c2c53d08a310d4629c9..7de30ecbf23993613bb06527c52aafe34a5cd9c4 100644 (file)
@@ -88,7 +88,7 @@ static void InputSourceMeta( input_thread_t *, input_source_t *, vlc_meta_t * );
 
 /* TODO */
 //static void InputGetAttachments( input_thread_t *, input_source_t * );
-static void SlaveDemux( input_thread_t *p_input, bool *pb_demux_polled );
+static void SlaveDemux( input_thread_t *p_input );
 static void SlaveSeek( input_thread_t *p_input );
 
 static void InputMetaUser( input_thread_t *p_input, vlc_meta_t *p_meta );
@@ -538,12 +538,11 @@ static void *Run( void *obj )
  * MainLoopDemux
  * It asks the demuxer to demux some data
  */
-static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, bool *pb_demux_polled, mtime_t i_start_mdate )
+static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, mtime_t i_start_mdate )
 {
     int i_ret;
 
     *pb_changed = false;
-    *pb_demux_polled = p_input->p->input.p_demux->pf_demux != NULL;
 
     if( ( p_input->p->i_stop > 0 && p_input->p->i_time >= p_input->p->i_stop ) ||
         ( p_input->p->i_run > 0 && i_start_mdate+p_input->p->i_run < mdate() ) )
@@ -581,12 +580,7 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, bool *pb_d
     }
 
     if( i_ret > 0 && p_input->p->i_slave > 0 )
-    {
-        bool b_demux_polled;
-        SlaveDemux( p_input, &b_demux_polled );
-
-        *pb_demux_polled |= b_demux_polled;
-    }
+        SlaveDemux( p_input );
 }
 
 static int MainLoopTryRepeat( input_thread_t *p_input, mtime_t *pi_start_mdate )
@@ -684,8 +678,7 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
 
     while( vlc_object_alive( p_input ) && !p_input->b_error )
     {
-        mtime_t i_wakeup = 0;
-        bool b_demux_polled = true;
+        mtime_t i_wakeup = -1;
         bool b_paused = p_input->p->i_state == PAUSE_S;
         /* FIXME if p_input->p->i_state == PAUSE_S the access/access_demux
          * is paused -> this may cause problem with some of them
@@ -699,8 +692,7 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
             {
                 bool b_force_update = false;
 
-                MainLoopDemux( p_input, &b_force_update, &b_demux_polled,
-                               i_start_mdate );
+                MainLoopDemux( p_input, &b_force_update, i_start_mdate );
                 i_wakeup = es_out_GetWakeup( p_input->p->p_es_out );
 
                 if( b_force_update )
@@ -743,10 +735,6 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
         {
             mtime_t i_deadline = i_wakeup;
 
-            if( b_paused || !b_demux_polled )
-                /* FIXME: remove this polling */
-                i_deadline = mdate() + INT64_C(250000);
-
             /* Postpone seeking until ES buffering is complete or at most
              * 125 ms. */
             bool b_postpone = es_out_GetBuffering( p_input->p->p_es_out )
@@ -757,7 +745,7 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
 
                 /* Recheck ES buffer level every 20 ms when seeking */
                 if( now < i_last_seek_mdate + INT64_C(125000)
-                 && i_deadline > now + INT64_C(20000) )
+                 && (i_deadline < 0 || i_deadline > now + INT64_C(20000)) )
                     i_deadline = now + INT64_C(20000);
                 else
                     b_postpone = false;
@@ -2540,12 +2528,11 @@ static void InputSourceMeta( input_thread_t *p_input,
 }
 
 
-static void SlaveDemux( input_thread_t *p_input, bool *pb_demux_polled )
+static void SlaveDemux( input_thread_t *p_input )
 {
     int64_t i_time;
     int i;
 
-    *pb_demux_polled = false;
     if( demux_Control( p_input->p->input.p_demux, DEMUX_GET_TIME, &i_time ) )
     {
         msg_Err( p_input, "demux doesn't like DEMUX_GET_TIME" );
@@ -2560,12 +2547,6 @@ static void SlaveDemux( input_thread_t *p_input, bool *pb_demux_polled )
         if( in->b_eof )
             continue;
 
-        const bool b_demux_polled = in->p_demux->pf_demux != NULL;
-        if( !b_demux_polled )
-            continue;
-
-        *pb_demux_polled = true;
-
         /* Call demux_Demux until we have read enough data */
         if( demux_Control( in->p_demux, DEMUX_SET_NEXT_DEMUX_TIME, i_time ) )
         {