[FFmpeg-devel] [PATCH] lavf/wavdec: skip padding byte
Matthieu Bouron
matthieu.bouron at gmail.com
Mon Apr 8 19:28:29 CEST 2013
On Mon, Apr 08, 2013 at 07:05:58PM +0200, Matthieu Bouron wrote:
> Fixes ticket #2417.
> ---
> libavformat/wavdec.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
> index 782fa64..a561958 100644
> --- a/libavformat/wavdec.c
> +++ b/libavformat/wavdec.c
> @@ -354,6 +354,10 @@ static int wav_read_header(AVFormatContext *s)
> break;
> }
>
> + /* skip padding byte */
> + if (next_tag_ofs < INT64_MAX && next_tag_ofs & 1)
> + next_tag_ofs += 1;
> +
> /* seek to next tag unless we know that we'll run into EOF */
> if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) ||
> avio_seek(pb, next_tag_ofs, SEEK_SET) < 0) {
> --
> 1.8.2
>
Patch updated. The find_tag function is also fixed to skip the padding
byte if present.
Please comment,
Matthieu
-------------- next part --------------
>From b5a31475d537b7371298ad83673883d97b124f95 Mon Sep 17 00:00:00 2001
From: Matthieu Bouron <matthieu.bouron at gmail.com>
Date: Mon, 8 Apr 2013 18:27:11 +0200
Subject: [PATCH] lavf/wavdec: skip padding byte
Fixes ticket #2417.
---
libavformat/wavdec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 782fa64..14c52f8 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -74,7 +74,7 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
size = next_tag(pb, &tag);
if (tag == tag1)
break;
- avio_skip(pb, size);
+ avio_skip(pb, size + (size & 1));
}
return size;
}
@@ -354,6 +354,9 @@ static int wav_read_header(AVFormatContext *s)
break;
}
+ /* skip padding byte */
+ next_tag_ofs += (next_tag_ofs < INT64_MAX && next_tag_ofs & 1);
+
/* seek to next tag unless we know that we'll run into EOF */
if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) ||
avio_seek(pb, next_tag_ofs, SEEK_SET) < 0) {
--
1.8.2
More information about the ffmpeg-devel
mailing list