Mercurial > mplayer.hg
changeset 33500:c36fec5ba5b6
Always choose AV_SAMPLE_FMT_S16 then the encoder supports it.
author | reimar |
---|---|
date | Sat, 11 Jun 2011 23:36:52 +0000 |
parents | e4f533bf5a9a |
children | 3209d6cbc393 |
files | libmpcodecs/ae_lavc.c |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/ae_lavc.c Sat Jun 11 16:40:10 2011 +0000 +++ b/libmpcodecs/ae_lavc.c Sat Jun 11 23:36:52 2011 +0000 @@ -187,7 +187,17 @@ lavc_actx->codec_type = AVMEDIA_TYPE_AUDIO; lavc_actx->codec_id = lavc_acodec->id; // put sample parameters - lavc_actx->sample_fmt = lavc_acodec->sample_fmts ? lavc_acodec->sample_fmts[0] : AV_SAMPLE_FMT_S16; + lavc_actx->sample_fmt = AV_SAMPLE_FMT_S16; + if (lavc_acodec->sample_fmts) { + 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 + lavc_actx->sample_fmt = *fmts; + break; + } + } + } if (lavc_actx->sample_fmt != AV_SAMPLE_FMT_S16) mp_msg(MSGT_MENCODER, MSGL_ERR, "Encoder requires input not properly supported." "Try using e.g. 'ac3_fixed' instead of 'ac3' as codec\n");