Mercurial > mplayer.hg
changeset 15546:4ac9c227d758
preinit audio filters in order to determine the final samplerate and number of channels, or audio encoders will be initialized with the wrong parameters
author | nicodvb |
---|---|
date | Sun, 22 May 2005 15:34:23 +0000 |
parents | 88ded92bfe07 |
children | c4e5c20f2dd6 |
files | mencoder.c |
diffstat | 1 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mencoder.c Sun May 22 15:11:03 2005 +0000 +++ b/mencoder.c Sun May 22 15:34:23 2005 +0000 @@ -254,6 +254,7 @@ #endif #include "vobsub.h" +#include "libao2/audio_out.h" /* FIXME */ static void mencoder_exit(int level, char *how) { @@ -367,6 +368,7 @@ int new_srate; unsigned int timer_start; +ao_data_t ao_data = {0,0,0,0,OUTBURST,-1,0}; audio_encoding_params_t aparams; audio_encoder_t *aencoder = NULL; @@ -808,8 +810,21 @@ mux_a->codec=out_audio_codec; -aparams.channels = audio_output_channels ? audio_output_channels : sh_audio->channels; -aparams.sample_rate = force_srate ? force_srate : new_srate; +ao_data.samplerate = force_srate ? force_srate : new_srate; +ao_data.channels = audio_output_channels ? audio_output_channels : sh_audio->channels; +ao_data.format = audio_output_format ? audio_output_format : sh_audio->sample_format; +if(!preinit_audio_filters(sh_audio, + // input: + new_srate, + sh_audio->channels, sh_audio->sample_format, + // output: + &ao_data.samplerate, &ao_data.channels, &ao_data.format)) { + mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError); + mencoder_exit(1, NULL); + } + +aparams.channels = ao_data.channels; +aparams.sample_rate = ao_data.samplerate; aparams.audio_preload = 1000 * audio_preload; if(mux_a->codec != ACODEC_COPY) { aencoder = new_audio_encoder(mux_a, &aparams);