Allows for changing channel layout during decoding. --- libavcodec/mace.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/mace.c b/libavcodec/mace.c index 9d07180..a7c33b5 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -232,8 +232,8 @@ static av_cold int mace_decode_init(AVCodecContext * avctx) { MACEContext *ctx = avctx->priv_data; - if (avctx->channels > 2) - return -1; + if (avctx->channels < 1 || avctx->channels > 2) + return AVERROR(EINVAL); avctx->sample_fmt = AV_SAMPLE_FMT_S16; avcodec_get_frame_defaults(&ctx->frame); @@ -253,6 +253,8 @@ static int mace_decode_frame(AVCodecContext *avctx, void *data, int is_mace3 = (avctx->codec_id == AV_CODEC_ID_MACE3); /* get output buffer */ + if (avctx->channels < 1 || avctx->channels > 2) + return AVERROR(EINVAL); ctx->frame.nb_samples = 3 * (buf_size << (1 - is_mace3)) / avctx->channels; if ((ret = avctx->get_buffer(avctx, &ctx->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); -- 1.7.1 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel