]> git.sesse.net Git - vlc/commitdiff
Moved input_EsOutGetWakeup to es_out_Control.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 2 Nov 2008 15:36:19 +0000 (16:36 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 4 Nov 2008 22:50:58 +0000 (23:50 +0100)
src/input/es_out.c
src/input/es_out.h
src/input/input.c

index 6240f77e117fcab54169ed07b8397fc5576767d3..fcb7d4e8b38256a755bc0c9996e1624245ee7082 100644 (file)
@@ -327,26 +327,6 @@ es_out_id_t *input_EsOutGetFromID( es_out_t *out, int i_id )
     return NULL;
 }
 
-mtime_t input_EsOutGetWakeup( es_out_t *out )
-{
-    es_out_sys_t   *p_sys = out->p_sys;
-    input_thread_t *p_input = p_sys->p_input;
-
-    if( !p_sys->p_pgrm )
-        return 0;
-
-    /* We do not have a wake up date if the input cannot have its speed
-     * controlled or sout is imposing its own or while buffering
-     *
-     * FIXME for !p_input->b_can_pace_control a wkeup time is still needed to avoid too strong buffering */
-    if( !p_input->b_can_pace_control ||
-        p_input->p->b_out_pace_control ||
-        p_sys->b_buffering )
-        return 0;
-
-    return input_clock_GetWakeup( p_sys->p_pgrm->p_clock );
-}
-
 void input_EsOutChangeRate( es_out_t *out, int i_rate )
 {
     es_out_sys_t      *p_sys = out->p_sys;
@@ -670,6 +650,26 @@ static void EsOutDelete( es_out_t *out )
     free( out );
 }
 
+static mtime_t EsOutGetWakeup( es_out_t *out )
+{
+    es_out_sys_t   *p_sys = out->p_sys;
+    input_thread_t *p_input = p_sys->p_input;
+
+    if( !p_sys->p_pgrm )
+        return 0;
+
+    /* We do not have a wake up date if the input cannot have its speed
+     * controlled or sout is imposing its own or while buffering
+     *
+     * FIXME for !p_input->b_can_pace_control a wkeup time is still needed to avoid too strong buffering */
+    if( !p_input->b_can_pace_control ||
+        p_input->p->b_out_pace_control ||
+        p_sys->b_buffering )
+        return 0;
+
+    return input_clock_GetWakeup( p_sys->p_pgrm->p_clock );
+}
+
 
 static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
 {
@@ -2283,6 +2283,13 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
             return EsOutProgramDel( out, i_group );
         }
 
+        case ES_OUT_GET_WAKE_UP:
+        {
+            mtime_t *pi_wakeup = (mtime_t*)va_arg( args, mtime_t* );
+            *pi_wakeup = EsOutGetWakeup( out );
+            return VLC_SUCCESS;
+        }
+
         default:
             msg_Err( p_sys->p_input, "unknown query in es_out_Control" );
             return VLC_EGENERIC;
index a433697b6102618c84a63150368eb0dff89e7b57..f254317975a71707c0199b39d5516931a9d9cedb 100644 (file)
 
 #include <vlc_common.h>
 
+enum es_out_query_private_e
+{
+    /* Get date to wait before demuxing more data */
+    ES_OUT_GET_WAKE_UP = ES_OUT_PRIVATE_START,   /* arg1=mtime_t*            res=cannot fail */
+
+};
+
+static inline mtime_t es_out_GetWakeup( es_out_t *p_out )
+{
+    mtime_t i_wu;
+    int i_ret = es_out_Control( p_out, ES_OUT_GET_WAKE_UP, &i_wu );
+
+    assert( !i_ret );
+    return i_wu;
+}
+
 es_out_t  *input_EsOutNew( input_thread_t *, int i_rate );
+
 es_out_id_t *input_EsOutGetFromID( es_out_t *, int i_id );
-mtime_t    input_EsOutGetWakeup( es_out_t * );
 void       input_EsOutSetDelay( es_out_t *, int i_cat, int64_t );
 int        input_EsOutSetRecord( es_out_t *, bool b_record );
 void       input_EsOutChangeRate( es_out_t *, int );
index e47ae883ba898ddf81f293cfac7500296ba3ee4a..4ce6b5c046eb4d8a63c6f668b9a6475353c777bf 100644 (file)
@@ -754,9 +754,7 @@ static void MainLoop( input_thread_t *p_input )
         {
             MainLoopDemux( p_input, &b_force_update, &i_start_mdate );
 
-            input_EsOutLock( p_input->p->p_es_out );
-            i_wakeup = input_EsOutGetWakeup( p_input->p->p_es_out );
-            input_EsOutUnlock( p_input->p->p_es_out );
+            i_wakeup = es_out_GetWakeup( p_input->p->p_es_out );
         }
 
         /* */
@@ -794,11 +792,9 @@ static void MainLoop( input_thread_t *p_input )
             /* Check if i_wakeup is still valid */
             if( i_wakeup != 0 )
             {
-                input_EsOutLock( p_input->p->p_es_out );
-                mtime_t i_new_wakeup = input_EsOutGetWakeup( p_input->p->p_es_out );
+                mtime_t i_new_wakeup = es_out_GetWakeup( p_input->p->p_es_out );
                 if( !i_new_wakeup )
                     i_wakeup = 0;
-                input_EsOutUnlock( p_input->p->p_es_out );
             }
         } while( i_current < i_wakeup );
     }