shithub: sox

Download patch

ref: c5f3b6043580e38e72d477a64387a894e5a2e6a0
parent: 64d81b4c12296210cca712ca7ad49e5cc63477b2
author: cbagwell <cbagwell>
date: Tue Feb 15 23:12:16 EST 2011

Handle Logic Pro WAV files that correctly word align its chunks.
This was issue for chunks we are skipping over anyways.

--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,8 @@
     Closes bug #3017690.  (Reuben Thomas).
   o Fix memory leak in ffmpeg. (Doug Cook)
   o Handle 0 length chunks in WAV files gracefully.  (Beat Jorg)
+  o When skipping over chunks, account for word alignment. Helps
+    with some Logic Pro generated files.  (D Lambley)
 
 Audio device drivers:
 
--- a/src/wav.c
+++ b/src/wav.c
@@ -392,6 +392,9 @@
         if (strncmp(Label, magic, (size_t)4) == 0)
             break; /* Found the given chunk */
 
+	/* Chunks are required to be word aligned. */
+	if ((*len) % 2) (*len)++;
+
         /* skip to next chunk */
         if (*len > 0 && lsx_seeki(ft, (off_t)(*len), SEEK_CUR) != SOX_SUCCESS)
         {