diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2011-06-28 11:49:32 +0200 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2011-06-29 19:47:12 +0200 |
commit | 9482dd0d17435c9b5b46d44cdf8af21b1f09235c (patch) | |
tree | d0589194e2b52e4a4358131f7d015f5666efdb7d | |
parent | 87eedf69433d95a40830a98bb2d656a04dfd4609 (diff) | |
download | ffmpeg-9482dd0d17435c9b5b46d44cdf8af21b1f09235c.tar.gz |
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>
(cherry picked from commit cb7b55b0962f5503f601d6b557f8945444b73395)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-rw-r--r-- | libavformat/wv.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libavformat/wv.c b/libavformat/wv.c index 8f9d0fdb1b..d6d7099ba7 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -110,6 +110,9 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen size = wc->blksize; } 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 bpp = ((wc->flags & 3) + 1) << 3; chan = 1 + !(wc->flags & WV_MONO); @@ -207,8 +210,14 @@ static int wv_read_header(AVFormatContext *s, AVStream *st; wc->block_parsed = 0; - if(wv_read_block_header(s, pb, 0) < 0) - return -1; + for(;;){ + if(wv_read_block_header(s, pb, 0) < 0) + return -1; + if(!AV_RN32(wc->extra)) + avio_skip(pb, wc->blksize - 24); + else + break; + } /* now we are ready: build format streams */ st = av_new_stream(s, 0); |