[cvs-annodex] commit (/annodex): libannodex/trunk/src/libannodex/anx_track.c

conrad nobody at lists.annodex.net
Tue Jan 25 20:31:04 EST 2005


Update of /annodex (new revision 730)

Modified files:
   libannodex/trunk/src/libannodex/anx_track.c

Log Message:
add granuleshift support in granules to time calculation


Modified: libannodex/trunk/src/libannodex/anx_track.c
===================================================================
--- libannodex/trunk/src/libannodex/anx_track.c	2005-01-25 06:32:34 UTC (rev 729)
+++ libannodex/trunk/src/libannodex/anx_track.c	2005-01-25 09:31:03 UTC (rev 730)
@@ -214,6 +214,8 @@
 _anx_granules_to_time (ANNODEX * annodex, long serialno, anx_int64_t granules)
 {
   AnxTrack * track;
+  anx_int64_t g;
+  anx_int64_t iframe, pframe;
   double seconds;
 
   /* XXX: is this all ok for interval != 1 ? */
@@ -229,9 +231,16 @@
     return -1.0;
   }
 
+  if (track->granuleshift == 0) {
+    g = granules;
+  } else {
+    iframe = granules >> track->granuleshift;
+    pframe = granules - (iframe << track->granuleshift);
+    g = iframe + pframe;
+  }
+
   seconds =
-    (double)(granules * track->granule_rate_d) /
-    (double)track->granule_rate_n;
+    (double)(g * track->granule_rate_d) / (double)track->granule_rate_n;
 
   /*  return seconds + annodex->timebase;*/
   return seconds;


-- 
conrad



More information about the cvs-annodex mailing list