[vlc-devel] commit: Moved input_EsOutGetWakeup to es_out_Control. (Laurent Aimar )
git version control
git at videolan.org
Tue Nov 4 23:56:11 CET 2008
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Nov 2 16:36:19 2008 +0100| [c2f9cc4472c2db298c263a35176cede8aca42d71] | committer: Laurent Aimar
Moved input_EsOutGetWakeup to es_out_Control.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c2f9cc4472c2db298c263a35176cede8aca42d71
---
src/input/es_out.c | 47 +++++++++++++++++++++++++++--------------------
src/input/es_out.h | 18 +++++++++++++++++-
src/input/input.c | 8 ++------
3 files changed, 46 insertions(+), 27 deletions(-)
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 6240f77..fcb7d4e 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -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;
diff --git a/src/input/es_out.h b/src/input/es_out.h
index a433697..f254317 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -31,9 +31,25 @@
#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 );
diff --git a/src/input/input.c b/src/input/input.c
index e47ae88..4ce6b5c 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -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 );
}
More information about the vlc-devel
mailing list