Commit c2f9cc44 authored by Laurent Aimar's avatar Laurent Aimar

Moved input_EsOutGetWakeup to es_out_Control.

parent d551561d
......@@ -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;
......
......@@ -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 );
......
......@@ -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 );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment