On Tue, Jun 28, 2011 at 11:16:28AM +0100, Måns Rullgård wrote: > Kostya Shishkov <[email protected]> writes: > > > --- > > libavformat/wv.c | 13 +++++++++++-- > > 1 files changed, 11 insertions(+), 2 deletions(-) > > Please fix the commit message. It should have a short "subject" line > optionally followed by a longer description in the body. Something like > this: > > wavpack: skip blocks with no samples > > These blocks do not report audio stream parameters and are not needed > for decoding.
Here it is.
>From f796a8fa1e819ba53cac18ff0b04e807f2579b2c Mon Sep 17 00:00:00 2001 From: Kostya Shishkov <[email protected]> Date: Tue, 28 Jun 2011 11:49:32 +0200 Subject: [PATCH] wavpack: skip blocks with no samples These blocks don't report audio stream parameters and they are not needed for decoding. --- libavformat/wv.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libavformat/wv.c b/libavformat/wv.c index 8f9d0fd..d6d7099 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); -- 1.7.0.4
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
