Commit c352d28f authored by Laurent Aimar's avatar Laurent Aimar

Do not use p_input->p->i_rate directly (no functionnality change yet)

parent 89be7cad
......@@ -115,7 +115,7 @@ static void ClockNewRef( input_clock_t *cl,
* discontinuity
*****************************************************************************/
void input_ClockInit( input_thread_t *p_input,
input_clock_t *cl, vlc_bool_t b_master, int i_cr_average )
input_clock_t *cl, vlc_bool_t b_master, int i_cr_average, int i_rate )
{
cl->i_synchro_state = SYNCHRO_START;
......@@ -126,7 +126,7 @@ void input_ClockInit( input_thread_t *p_input,
cl->sysdate_ref = 0;
cl->delta_cr = 0;
cl->i_delta_cr_residue = 0;
cl->i_rate = p_input->p->i_rate;
cl->i_rate = i_rate;
cl->i_cr_average = i_cr_average;
......@@ -165,7 +165,7 @@ void input_ClockSetPCR( input_thread_t *p_input,
* warning from the stream control facilities (dd-edited
* stream ?). */
msg_Warn( p_input, "clock gap, unexpected stream discontinuity" );
input_ClockInit( p_input, cl, cl->b_master, cl->i_cr_average );
input_ClockInit( p_input, cl, cl->b_master, cl->i_cr_average, cl->i_rate );
/* Feed synchro with a new reference point. */
msg_Warn( p_input, "feeding synchro with a new reference point trying to recover from clock gap" );
ClockNewRef( cl, i_clock,
......@@ -233,12 +233,12 @@ mtime_t input_ClockGetTS( input_thread_t * p_input,
/*****************************************************************************
* input_ClockSetRate:
*****************************************************************************/
void input_ClockSetRate( input_thread_t *p_input, input_clock_t *cl )
void input_ClockSetRate( input_thread_t *p_input, input_clock_t *cl, int i_rate )
{
/* Move the reference point */
if( cl->i_synchro_state == SYNCHRO_OK )
ClockNewRef( cl, cl->last_cr, cl->last_sysdate );
cl->i_rate = p_input->p->i_rate;
cl->i_rate = i_rate;
}
......@@ -128,6 +128,9 @@ struct es_out_sys_t
/* delay */
int64_t i_audio_delay;
int64_t i_spu_delay;
/* Rate used to rescale ES ts */
int i_rate;
};
static es_out_id_t *EsOutAdd ( es_out_t *, es_format_t * );
......@@ -169,7 +172,7 @@ static inline int EsOutGetClosedCaptionsChannel( vlc_fourcc_t fcc )
/*****************************************************************************
* input_EsOutNew:
*****************************************************************************/
es_out_t *input_EsOutNew( input_thread_t *p_input )
es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
{
es_out_t *out = malloc( sizeof( es_out_t ) );
es_out_sys_t *p_sys = malloc( sizeof( es_out_sys_t ) );
......@@ -250,6 +253,8 @@ es_out_t *input_EsOutNew( input_thread_t *p_input )
p_sys->i_audio_delay= 0;
p_sys->i_spu_delay = 0;
p_sys->i_rate = i_rate;
return out;
}
......@@ -344,15 +349,16 @@ static void EsOutDiscontinuity( es_out_t *out, vlc_bool_t b_flush, vlc_bool_t b_
input_DecoderDiscontinuity( es->p_dec, b_flush );
}
}
void input_EsOutChangeRate( es_out_t *out )
void input_EsOutChangeRate( es_out_t *out, int i_rate )
{
es_out_sys_t *p_sys = out->p_sys;
int i;
p_sys->i_rate = i_rate;
EsOutDiscontinuity( out, VLC_FALSE, VLC_FALSE );
for( i = 0; i < p_sys->i_pgrm; i++ )
input_ClockSetRate( p_sys->p_input, &p_sys->pgrm[i]->clock );
input_ClockSetRate( p_sys->p_input, &p_sys->pgrm[i]->clock, i_rate );
}
void input_EsOutSetDelay( es_out_t *out, int i_cat, int64_t i_delay )
......@@ -575,7 +581,7 @@ static es_out_pgrm_t *EsOutProgramAdd( es_out_t *out, int i_group )
p_pgrm->psz_now_playing = NULL;
p_pgrm->psz_publisher = NULL;
p_pgrm->p_epg = NULL;
input_ClockInit( p_input, &p_pgrm->clock, VLC_FALSE, p_input->p->input.i_cr_average );
input_ClockInit( p_input, &p_pgrm->clock, VLC_FALSE, p_input->p->input.i_cr_average, p_sys->i_rate );
/* Append it */
TAB_APPEND( p_sys->i_pgrm, p_sys->pgrm, p_pgrm );
......@@ -1414,13 +1420,13 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
}
}
p_block->i_rate = p_input->p->i_rate;
p_block->i_rate = p_sys->i_rate;
/* TODO handle mute */
if( es->p_dec &&
( es->fmt.i_cat != AUDIO_ES ||
( p_input->p->i_rate >= INPUT_RATE_DEFAULT/AOUT_MAX_INPUT_RATE &&
p_input->p->i_rate <= INPUT_RATE_DEFAULT*AOUT_MAX_INPUT_RATE ) ) )
( p_sys->i_rate >= INPUT_RATE_DEFAULT/AOUT_MAX_INPUT_RATE &&
p_sys->i_rate <= INPUT_RATE_DEFAULT*AOUT_MAX_INPUT_RATE ) ) )
{
vlc_bool_t pb_cc[4];
vlc_bool_t b_cc_new = VLC_FALSE;
......
......@@ -866,7 +866,7 @@ static int Init( input_thread_t * p_input )
}
/* Create es out */
p_input->p->p_es_out = input_EsOutNew( p_input );
p_input->p->p_es_out = input_EsOutNew( p_input, p_input->p->i_rate );
es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ACTIVE, VLC_FALSE );
es_out_Control( p_input->p->p_es_out, ES_OUT_SET_MODE, ES_OUT_MODE_NONE );
......@@ -1745,7 +1745,7 @@ static vlc_bool_t Control( input_thread_t *p_input, int i_type,
p_input->p->i_rate = i_rate;
input_EsOutChangeRate( p_input->p->p_es_out );
input_EsOutChangeRate( p_input->p->p_es_out, i_rate );
b_force_update = VLC_TRUE;
}
......
......@@ -268,11 +268,11 @@ int input_DecoderGetCcState( decoder_t *, vlc_bool_t *pb_decode, int i_ch
void input_DecoderIsCcPresent( decoder_t *, vlc_bool_t pb_present[4] );
/* es_out.c */
es_out_t *input_EsOutNew( input_thread_t * );
es_out_t *input_EsOutNew( input_thread_t *, int i_rate );
void input_EsOutDelete( es_out_t * );
es_out_id_t *input_EsOutGetFromID( es_out_t *, int i_id );
void input_EsOutSetDelay( es_out_t *, int i_cat, int64_t );
void input_EsOutChangeRate( es_out_t * );
void input_EsOutChangeRate( es_out_t *, int );
void input_EsOutChangeState( es_out_t * );
void input_EsOutChangePosition( es_out_t * );
vlc_bool_t input_EsOutDecodersEmpty( es_out_t * );
......@@ -306,11 +306,11 @@ typedef struct
int i_delta_cr_residue;
} input_clock_t;
void input_ClockInit( input_thread_t *, input_clock_t *, vlc_bool_t b_master, int i_cr_average );
void input_ClockInit( input_thread_t *, input_clock_t *, vlc_bool_t b_master, int i_cr_average, int i_rate );
void input_ClockSetPCR( input_thread_t *, input_clock_t *, mtime_t );
void input_ClockResetPCR( input_thread_t *, input_clock_t * );
mtime_t input_ClockGetTS( input_thread_t *, input_clock_t *, mtime_t );
void input_ClockSetRate( input_thread_t *, input_clock_t *cl );
void input_ClockSetRate( input_thread_t *, input_clock_t *cl, int i_rate );
/* Subtitles */
char **subtitles_Detect( input_thread_t *, char* path, const char *fname );
......
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