[xiph-commits] r3190 - oogg/trunk

shans at svn.annodex.net shans at svn.annodex.net
Tue Aug 14 16:37:25 PDT 2007


Author: shans
Date: 2007-08-14 16:37:24 -0700 (Tue, 14 Aug 2007)
New Revision: 3190

Modified:
   oogg/trunk/packet.ml
Log:
Modified last_granulepos cache in packet reconstruction to be used correctly



Modified: oogg/trunk/packet.ml
===================================================================
--- oogg/trunk/packet.ml	2007-08-14 07:40:27 UTC (rev 3189)
+++ oogg/trunk/packet.ml	2007-08-14 23:37:24 UTC (rev 3190)
@@ -37,13 +37,19 @@
 type reconstruct_context = {
   rc_tf : granulePos -> float option;
   mutable rc_cache : packet list;
-  rc_lgp : granulePos option;
+  mutable rc_lgp : granulePos
+  (*rc_ngpf : string -> string -> granulePos -> granulePos;*)
 } ;;
 
-let packet_from_last_gp crec pack gp =
+(* reconstruct packet given a previous gp *)
+let packet_from_last_gp crec pack =
+  let gp = crec.rc_lgp in
   let new_gp = Granules.calculate_next_gp pack.p_page.identity gp in
+  crec.rc_lgp <- new_gp;
   [< '{ pack with p_granulepos = new_gp; p_time = crec.rc_tf new_gp } >]
 
+(* flush the non-timestamped packets from the context record now that we
+   have a real granulepos *)
 let new_gp_and_flush crec pack = 
   let rec _ngaf l gp = match l with
   | h::t -> (
@@ -53,6 +59,7 @@
   | [] -> [< >] in
   let l = crec.rc_cache in
   crec.rc_cache <- [];
+  crec.rc_lgp <- pack.p_granulepos;
   [< _ngaf l pack.p_granulepos; 'pack >]
 
 let reconstruct_packet context pack =
@@ -75,7 +82,7 @@
   match gp with 
   | None -> (match crec.rc_lgp with
             | None -> (crec.rc_cache <- pack::crec.rc_cache; [< >])
-            | Some gp -> packet_from_last_gp crec pack gp)
+            | Some _ -> packet_from_last_gp crec pack)
   | Some gp -> [< new_gp_and_flush crec pack >];;
 
 let reconstruct_timing pstream = 



More information about the commits mailing list