Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
(cherry picked from commit dacbcd170a329dda2014159ca9fc9d11d887625c)
... | ... |
@@ -706,7 +706,7 @@ static av_cold int wavpack_decode_init(AVCodecContext *avctx) |
706 | 706 |
else |
707 | 707 |
avctx->sample_fmt = AV_SAMPLE_FMT_S32; |
708 | 708 |
if(avctx->channels <= 2 && !avctx->channel_layout) |
709 |
- avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; |
|
709 |
+ avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; |
|
710 | 710 |
|
711 | 711 |
s->multichannel = avctx->channels > 2; |
712 | 712 |
/* lavf demuxer does not provide extradata, Matroska stores 0x403 |
... | ... |
@@ -775,11 +775,11 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no, |
775 | 775 |
} |
776 | 776 |
|
777 | 777 |
if(!wc->mkv_mode){ |
778 |
- s->samples = AV_RL32(buf); buf += 4; |
|
779 |
- if(!s->samples){ |
|
780 |
- *data_size = 0; |
|
781 |
- return buf_size; |
|
782 |
- } |
|
778 |
+ s->samples = AV_RL32(buf); buf += 4; |
|
779 |
+ if(!s->samples){ |
|
780 |
+ *data_size = 0; |
|
781 |
+ return buf_size; |
|
782 |
+ } |
|
783 | 783 |
}else{ |
784 | 784 |
s->samples = wc->samples; |
785 | 785 |
} |
... | ... |
@@ -85,25 +85,25 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app |
85 | 85 |
|
86 | 86 |
wc->pos = url_ftell(pb); |
87 | 87 |
if(!append){ |
88 |
- tag = get_le32(pb); |
|
89 |
- if (tag != MKTAG('w', 'v', 'p', 'k')) |
|
90 |
- return -1; |
|
91 |
- size = get_le32(pb); |
|
92 |
- if(size < 24 || size > WV_BLOCK_LIMIT){ |
|
93 |
- av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size); |
|
94 |
- return -1; |
|
95 |
- } |
|
96 |
- wc->blksize = size; |
|
97 |
- ver = get_le16(pb); |
|
98 |
- if(ver < 0x402 || ver > 0x410){ |
|
99 |
- av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver); |
|
100 |
- return -1; |
|
101 |
- } |
|
102 |
- get_byte(pb); // track no |
|
103 |
- get_byte(pb); // track sub index |
|
104 |
- wc->samples = get_le32(pb); // total samples in file |
|
105 |
- wc->soff = get_le32(pb); // offset in samples of current block |
|
106 |
- get_buffer(pb, wc->extra, WV_EXTRA_SIZE); |
|
88 |
+ tag = get_le32(pb); |
|
89 |
+ if (tag != MKTAG('w', 'v', 'p', 'k')) |
|
90 |
+ return -1; |
|
91 |
+ size = get_le32(pb); |
|
92 |
+ if(size < 24 || size > WV_BLOCK_LIMIT){ |
|
93 |
+ av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size); |
|
94 |
+ return -1; |
|
95 |
+ } |
|
96 |
+ wc->blksize = size; |
|
97 |
+ ver = get_le16(pb); |
|
98 |
+ if(ver < 0x402 || ver > 0x410){ |
|
99 |
+ av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver); |
|
100 |
+ return -1; |
|
101 |
+ } |
|
102 |
+ get_byte(pb); // track no |
|
103 |
+ get_byte(pb); // track sub index |
|
104 |
+ wc->samples = get_le32(pb); // total samples in file |
|
105 |
+ wc->soff = get_le32(pb); // offset in samples of current block |
|
106 |
+ get_buffer(pb, wc->extra, WV_EXTRA_SIZE); |
|
107 | 107 |
}else{ |
108 | 108 |
size = wc->blksize; |
109 | 109 |
} |