Mercurial > mplayer.hg
changeset 36172:7bf03a973142
Do not pass random unsupported data to encoder.
author | reimar |
---|---|
date | Mon, 13 May 2013 19:34:44 +0000 |
parents | 94979f661d38 |
children | c99608e4d695 |
files | fmt-conversion.c libmpcodecs/ae_lavc.c |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/fmt-conversion.c Mon May 13 19:34:43 2013 +0000 +++ b/fmt-conversion.c Mon May 13 19:34:44 2013 +0000 @@ -180,7 +180,7 @@ {AF_FORMAT_S16_NE, AV_SAMPLE_FMT_S16}, {AF_FORMAT_S32_NE, AV_SAMPLE_FMT_S32}, {AF_FORMAT_FLOAT_NE, AV_SAMPLE_FMT_FLT}, - {0, AV_SAMPLE_FMT_NONE} + {AF_FORMAT_UNKNOWN, AV_SAMPLE_FMT_NONE} }; enum AVSampleFormat affmt2samplefmt(int fmt) @@ -206,7 +206,7 @@ if (samplefmt_conversion_map[i].sample_fmt == sample_fmt) break; fmt = samplefmt_conversion_map[i].fmt; - if (!fmt) + if (fmt == AF_FORMAT_UNKNOWN) mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported AVSampleFormat %i\n", sample_fmt); return fmt; }
--- a/libmpcodecs/ae_lavc.c Mon May 13 19:34:43 2013 +0000 +++ b/libmpcodecs/ae_lavc.c Mon May 13 19:34:44 2013 +0000 @@ -199,6 +199,10 @@ } } encoder->input_format = samplefmt2affmt(lavc_actx->sample_fmt); + if (encoder->input_format == AF_FORMAT_UNKNOWN) { + mp_msg(MSGT_MENCODER,MSGL_ERR, "Audio encoder requires unknown or unsupported input format\n"); + return 0; + } lavc_actx->channels = encoder->params.channels; lavc_actx->sample_rate = encoder->params.sample_rate; lavc_actx->time_base.num = 1;