[xiph-commits] r13136 - trunk/vorbis-tools/oggenc

msmith at svn.xiph.org msmith at svn.xiph.org
Sat Jun 16 14:12:30 PDT 2007


Author: msmith
Date: 2007-06-16 14:12:29 -0700 (Sat, 16 Jun 2007)
New Revision: 13136

Modified:
   trunk/vorbis-tools/oggenc/audio.c
Log:
Little hack to handle AIFF chunks in an unexpected order (will only work in 
seekable input)


Modified: trunk/vorbis-tools/oggenc/audio.c
===================================================================
--- trunk/vorbis-tools/oggenc/audio.c	2007-06-16 13:51:30 UTC (rev 13135)
+++ trunk/vorbis-tools/oggenc/audio.c	2007-06-16 21:12:29 UTC (rev 13136)
@@ -149,11 +149,19 @@
 static int find_aiff_chunk(FILE *in, char *type, unsigned int *len)
 {
     unsigned char buf[8];
+    int restarted = 0;
 
     while(1)
     {
         if(fread(buf,1,8,in) <8)
         {
+            if(!restarted) {
+                /* Handle out of order chunks by seeking back to the start
+                 * to retry */
+                restarted = 1;
+                fseek(in, 12, SEEK_SET);
+                continue;
+            }
             fprintf(stderr, _("Warning: Unexpected EOF in AIFF chunk\n"));
             return 0;
         }



More information about the commits mailing list