[xiph-commits] r3805 - liboggz/trunk/src/tools

conrad at svn.annodex.net conrad at svn.annodex.net
Thu Nov 20 19:36:56 PST 2008


Author: conrad
Date: 2008-11-20 19:36:55 -0800 (Thu, 20 Nov 2008)
New Revision: 3805

Modified:
   liboggz/trunk/src/tools/oggz-info.c
   liboggz/trunk/src/tools/oggz-validate.c
Log:
oggz-info, oggz-validate: update internal gp_to_time() for Dirac


Modified: liboggz/trunk/src/tools/oggz-info.c
===================================================================
--- liboggz/trunk/src/tools/oggz-info.c	2008-11-21 03:22:58 UTC (rev 3804)
+++ liboggz/trunk/src/tools/oggz-info.c	2008-11-21 03:36:55 UTC (rev 3805)
@@ -135,14 +135,18 @@
 gp_to_granule (OGGZ * oggz, long serialno, ogg_int64_t granulepos)
 {
   int granuleshift;
-  ogg_int64_t iframe, pframe;
+  ogg_int64_t iframe, pframe, granule;
 
   granuleshift = oggz_get_granuleshift (oggz, serialno);
 
   iframe = granulepos >> granuleshift;
   pframe = granulepos - (iframe << granuleshift);
+  granule = iframe + pframe;
 
-  return (iframe + pframe);
+  if (oggz_stream_get_content (oggz, serialno) == OGGZ_CONTENT_DIRAC)
+    granule >>= 9;
+
+  return granule;
 }
 
 static double

Modified: liboggz/trunk/src/tools/oggz-validate.c
===================================================================
--- liboggz/trunk/src/tools/oggz-validate.c	2008-11-21 03:22:58 UTC (rev 3804)
+++ liboggz/trunk/src/tools/oggz-validate.c	2008-11-21 03:36:55 UTC (rev 3805)
@@ -159,14 +159,18 @@
 gp_to_granule (OGGZ * oggz, long serialno, ogg_int64_t granulepos)
 {
   int granuleshift;
-  ogg_int64_t iframe, pframe;
+  ogg_int64_t iframe, pframe, granule;
 
   granuleshift = oggz_get_granuleshift (oggz, serialno);
 
   iframe = granulepos >> granuleshift;
   pframe = granulepos - (iframe << granuleshift);
+  granule = iframe+pframe;
 
-  return (iframe + pframe);
+  if (oggz_stream_get_content (oggz, serialno) == OGGZ_CONTENT_DIRAC)
+    granule >>= 9;
+
+  return granule;
 }
 
 static timestamp_t



More information about the commits mailing list