[FFmpeg-devel] [PATCH] Make wmaprodec.c:decode_init() return AVERROR_INVALIDDATA in case of illegal number of channels
Sascha Sommer
saschasommer
Tue Mar 23 19:52:01 CET 2010
Hi,
Am Sonntag 21 M?rz 2010 21:59:08 schrieb Stefano Sabatini:
> On date Tuesday 2010-03-16 21:13:32 +0100, Sascha Sommer encoded:
> > Hi,
>
> [...]
>
> > According to http://en.wikipedia.org/wiki/Windows_Media_Audio, wmapro
> > files can have more than 8 channels but I never saw such a file in the
> > wild. I therefore think that AVERROR_INVALIDDATA is wrong.
> > It could be replaced with AVERROR_PATCHWELCOME, though.
>
> Check the attached patch, regards.
>
> diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
> index 2a597b4..c5ae527 100644
> --- a/libavcodec/wmaprodec.c
> +++ b/libavcodec/wmaprodec.c
> @@ -343,9 +343,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
> }
> }
>
> - if (s->num_channels < 0 || s->num_channels > WMAPRO_MAX_CHANNELS) {
> - av_log_ask_for_sample(avctx, "invalid number of channels\n");
> - return AVERROR_NOTSUPP;
> + if (s->num_channels < 0) {
> + av_log(avctx, AV_LOG_ERROR, "invalid number of channels %i\n", s-
>
> >num_channels);
>
> + return AVERROR_INVALIDDATA;
> + }
> + if (s->num_channels > WMAPRO_MAX_CHANNELS) {
else if
> + av_log_ask_for_sample(avctx, "unsupported number of channels\n");
You could print the number of channels here, too.
> + return AVERROR_PATCHWELCOME;
> }
>
Regards
Sascha
More information about the ffmpeg-devel
mailing list