Mercurial > mplayer.hg
changeset 33504:5a9d68a07ed1
Pass "native" filter chain sample format to audio encoder.
Make ae_lavc try to match this format.
author | reimar |
---|---|
date | Sun, 12 Jun 2011 00:28:51 +0000 |
parents | d54614382edc |
children | 01dd8cbab134 |
files | libmpcodecs/ae.h libmpcodecs/ae_lavc.c mencoder.c |
diffstat | 3 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/ae.h Sun Jun 12 00:23:10 2011 +0000 +++ b/libmpcodecs/ae.h Sun Jun 12 00:28:51 2011 +0000 @@ -38,6 +38,7 @@ int bitrate; int samples_per_frame; int audio_preload; + int sample_format; } audio_encoding_params_t; typedef struct audio_encoder_s {
--- a/libmpcodecs/ae_lavc.c Sun Jun 12 00:23:10 2011 +0000 +++ b/libmpcodecs/ae_lavc.c Sun Jun 12 00:28:51 2011 +0000 @@ -193,7 +193,7 @@ const enum AVSampleFormat *fmts; lavc_actx->sample_fmt = lavc_acodec->sample_fmts[0]; // fallback to first format for (fmts = lavc_acodec->sample_fmts; *fmts != AV_SAMPLE_FMT_NONE; fmts++) { - if (*fmts == AV_SAMPLE_FMT_S16) { // preferred format found + if (samplefmt2affmt(*fmts) == encoder->params.sample_format) { // preferred format found lavc_actx->sample_fmt = *fmts; break; }
--- a/mencoder.c Sun Jun 12 00:23:10 2011 +0000 +++ b/mencoder.c Sun Jun 12 00:28:51 2011 +0000 @@ -157,7 +157,7 @@ float playback_speed=1.0; static int force_srate=0; -static int audio_output_format=0; +static int audio_output_format=AF_FORMAT_UNKNOWN; char *vobsub_out=NULL; unsigned int vobsub_out_index=0; @@ -1071,6 +1071,7 @@ aparams.channels = ao_data.channels; aparams.sample_rate = ao_data.samplerate; +aparams.sample_format = ao_data.format; aparams.audio_preload = 1000 * audio_preload; if(mux_a->codec != ACODEC_COPY) { aencoder = new_audio_encoder(mux_a, &aparams); @@ -1082,6 +1083,9 @@ mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_NoMatchingFilter); mencoder_exit(1,NULL); } + ao_data.format = aencoder->input_format; + ao_data.channels = aparams.channels; + ao_data.samplerate = aparams.sample_rate; } switch(mux_a->codec){ case ACODEC_COPY: