mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-14 00:58:38 +02:00
wavpack: skip blocks with no samples
These blocks don't report audio stream parameters and they are not needed for decoding. Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
parent
bd2deab706
commit
cb7b55b096
@ -110,6 +110,9 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
|
|||||||
size = wc->blksize;
|
size = wc->blksize;
|
||||||
}
|
}
|
||||||
wc->flags = AV_RL32(wc->extra + 4);
|
wc->flags = AV_RL32(wc->extra + 4);
|
||||||
|
// blocks with zero samples don't contain actual audio information and should be ignored
|
||||||
|
if (!AV_RN32(wc->extra))
|
||||||
|
return 0;
|
||||||
//parse flags
|
//parse flags
|
||||||
bpp = ((wc->flags & 3) + 1) << 3;
|
bpp = ((wc->flags & 3) + 1) << 3;
|
||||||
chan = 1 + !(wc->flags & WV_MONO);
|
chan = 1 + !(wc->flags & WV_MONO);
|
||||||
@ -207,8 +210,14 @@ static int wv_read_header(AVFormatContext *s,
|
|||||||
AVStream *st;
|
AVStream *st;
|
||||||
|
|
||||||
wc->block_parsed = 0;
|
wc->block_parsed = 0;
|
||||||
|
for(;;){
|
||||||
if(wv_read_block_header(s, pb, 0) < 0)
|
if(wv_read_block_header(s, pb, 0) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
if(!AV_RN32(wc->extra))
|
||||||
|
avio_skip(pb, wc->blksize - 24);
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* now we are ready: build format streams */
|
/* now we are ready: build format streams */
|
||||||
st = av_new_stream(s, 0);
|
st = av_new_stream(s, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user