/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc_block.h>
if( p_dec == NULL )
{
msg_Err( p_input, "could not create packetizer" );
- intf_UserFatal( p_input, VLC_FALSE, _("Streaming / Transcoding failed"),
+ intf_UserFatal( p_input, VLC_FALSE, _("Streaming / Transcoding failed"),
_("VLC could not open the packetizer module.") );
return NULL;
}
if( p_dec == NULL )
{
msg_Err( p_input, "could not create decoder" );
- intf_UserFatal( p_input, VLC_FALSE, _("Streaming / Transcoding failed"),
+ intf_UserFatal( p_input, VLC_FALSE, _("Streaming / Transcoding failed"),
_("VLC could not open the decoder module.") );
return NULL;
}
}
}
+ /* Copy ourself the input replay gain */
+ if( fmt->i_cat == AUDIO_ES )
+ {
+ int i;
+ for( i = 0; i < AUDIO_REPLAY_GAIN_MAX; i++ )
+ {
+ if( !p_dec->fmt_out.audio_replay_gain.pb_peak[i] )
+ {
+ p_dec->fmt_out.audio_replay_gain.pb_peak[i] = fmt->audio_replay_gain.pb_peak[i];
+ p_dec->fmt_out.audio_replay_gain.pf_peak[i] = fmt->audio_replay_gain.pf_peak[i];
+ }
+ if( !p_dec->fmt_out.audio_replay_gain.pb_gain[i] )
+ {
+ p_dec->fmt_out.audio_replay_gain.pb_gain[i] = fmt->audio_replay_gain.pb_gain[i];
+ p_dec->fmt_out.audio_replay_gain.pf_gain[i] = fmt->audio_replay_gain.pf_gain[i];
+ }
+ }
+ }
return p_dec;
}
static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
{
input_thread_t *p_input = p_dec->p_owner->p_input;
+ const int i_rate = p_block->i_rate;
aout_buffer_t *p_aout_buf;
while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, &p_block )) )
}
aout_DecPlay( p_dec->p_owner->p_aout,
p_dec->p_owner->p_aout_input,
- p_aout_buf );
+ p_aout_buf, i_rate );
}
}
static void VoutDisplayedPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
picture_t *p_pic = p_vout->render.pp_picture[i];
- if( p_pic->i_status != READY_PICTURE )
+ if( p_pic->i_status == READY_PICTURE ||
+ p_pic->i_status == DISPLAYED_PICTURE )
{
/* We cannot change picture status if it is in READY_PICTURE state,
* Just make sure they won't be displayed */
*/
static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
{
+ decoder_owner_sys_t *p_sys = (decoder_owner_sys_t *)p_dec->p_owner;
const int i_rate = p_block ? p_block->i_rate : INPUT_RATE_DEFAULT;
if( p_block && p_block->i_buffer <= 0 )
stats_UpdateInteger( p_dec, p_input->p->counters.p_decoded_sub, 1, NULL );
vlc_mutex_unlock( &p_input->p->counters.counters_lock );
- if( p_spu->i_start < p_dec->p_owner->i_preroll_end &&
- ( p_spu->i_stop <= 0 || p_spu->i_stop <= p_dec->p_owner->i_preroll_end ) )
+ p_vout = vlc_object_find( p_dec, VLC_OBJECT_VOUT, FIND_ANYWHERE );
+ if( p_vout && p_sys->p_spu_vout == p_vout )
{
- spu_DestroySubpicture( p_dec->p_owner->p_vout->p_spu, p_spu );
- continue;
+ /* Prerool does not work very well with subtitle */
+ if( p_spu->i_start < p_dec->p_owner->i_preroll_end &&
+ ( p_spu->i_stop <= 0 || p_spu->i_stop < p_dec->p_owner->i_preroll_end ) )
+ spu_DestroySubpicture( p_vout->p_spu, p_spu );
+ else
+ spu_DisplaySubpicture( p_vout->p_spu, p_spu );
}
-
- p_vout = vlc_object_find( p_dec, VLC_OBJECT_VOUT, FIND_ANYWHERE );
- if( p_vout )
+ else
{
- spu_DisplaySubpicture( p_vout->p_spu, p_spu );
- vlc_object_release( p_vout );
+ msg_Warn( p_dec, "no vout found, leaking subpicture" );
}
+ if( p_vout )
+ vlc_object_release( p_vout );
}
}
else
}
p_sys->p_aout_input =
- aout_DecNew( p_dec, &p_sys->p_aout, &format );
+ aout_DecNew( p_dec, &p_sys->p_aout, &format, &p_dec->fmt_out.audio_replay_gain );
if( p_sys->p_aout_input == NULL )
{
msg_Err( p_dec, "failed to create audio output" );