You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avcodec/wavpack: fix decoding of files with many channels
Fixes decoding of Run_The_Race_-_3rd_Order_Ambisonic_SN3D.wv
This commit is contained in:
@@ -940,13 +940,23 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
|
|||||||
case 3:
|
case 3:
|
||||||
chmask = bytestream2_get_le32(&gb);
|
chmask = bytestream2_get_le32(&gb);
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
size = bytestream2_get_byte(&gb);
|
||||||
|
chan |= (bytestream2_get_byte(&gb) & 0xF) << 8;
|
||||||
|
chan += 1;
|
||||||
|
if (avctx->channels != chan)
|
||||||
|
av_log(avctx, AV_LOG_WARNING, "%i channels signalled"
|
||||||
|
" instead of %i.\n", chan, avctx->channels);
|
||||||
|
chmask = bytestream2_get_le24(&gb);
|
||||||
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
size = bytestream2_get_byte(&gb);
|
size = bytestream2_get_byte(&gb);
|
||||||
if (avctx->channels != size)
|
|
||||||
av_log(avctx, AV_LOG_WARNING, "%i channels signalled"
|
|
||||||
" instead of %i.\n", size, avctx->channels);
|
|
||||||
chan |= (bytestream2_get_byte(&gb) & 0xF) << 8;
|
chan |= (bytestream2_get_byte(&gb) & 0xF) << 8;
|
||||||
chmask = bytestream2_get_le16(&gb);
|
chan += 1;
|
||||||
|
if (avctx->channels != chan)
|
||||||
|
av_log(avctx, AV_LOG_WARNING, "%i channels signalled"
|
||||||
|
" instead of %i.\n", chan, avctx->channels);
|
||||||
|
chmask = bytestream2_get_le32(&gb);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_log(avctx, AV_LOG_ERROR, "Invalid channel info size %d\n",
|
av_log(avctx, AV_LOG_ERROR, "Invalid channel info size %d\n",
|
||||||
|
@@ -153,10 +153,17 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb)
|
|||||||
case 3:
|
case 3:
|
||||||
chmask = avio_rl32(pb);
|
chmask = avio_rl32(pb);
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
avio_skip(pb, 1);
|
||||||
|
chan |= (avio_r8(pb) & 0xF) << 8;
|
||||||
|
chan += 1;
|
||||||
|
chmask = avio_rl24(pb);
|
||||||
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
avio_skip(pb, 1);
|
avio_skip(pb, 1);
|
||||||
chan |= (avio_r8(pb) & 0xF) << 8;
|
chan |= (avio_r8(pb) & 0xF) << 8;
|
||||||
chmask = avio_rl24(pb);
|
chan += 1;
|
||||||
|
chmask = avio_rl32(pb);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_log(ctx, AV_LOG_ERROR,
|
av_log(ctx, AV_LOG_ERROR,
|
||||||
|
Reference in New Issue
Block a user