[FFmpeg-cvslog] lavf/wavdec: skip padding byte

Matthieu Bouron git at videolan.org
Mon Apr 8 20:23:32 CEST 2013


ffmpeg | branch: master | Matthieu Bouron <matthieu.bouron at gmail.com> | Mon Apr  8 18:27:11 2013 +0200| [1f2ce32825f7ca14c3bd90ef2781d75e8b704d41] | committer: Michael Niedermayer

lavf/wavdec: skip padding byte

WAV chunks must be even aligned. This patch skip the extra padding byte
if chunk size is odd.

Fixes ticket #2417.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f2ce32825f7ca14c3bd90ef2781d75e8b704d41
---

 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) {



More information about the ffmpeg-cvslog mailing list