[xiph-commits] r9598 - trunk/ogg/src

msmith at svn.xiph.org msmith at svn.xiph.org
Fri Jul 22 09:39:45 PDT 2005


Author: msmith
Date: 2005-07-22 09:39:42 -0700 (Fri, 22 Jul 2005)
New Revision: 9598

Modified:
   trunk/ogg/src/framing.c
Log:
According to the Ogg specification, an ogg page that doesn't have any 
packets ending on it (which commonly happens with video keyframes, for 
instance) must have a granulepos of -1. 

libogg never implemented this correctly; this patch ensures it does.


Modified: trunk/ogg/src/framing.c
===================================================================
--- trunk/ogg/src/framing.c	2005-07-21 13:39:59 UTC (rev 9597)
+++ trunk/ogg/src/framing.c	2005-07-22 16:39:42 UTC (rev 9598)
@@ -336,7 +336,7 @@
   int maxvals=(os->lacing_fill>255?255:os->lacing_fill);
   int bytes=0;
   long acc=0;
-  ogg_int64_t granule_pos=os->granule_vals[0];
+  ogg_int64_t granule_pos=-1;
 
   if(maxvals==0)return(0);
   
@@ -357,7 +357,8 @@
     for(vals=0;vals<maxvals;vals++){
       if(acc>4096)break;
       acc+=os->lacing_vals[vals]&0x0ff;
-      granule_pos=os->granule_vals[vals];
+      if((os->lacing_vals[vals]&0xff)<255)
+        granule_pos=os->granule_vals[vals];
     }
   }
   



More information about the commits mailing list