Commit 4c247f8a authored by Laurent Aimar's avatar Laurent Aimar

Give input_DecoderNew the clock used.

No functionnal changes yet.
parent b1d048d8
......@@ -542,7 +542,9 @@ static inline input_state_e input_GetState( input_thread_t * p_input )
input_Control( p_input, INPUT_GET_STATE, &state );
return state;
}
VLC_EXPORT( decoder_t *, input_DecoderNew, ( input_thread_t *, es_format_t *, sout_instance_t * ) );
typedef struct input_clock_t input_clock_t;
VLC_EXPORT( decoder_t *, input_DecoderNew, ( input_thread_t *, es_format_t *, input_clock_t *, sout_instance_t * ) );
VLC_EXPORT( void, input_DecoderDelete, ( decoder_t * ) );
VLC_EXPORT( void, input_DecoderDecode,( decoder_t *, block_t * ) );
......
......@@ -168,7 +168,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
}
}
id->p_dec = input_DecoderNew( p_sys->p_input, p_fmt, NULL );
id->p_dec = input_DecoderNew( p_sys->p_input, p_fmt, NULL, NULL );
if( id->p_dec == NULL )
{
msg_Err( p_stream, "cannot create decoder for fcc=`%4.4s'",
......
......@@ -72,6 +72,7 @@ struct decoder_owner_sys_t
int64_t i_preroll_end;
input_thread_t *p_input;
input_clock_t *p_clock;
aout_instance_t *p_aout;
aout_input_t *p_aout_input;
......@@ -149,7 +150,7 @@ mtime_t decoder_GetDisplayDate( decoder_t *p_dec, mtime_t i_ts )
* \return the spawned decoder object
*/
decoder_t *input_DecoderNew( input_thread_t *p_input,
es_format_t *fmt, sout_instance_t *p_sout )
es_format_t *fmt, input_clock_t *p_clock, sout_instance_t *p_sout )
{
decoder_t *p_dec = NULL;
vlc_value_t val;
......@@ -193,6 +194,8 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
return NULL;
}
p_dec->p_owner->p_clock = p_clock;
if( p_sout && p_sout == p_input->p->p_sout && p_input->p->input.b_can_pace_control )
{
msg_Dbg( p_input, "stream out mode -> no decoder thread" );
......@@ -305,9 +308,10 @@ void input_DecoderDecode( decoder_t * p_dec, block_t *p_block )
}
else
{
if( p_dec->b_error || (p_block && p_block->i_buffer <= 0) )
if( p_dec->b_error || ( p_block && p_block->i_buffer <= 0 ) )
{
if( p_block ) block_Release( p_block );
if( p_block )
block_Release( p_block );
}
else
{
......@@ -339,8 +343,8 @@ void input_DecoderDiscontinuity( decoder_t * p_dec, bool b_flush )
bool input_DecoderEmpty( decoder_t * p_dec )
{
if( p_dec->p_owner->b_own_thread
&& block_FifoCount( p_dec->p_owner->p_fifo ) > 0 )
if( p_dec->p_owner->b_own_thread &&
block_FifoCount( p_dec->p_owner->p_fifo ) > 0 )
{
return false;
}
......@@ -582,7 +586,7 @@ static void* DecoderThread( vlc_object_t *p_this )
{
decoder_t * p_dec = (decoder_t *)p_this;
block_t *p_block;
int canc = vlc_savecancel ();
int canc = vlc_savecancel();
/* The decoder's main loop */
while( !p_dec->b_die && !p_dec->b_error )
......@@ -602,13 +606,14 @@ static void* DecoderThread( vlc_object_t *p_this )
{
/* Trash all received PES packets */
p_block = block_FifoGet( p_dec->p_owner->p_fifo );
if( p_block ) block_Release( p_block );
if( p_block )
block_Release( p_block );
}
/* We do it here because of the dll loader that wants close() in the
* same thread than open()/decode() */
module_unneed( p_dec, p_dec->p_module );
vlc_restorecancel (canc);
vlc_restorecancel( canc );
return NULL;
}
......
......@@ -444,7 +444,7 @@ int input_EsOutSetRecord( es_out_t *out, bool b_record )
if( !p_es->p_dec || p_es->p_master )
continue;
p_es->p_dec_record = input_DecoderNew( p_input, &p_es->fmt, p_sys->p_sout_record );
p_es->p_dec_record = input_DecoderNew( p_input, &p_es->fmt, p_es->p_pgrm->p_clock, p_sys->p_sout_record );
}
}
else
......@@ -1159,9 +1159,9 @@ static void EsCreateDecoder( es_out_t *out, es_out_id_t *p_es )
es_out_sys_t *p_sys = out->p_sys;
input_thread_t *p_input = p_sys->p_input;
p_es->p_dec = input_DecoderNew( p_input, &p_es->fmt, p_input->p->p_sout );
p_es->p_dec = input_DecoderNew( p_input, &p_es->fmt, p_es->p_pgrm->p_clock, p_input->p->p_sout );
if( p_es->p_dec && !p_es->p_master && p_sys->p_sout_record )
p_es->p_dec_record = input_DecoderNew( p_input, &p_es->fmt, p_sys->p_sout_record );
p_es->p_dec_record = input_DecoderNew( p_input, &p_es->fmt, p_es->p_pgrm->p_clock, p_sys->p_sout_record );
}
static void EsDestroyDecoder( es_out_t *out, es_out_id_t *p_es )
{
......
......@@ -31,13 +31,12 @@
#include <vlc_common.h>
/**
/** @struct input_clock_t
* This structure is used to manage clock drift and reception jitters
*
* XXX input_clock_GetTS can be called from any threads. All others functions
* MUST be called from one and only one thread.
*/
typedef struct input_clock_t input_clock_t;
/**
* This function creates a new input_clock_t.
......
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