[xiph-commits] r3182 - / oogg oogg/trunk

shans at svn.annodex.net shans at svn.annodex.net
Sun Aug 12 23:23:52 PDT 2007


Author: shans
Date: 2007-08-12 23:23:51 -0700 (Sun, 12 Aug 2007)
New Revision: 3182

Added:
   oogg/
   oogg/trunk/
   oogg/trunk/Makefile
   oogg/trunk/\
   oogg/trunk/crc.ml
   oogg/trunk/crc.mli
   oogg/trunk/file.ml
   oogg/trunk/file.mli
   oogg/trunk/gmon.out
   oogg/trunk/granules.ml
   oogg/trunk/granules.mli
   oogg/trunk/mediaStream.ml
   oogg/trunk/mediaStream.mli
   oogg/trunk/oanx
   oogg/trunk/oogg
   oogg/trunk/oogg_check_checksums.ml
   oogg/trunk/oogg_copy_file.ml
   oogg/trunk/oogg_dump_pages.ml
   oogg/trunk/oogg_info.ml
   oogg/trunk/oogg_rip.ml
   oogg/trunk/page.ml
   oogg/trunk/page.mli
   oogg/trunk/page_util.ml
   oogg/trunk/page_util.mli
   oogg/trunk/svn-commit.2.tmp
   oogg/trunk/svn-commit.tmp
   oogg/trunk/types.ml
   oogg/trunk/types.mli
Log:


Added: oogg/trunk/Makefile
===================================================================
--- oogg/trunk/Makefile	                        (rev 0)
+++ oogg/trunk/Makefile	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,32 @@
+PROGRAMS = oogg_dump_pages oogg_copy_file oogg_rip oogg_check_checksums oogg_info
+LIBINCS = -I +camlp4 -I +extlib
+LIBS = camlp4.cmxa unix.cmxa extLib.cmxa oogg.cmxa 
+PROF = -p 
+
+all: $(PROGRAMS)
+
+oogg_dump_pages: oogg.cmxa oogg_dump_pages.ml
+	ocamlopt $(PROF) -o oogg_dump_pages $(LIBINCS) $(LIBS) \
+							oogg_dump_pages.ml
+
+oogg_info: oogg.cmxa oogg_info.ml
+	ocamlopt $(PROF) -o oogg_info $(LIBINCS) $(LIBS) oogg_info.ml
+
+oogg_check_checksums: oogg.cmxa oogg_check_checksums.ml
+	ocamlopt $(PROF) -o oogg_check_checksums $(LIBINCS) $(LIBS) \
+            oogg_check_checksums.ml
+
+oogg_copy_file: oogg.cmxa oogg_copy_file.ml
+	ocamlopt $(PROF) -o oogg_copy_file $(LIBINCS) $(LIBS) oogg_copy_file.ml
+
+oogg_rip: oogg.cmxa oogg_rip.ml
+	ocamlopt $(PROF) -o oogg_rip $(LIBINCS) $(LIBS) oogg_rip.ml
+	
+oogg.cmxa: types.cmx crc.cmx file.cmx granules.cmx page.cmx page_util.cmx mediaStream.cmx 
+	ocamlopt $(PROF) -a -o oogg.cmxa -i $^
+
+%.cmx: %.mli %.ml
+	ocamlopt $(PROF) -c $(LIBINCS) -pp 'camlp4o' $^
+
+clean:
+	rm -rf *.cmx *.cmxa *.cmo $(PROGRAMS) *.cmi *.o *.a

Added: oogg/trunk/\
===================================================================
--- oogg/trunk/\	                        (rev 0)
+++ oogg/trunk/\	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,100 @@
+
+type oogg64 = (int * int * int * int);;
+type oogg32 = (int * int);;
+
+type serialNo = oogg32;;
+type granulePos = oogg64;;
+type checksum = oogg32;;
+type sequenceNo = oogg32;;
+
+(* raw byte streams *)
+type stream = IO.input;;
+type outStream = unit IO.output;;
+
+(*
+ * an oogg Page record
+ *) 
+type rawPage = 
+  { continued : bool ;
+    bos : bool ;
+    eos : bool ;
+    last_packet_complete : bool ;
+    granulepos : granulePos ;
+    serialno : serialNo ;
+    sequenceno : sequenceNo ;
+    checksum : checksum ;
+    packet_sizes : int list ;
+    raw_data : string list ;
+  };;
+
+(* media types *)
+type mediaType = Skeleton | CMML | Vorbis | Theora | Unknown;;
+
+type page = 
+  { raw : rawPage ;
+    time : float ; 
+    identity : mediaType
+  };;
+
+type rawPageStream  = rawPage Stream.t;;
+
+type pageStream = page Stream.t;;
+
+(* the type of a media stream *)
+type mediaStream =
+  { stream_serialno : serialNo ;
+    stream_pages : rawPageStream ;
+    stream_type : mediaType ;
+    stream_time : (granulePos -> float) option
+  };;
+
+let oogg32_to_int64 (a, b) =
+    Int64.add (Int64.of_int b) (Int64.shift_left (Int64.of_int a) 16);; 
+
+let oogg64_to_int64 (a,b,c,d) =
+  Int64.add 
+    (oogg32_to_int64 (c,d)) 
+    (Int64.shift_left (oogg32_to_int64 (a,b)) 32);;
+
+let int64_to_oogg32 value =
+    (Int64.to_int (Int64.shift_right value 16),
+    Int64.to_int (Int64.logand value (Int64.of_int 0xFFFF)));;
+
+let int64_to_oogg64 value =
+  if (a,b,c,d) = (65535, 65535, 65535, 65535) then -1 else
+  let mask = Int64.of_int 0xFFFF in
+  (Int64.to_int (Int64.shift_right value 48),
+   Int64.to_int (Int64.logand (Int64.shift_right value 32) mask),
+   Int64.to_int (Int64.logand (Int64.shift_right value 16) mask),
+   Int64.to_int (Int64.logand value mask));;
+
+let oogg64_to_float (a,b,c,d) = 
+  if (a,b,c,d) = (65535, 65535, 65535, 65535) then -1.0 else
+  float_of_int a *. (256. ** 6.) +.
+  float_of_int b *. (256. ** 4.) +.
+  float_of_int c *. (256. ** 2.) +.
+  float_of_int d;;
+
+let oogg32_to_string value = Int64.to_string (oogg32_to_int64 value);;
+
+let print_oogg32 value = 
+  print_string (oogg32_to_string value)
+
+let print_oogg64 (a,b,c,d) =
+  if a > 0 then
+    Printf.printf "%x%04x%04x%04x" a b c d
+  else if b > 0 then
+    Printf.printf "%x%04x%04x" b c d
+  else if c > 0 then
+    Printf.printf "%x%04x" c d
+  else
+    Printf.printf "%x" d;;
+
+let print_mediaType t = print_string (match t with
+  | Skeleton -> "Skeleton"
+  | CMML     -> "CMML"
+  | Vorbis   -> "Vorbis"
+  | Theora   -> "Theora"
+  | Unknown  -> "Unknown!");;
+
+

Added: oogg/trunk/crc.ml
===================================================================
--- oogg/trunk/crc.ml	                        (rev 0)
+++ oogg/trunk/crc.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,78 @@
+
+let crc_lookup = [|
+  0x00000000L;0x04c11db7L;0x09823b6eL;0x0d4326d9L;
+  0x130476dcL;0x17c56b6bL;0x1a864db2L;0x1e475005L;
+  0x2608edb8L;0x22c9f00fL;0x2f8ad6d6L;0x2b4bcb61L;
+  0x350c9b64L;0x31cd86d3L;0x3c8ea00aL;0x384fbdbdL;
+  0x4c11db70L;0x48d0c6c7L;0x4593e01eL;0x4152fda9L;
+  0x5f15adacL;0x5bd4b01bL;0x569796c2L;0x52568b75L;
+  0x6a1936c8L;0x6ed82b7fL;0x639b0da6L;0x675a1011L;
+  0x791d4014L;0x7ddc5da3L;0x709f7b7aL;0x745e66cdL;
+  0x9823b6e0L;0x9ce2ab57L;0x91a18d8eL;0x95609039L;
+  0x8b27c03cL;0x8fe6dd8bL;0x82a5fb52L;0x8664e6e5L;
+  0xbe2b5b58L;0xbaea46efL;0xb7a96036L;0xb3687d81L;
+  0xad2f2d84L;0xa9ee3033L;0xa4ad16eaL;0xa06c0b5dL;
+  0xd4326d90L;0xd0f37027L;0xddb056feL;0xd9714b49L;
+  0xc7361b4cL;0xc3f706fbL;0xceb42022L;0xca753d95L;
+  0xf23a8028L;0xf6fb9d9fL;0xfbb8bb46L;0xff79a6f1L;
+  0xe13ef6f4L;0xe5ffeb43L;0xe8bccd9aL;0xec7dd02dL;
+  0x34867077L;0x30476dc0L;0x3d044b19L;0x39c556aeL;
+  0x278206abL;0x23431b1cL;0x2e003dc5L;0x2ac12072L;
+  0x128e9dcfL;0x164f8078L;0x1b0ca6a1L;0x1fcdbb16L;
+  0x018aeb13L;0x054bf6a4L;0x0808d07dL;0x0cc9cdcaL;
+  0x7897ab07L;0x7c56b6b0L;0x71159069L;0x75d48ddeL;
+  0x6b93dddbL;0x6f52c06cL;0x6211e6b5L;0x66d0fb02L;
+  0x5e9f46bfL;0x5a5e5b08L;0x571d7dd1L;0x53dc6066L;
+  0x4d9b3063L;0x495a2dd4L;0x44190b0dL;0x40d816baL;
+  0xaca5c697L;0xa864db20L;0xa527fdf9L;0xa1e6e04eL;
+  0xbfa1b04bL;0xbb60adfcL;0xb6238b25L;0xb2e29692L;
+  0x8aad2b2fL;0x8e6c3698L;0x832f1041L;0x87ee0df6L;
+  0x99a95df3L;0x9d684044L;0x902b669dL;0x94ea7b2aL;
+  0xe0b41de7L;0xe4750050L;0xe9362689L;0xedf73b3eL;
+  0xf3b06b3bL;0xf771768cL;0xfa325055L;0xfef34de2L;
+  0xc6bcf05fL;0xc27dede8L;0xcf3ecb31L;0xcbffd686L;
+  0xd5b88683L;0xd1799b34L;0xdc3abdedL;0xd8fba05aL;
+  0x690ce0eeL;0x6dcdfd59L;0x608edb80L;0x644fc637L;
+  0x7a089632L;0x7ec98b85L;0x738aad5cL;0x774bb0ebL;
+  0x4f040d56L;0x4bc510e1L;0x46863638L;0x42472b8fL;
+  0x5c007b8aL;0x58c1663dL;0x558240e4L;0x51435d53L;
+  0x251d3b9eL;0x21dc2629L;0x2c9f00f0L;0x285e1d47L;
+  0x36194d42L;0x32d850f5L;0x3f9b762cL;0x3b5a6b9bL;
+  0x0315d626L;0x07d4cb91L;0x0a97ed48L;0x0e56f0ffL;
+  0x1011a0faL;0x14d0bd4dL;0x19939b94L;0x1d528623L;
+  0xf12f560eL;0xf5ee4bb9L;0xf8ad6d60L;0xfc6c70d7L;
+  0xe22b20d2L;0xe6ea3d65L;0xeba91bbcL;0xef68060bL;
+  0xd727bbb6L;0xd3e6a601L;0xdea580d8L;0xda649d6fL;
+  0xc423cd6aL;0xc0e2d0ddL;0xcda1f604L;0xc960ebb3L;
+  0xbd3e8d7eL;0xb9ff90c9L;0xb4bcb610L;0xb07daba7L;
+  0xae3afba2L;0xaafbe615L;0xa7b8c0ccL;0xa379dd7bL;
+  0x9b3660c6L;0x9ff77d71L;0x92b45ba8L;0x9675461fL;
+  0x8832161aL;0x8cf30badL;0x81b02d74L;0x857130c3L;
+  0x5d8a9099L;0x594b8d2eL;0x5408abf7L;0x50c9b640L;
+  0x4e8ee645L;0x4a4ffbf2L;0x470cdd2bL;0x43cdc09cL;
+  0x7b827d21L;0x7f436096L;0x7200464fL;0x76c15bf8L;
+  0x68860bfdL;0x6c47164aL;0x61043093L;0x65c52d24L;
+  0x119b4be9L;0x155a565eL;0x18197087L;0x1cd86d30L;
+  0x029f3d35L;0x065e2082L;0x0b1d065bL;0x0fdc1becL;
+  0x3793a651L;0x3352bbe6L;0x3e119d3fL;0x3ad08088L;
+  0x2497d08dL;0x2056cd3aL;0x2d15ebe3L;0x29d4f654L;
+  0xc5a92679L;0xc1683bceL;0xcc2b1d17L;0xc8ea00a0L;
+  0xd6ad50a5L;0xd26c4d12L;0xdf2f6bcbL;0xdbee767cL;
+  0xe3a1cbc1L;0xe760d676L;0xea23f0afL;0xeee2ed18L;
+  0xf0a5bd1dL;0xf464a0aaL;0xf9278673L;0xfde69bc4L;
+  0x89b8fd09L;0x8d79e0beL;0x803ac667L;0x84fbdbd0L;
+  0x9abc8bd5L;0x9e7d9662L;0x933eb0bbL;0x97ffad0cL;
+  0xafb010b1L;0xab710d06L;0xa6322bdfL;0xa2f33668L;
+  0xbcb4666dL;0xb8757bdaL;0xb5365d03L;0xb1f740b4L |];;
+
+let crc st = 
+  let crc = ref 0L in
+  let iterfun v =
+    crc := Int64.logxor
+      (Int64.logand (Int64.shift_left !crc 8) 0xFFFFFFFFL)
+      (crc_lookup.(Int64.to_int(
+        Int64.logxor 
+          (Int64.logand (Int64.shift_right !crc 24) 0xFFL) 
+          (Int64.of_int (Char.code v))))) in
+  String.iter iterfun st; Types.int64_to_oogg32 !crc;;
+          

Added: oogg/trunk/crc.mli
===================================================================
--- oogg/trunk/crc.mli	                        (rev 0)
+++ oogg/trunk/crc.mli	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1 @@
+val crc : string -> Types.oogg32

Added: oogg/trunk/file.ml
===================================================================
--- oogg/trunk/file.ml	                        (rev 0)
+++ oogg/trunk/file.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,54 @@
+(* 
+ * An oogg file is an abstract type that can be accessed as a stream at a 
+ * particular byte location.  Internally, we use a file descriptor.
+ *)
+
+type file = Unix.file_descr;;
+type stream = IO.input;;
+type outStream = unit IO.output;;
+
+(*
+ * opening an ooggFile
+ *)
+
+let file_open ?(writable=false) name = 
+  if writable then
+    Unix.openfile name [Unix.O_RDWR ; Unix.O_CREAT] 0o644
+  else
+    Unix.openfile name [Unix.O_RDONLY] 0o644;;
+
+(*
+ * align a stream on a page boundary.  We need to look for 'OggS'.
+ * return characters consumed
+ *)
+let rec align stream =
+  let rec _check_value value = 
+    match value with
+    | "OggS" -> 4
+    | l      -> 4 + if (String.contains l 'O') 
+                    then
+                      begin
+                        let p = String.index l 'O' in
+                        let next_read = IO.really_nread stream p in
+                        let result = String.create 4 in
+                        String.blit l p result 0 (4 - p); 
+                        String.blit next_read 0 result (4 - p) p;
+                        _check_value result + p
+                      end
+                    else align stream in 
+  let first_read = IO.really_nread stream 4 in
+  _check_value first_read;;
+
+(*
+ * retrieving a stream from an ooggFile.  Always align to an ogg page.
+ *)
+let to_stream file position =
+  ignore (Unix.lseek file position Unix.SEEK_SET);
+  let input = IO.input_channel (Unix.in_channel_of_descr file) in
+  let offset = (align input) - 4 in
+  ignore (Unix.lseek file (position + offset) Unix.SEEK_SET);
+  IO.input_channel (Unix.in_channel_of_descr file);;
+
+let to_output_stream file position =
+  ignore (Unix.lseek file position Unix.SEEK_SET);
+  IO.output_channel (Unix.out_channel_of_descr file);;

Added: oogg/trunk/file.mli
===================================================================
--- oogg/trunk/file.mli	                        (rev 0)
+++ oogg/trunk/file.mli	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,10 @@
+(* an abstract type for ogg files *)
+type file;;
+
+(* open an ogg file *)
+val file_open : ?writable:bool -> string -> file;;
+
+(* retrieve a stream from an opened file *)
+val to_stream : file -> int -> Types.stream;;
+
+val to_output_stream : file -> int -> Types.outStream;;

Added: oogg/trunk/gmon.out
===================================================================
(Binary files differ)


Property changes on: oogg/trunk/gmon.out
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: oogg/trunk/granules.ml
===================================================================
--- oogg/trunk/granules.ml	                        (rev 0)
+++ oogg/trunk/granules.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,58 @@
+open Types
+
+let extract_be_int32 str pos = 
+  let substr = IO.input_string (String.sub str pos 4) in
+  let a = IO.read_byte substr in
+  let b = IO.read_byte substr in
+  let c = IO.read_byte substr in
+  let d = IO.read_byte substr in
+  let e = (a lsl 8) + b in
+  let f = (c lsl 8) + d in
+  Int64.add (Int64.shift_left (Int64.of_int e) 16) (Int64.of_int f);;
+
+let extract_le_int32 str pos = 
+  let substr = IO.input_string (String.sub str pos 4) in
+  let d = IO.read_byte substr in
+  let c = IO.read_byte substr in
+  let b = IO.read_byte substr in
+  let a = IO.read_byte substr in
+  let e = (a lsl 8) + b in
+  let f = (c lsl 8) + d in
+  Int64.add (Int64.shift_left (Int64.of_int e) 16) (Int64.of_int f);;
+ 
+let extract_int8 str pos = 
+  let substr = IO.input_string (String.sub str pos 1) in
+  IO.read_byte substr;;
+
+let granulerate_time num denom gp =
+  Int64.to_float num *. gp /. Int64.to_float denom;;
+
+let vorbis_time bos gp =
+  let bos_packet = List.hd bos.raw_data in
+  let granule_rate = extract_le_int32 bos_packet 12 in
+  if gp = (0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF) then -1. else
+  granulerate_time 1L granule_rate (oogg64_to_float gp);;
+
+let theora_time bos gp =
+  let bos_packet = List.hd bos.raw_data in
+  let num = extract_be_int32 bos_packet 22 in
+  let denom = extract_be_int32 bos_packet 26 in
+  let shift = 
+    ((extract_int8 bos_packet 40 land 0x03) lsl 3)
+    lor
+    ((extract_int8 bos_packet 41 land 0xe0) lsr 5) in
+  let igp = oogg64_to_int64 gp in
+  if igp = -1L then -1.
+  else (
+    let keyframe = Int64.shift_right igp shift in
+    let offset = Int64.logand igp 
+        (Int64.sub (Int64.shift_left Int64.one shift) Int64.one) in
+    let gpv = Int64.to_float (Int64.add keyframe offset) in
+    granulerate_time denom num gpv
+  );;
+
+let granulerate_function id bos = match id with
+  | Vorbis -> Some (vorbis_time bos)
+  | Theora -> Some (theora_time bos)
+  | _      -> None
+

Added: oogg/trunk/granules.mli
===================================================================
--- oogg/trunk/granules.mli	                        (rev 0)
+++ oogg/trunk/granules.mli	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,2 @@
+val granulerate_function : Types.mediaType -> Types.rawPage -> 
+                    (Types.granulePos -> float) option;;

Added: oogg/trunk/mediaStream.ml
===================================================================
--- oogg/trunk/mediaStream.ml	                        (rev 0)
+++ oogg/trunk/mediaStream.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,118 @@
+open Types
+
+exception PagesAfterEOS;;
+exception UnknownSerialNo;;
+
+(* internal type *)
+type _ooggMediaStream =
+  { _stream_serialno : serialNo ;
+    mutable _stream_cache : option (rawPage list) ;
+    _stream_type : mediaType ;
+    _stream_time : (granulePos -> float) option
+  };;
+
+let rec oogg_find_stream serialno streams = match streams with
+  | h::t when h._stream_serialno = serialno -> h
+  | h::t -> oogg_find_stream serialno t
+  | [] -> raise UnknownSerialNo
+
+(* get the beginning-of-stream pages destructively, but don't remove
+ * any other data 
+ *)
+let rec get_bos_pages instream = match (Stream.peek instream) with
+  | None                              ->  []
+  | Some page when page.bos == false  ->  []
+  | Some page ->
+      begin
+        Stream.junk instream;
+        let identity = Page.identify_bos page in
+        { _stream_serialno = page.serialno; 
+          _stream_cache = (Some [page]);
+          _stream_type = identity; 
+          _stream_time =  None
+        }::(get_bos_pages instream)
+      end;;
+
+let rec get_next_page instream streamslist streamno =
+  let ms = List.nth streamslist streamno in
+  match ms._stream_cache with
+    | None -> None
+    | Some (h::t) -> 
+      begin 
+        if h.eos then 
+          ms._stream_cache <- None 
+        else 
+          ms._stream_cache <- Some t; 
+        Some h 
+      end
+    | Some [] -> 
+      begin
+        let page = Stream.next instream in
+        if page.serialno = ms._stream_serialno then
+          begin
+            if page.eos then ms._stream_cache <- None;
+            Some page
+          end
+        else
+          begin
+            let slist = oogg_find_stream page.serialno streamslist in
+            begin 
+              match slist._stream_cache with
+                | Some foo -> slist._stream_cache <- Some (foo @ [page])
+                | None -> raise PagesAfterEOS 
+            end;
+            get_next_page instream streamslist streamno
+          end
+      end;;
+
+let streamgen instream streamslist streamno count = 
+    get_next_page instream streamslist streamno
+
+(*
+ * we need to convert from a single lazy stream to a list of lazy streams.
+ * When pulling data from any of the streams, we will also be finding data that
+ * belongs in other streams.  Hence, we have an internal data structure that
+ * caches frames, a get_next_page function which returns the next frame for
+ * an output stream and caches frames on the other streams, and a
+ * streamgen generator function with which we create the output streams.  To
+ * start the whole thing off we grab the stream's bos pages.
+ *)
+let to_mediaStreams instream =
+  let streamslist = get_bos_pages instream in
+  let rec _gen_streams sl c = match sl with
+    | []   -> []
+    | h::t -> 
+        begin
+          let s = h._stream_serialno in
+          let ty = h._stream_type in
+          let new_stream = Stream.from (streamgen instream streamslist c) in
+          {
+            stream_serialno=s ; 
+            stream_pages = new_stream ; 
+            stream_type = ty ;
+            stream_time = None
+          }::(_gen_streams t (c+1))
+        end in
+  _gen_streams streamslist 0
+ 
+let rec filter instream snos =
+  if snos = [] then [< >] else
+  match instream with parser
+    | [< 'page ; rest >] 
+             -> if List.exists (fun a -> a = page.serialno) snos then
+                  begin
+                    let snos2 = 
+                      if page.eos then 
+                        List.filter (fun a -> a != page.serialno) snos
+                      else
+                        snos in
+                      [< 'page ; filter rest snos2 >]
+                  end
+                else [< filter rest snos >]
+    | [< >]              -> [< >]
+
+let streamTime mediaStream gp = 
+  match mediaStream.stream_time with 
+    | None -> -1.0
+    | Some f -> f gp;;
+

Added: oogg/trunk/mediaStream.mli
===================================================================
--- oogg/trunk/mediaStream.mli	                        (rev 0)
+++ oogg/trunk/mediaStream.mli	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,5 @@
+val to_mediaStreams : Types.rawPageStream -> Types.mediaStream list;;
+
+val filter : Types.rawPageStream -> Types.serialNo list -> Types.rawPageStream;;
+
+val streamTime : Types.mediaStream -> Types.granulePos -> float;;

Added: oogg/trunk/oanx
===================================================================
--- oogg/trunk/oanx	                        (rev 0)
+++ oogg/trunk/oanx	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,572 @@
+Vorbis 0.000
+Vorbis 0.000
+Vorbis -1.000
+Vorbis 0.000
+Vorbis 0.329
+Vorbis 0.747
+Vorbis 1.160
+Vorbis 1.578
+Vorbis 1.995
+Vorbis 2.413
+Vorbis 2.817
+Vorbis 3.235
+Vorbis 3.641
+Vorbis -1.000
+Vorbis 4.046
+Vorbis 4.431
+Vorbis 4.825
+Vorbis 5.243
+Vorbis 5.605
+Vorbis 5.978
+Vorbis 6.390
+Vorbis 6.741
+Vorbis 7.159
+Vorbis 7.554
+Vorbis 7.943
+Vorbis 8.346
+Vorbis 8.741
+Vorbis 9.159
+Vorbis 9.554
+Vorbis 9.942
+Vorbis 10.360
+Vorbis 10.746
+Vorbis 11.124
+Vorbis 11.510
+Vorbis 11.951
+Vorbis 12.323
+Vorbis 12.707
+Vorbis 13.138
+Vorbis 13.562
+Vorbis 13.942
+Vorbis 14.356
+Vorbis 14.714
+Vorbis 15.109
+Vorbis -1.000
+Vorbis 15.527
+Vorbis 15.922
+Vorbis 16.299
+Vorbis 16.717
+Vorbis 17.112
+Vorbis 17.530
+Vorbis 17.948
+Vorbis 18.366
+Vorbis 18.783
+Vorbis 19.175
+Vorbis 19.567
+Vorbis 19.985
+Vorbis 20.389
+Vorbis 20.778
+Vorbis 21.201
+Vorbis 21.596
+Vorbis 22.021
+Vorbis 22.412
+Vorbis -1.000
+Vorbis 22.815
+Vorbis 23.210
+Vorbis 23.628
+Vorbis 24.036
+Vorbis 24.420
+Vorbis -1.000
+Vorbis 24.815
+Vorbis 25.233
+Vorbis 25.651
+Vorbis 26.046
+Vorbis 26.440
+Vorbis 26.838
+Vorbis 27.256
+Vorbis 27.687
+Vorbis 28.040
+Vorbis 28.458
+Vorbis 28.875
+Vorbis 29.293
+Vorbis 29.711
+Vorbis 30.153
+Vorbis 30.547
+Vorbis 30.974
+Vorbis 31.392
+Vorbis 31.781
+Vorbis 32.158
+Vorbis 32.553
+Vorbis 32.922
+Vorbis 33.340
+Vorbis 33.766
+Vorbis 34.184
+Vorbis 34.602
+Vorbis 34.977
+Vorbis 35.418
+Vorbis -1.000
+Vorbis 35.810
+Vorbis 36.204
+Vorbis -1.000
+Vorbis 36.622
+Vorbis 37.017
+Vorbis 37.374
+Vorbis 37.796
+Vorbis 38.184
+Vorbis 38.602
+Vorbis 38.967
+Vorbis 39.409
+Vorbis 39.827
+Vorbis 40.245
+Vorbis 40.662
+Vorbis 41.069
+Vorbis 41.487
+Vorbis 41.882
+Vorbis 42.265
+Vorbis 42.683
+Vorbis 43.124
+Vorbis 43.565
+Vorbis 43.983
+Vorbis 44.383
+Vorbis 44.777
+Vorbis 45.145
+Vorbis 45.502
+Vorbis 45.867
+Vorbis 46.253
+Vorbis 46.665
+Vorbis 47.061
+Vorbis 47.425
+Vorbis -1.000
+Vorbis 47.791
+Vorbis 48.151
+Vorbis 48.521
+Vorbis 48.885
+Vorbis 49.265
+Vorbis 49.601
+Vorbis 49.978
+Vorbis 50.345
+Vorbis 50.731
+Vorbis 51.126
+Vorbis 51.521
+Vorbis 51.918
+Vorbis 52.322
+Vorbis 52.734
+Vorbis 53.175
+Vorbis 53.593
+Vorbis 53.953
+Vorbis 54.345
+Vorbis 54.763
+Vorbis 55.181
+Vorbis -1.000
+Vorbis 55.600
+Vorbis 56.008
+Vorbis 56.380
+Vorbis 56.797
+Vorbis 57.192
+Vorbis 57.610
+Vorbis 58.006
+Vorbis 58.397
+Vorbis 58.748
+Vorbis 59.111
+Vorbis 59.485
+Vorbis 59.903
+Vorbis 60.321
+Vorbis 60.693
+Vorbis -1.000
+Vorbis 61.090
+Vorbis 61.468
+Vorbis 61.859
+Vorbis 62.257
+Vorbis 62.629
+Vorbis 63.012
+Vorbis 63.430
+Vorbis 63.821
+Vorbis 64.247
+Vorbis -1.000
+Vorbis 64.576
+Vorbis -1.000
+Vorbis 64.985
+Vorbis 65.380
+Vorbis 65.781
+Vorbis 66.222
+Vorbis 66.622
+Vorbis 67.037
+Vorbis 67.432
+Vorbis 67.836
+Vorbis -1.000
+Vorbis 68.245
+Vorbis 68.637
+Vorbis 69.046
+Vorbis 69.409
+Vorbis 69.838
+Vorbis 70.216
+Vorbis 70.631
+Vorbis 71.033
+Vorbis 71.388
+Vorbis -1.000
+Vorbis 71.783
+Vorbis 72.149
+Vorbis 72.532
+Vorbis 72.927
+Vorbis 73.318
+Vorbis 73.673
+Vorbis 74.076
+Vorbis 74.442
+Vorbis 74.832
+Vorbis 75.167
+Vorbis 75.559
+Vorbis 75.928
+Vorbis 76.346
+Vorbis 76.764
+Vorbis 77.148
+Vorbis 77.492
+Vorbis 77.872
+Vorbis 78.250
+Vorbis 78.662
+Vorbis 79.080
+Vorbis 79.498
+Vorbis 79.920
+Vorbis 80.279
+Vorbis 80.702
+Vorbis 81.094
+Vorbis 81.492
+Vorbis 81.878
+Vorbis 82.303
+Vorbis 82.691
+Vorbis 83.082
+Vorbis 83.500
+Vorbis 83.913
+Vorbis 84.304
+Vorbis 84.676
+Vorbis 85.076
+Vorbis 85.480
+Vorbis 85.878
+Vorbis 86.255
+Vorbis 86.644
+Vorbis 87.023
+Vorbis 87.384
+Vorbis 87.793
+Vorbis 88.182
+Vorbis 88.594
+Vorbis 88.986
+Vorbis 89.381
+Vorbis 89.755
+Vorbis 90.156
+Vorbis 90.574
+Vorbis 91.014
+Vorbis 91.468
+Vorbis 91.909
+Vorbis 92.330
+Vorbis 92.719
+Vorbis 93.084
+Vorbis 93.526
+Vorbis 93.897
+Vorbis 94.260
+Vorbis -1.000
+Vorbis 94.662
+Vorbis 95.047
+Vorbis 95.464
+Vorbis 95.882
+Vorbis 96.271
+Vorbis 96.689
+Vorbis 97.084
+Vorbis 97.502
+Vorbis 97.908
+Vorbis 98.289
+Vorbis 98.730
+Vorbis 99.184
+Vorbis 99.540
+Vorbis 99.920
+Vorbis 100.320
+Vorbis 100.727
+Vorbis 101.191
+Vorbis 101.516
+Vorbis 101.934
+Vorbis 102.354
+Vorbis 102.715
+Vorbis 103.124
+Vorbis 103.532
+Vorbis 103.902
+Vorbis 104.294
+Vorbis 104.686
+Vorbis 105.127
+Vorbis 105.527
+Vorbis 105.945
+Vorbis 106.363
+Vorbis 106.805
+Vorbis 107.269
+Vorbis 107.640
+Vorbis 108.032
+Vorbis 108.436
+Vorbis 108.832
+Vorbis 109.163
+Vorbis 109.510
+Vorbis 109.925
+Vorbis 110.285
+Vorbis 110.679
+Vorbis 111.065
+Vorbis 111.483
+Vorbis 111.896
+Vorbis 112.313
+Vorbis 112.755
+Vorbis 113.162
+Vorbis -1.000
+Vorbis 113.521
+Vorbis 113.939
+Vorbis 114.380
+Vorbis 114.798
+Vorbis 115.229
+Vorbis -1.000
+Vorbis 115.602
+Vorbis 115.976
+Vorbis 116.360
+Vorbis 116.778
+Vorbis 117.168
+Vorbis 117.532
+Vorbis 117.950
+Vorbis 118.359
+Vorbis 118.769
+Vorbis -1.000
+Vorbis 119.123
+Vorbis 119.506
+Vorbis 119.921
+Vorbis 120.350
+Vorbis 120.768
+Vorbis 121.186
+Vorbis 121.604
+Vorbis 122.022
+Vorbis 122.463
+Vorbis 122.881
+Vorbis 123.299
+Vorbis 123.717
+Vorbis 124.135
+Vorbis 124.577
+Vorbis 124.994
+Vorbis 125.395
+Vorbis 125.836
+Vorbis 126.254
+Vorbis 126.672
+Vorbis 127.113
+Vorbis 127.531
+Vorbis 127.949
+Vorbis 128.367
+Vorbis 128.785
+Vorbis 129.197
+Vorbis 129.615
+Vorbis 130.033
+Vorbis 130.451
+Vorbis 130.875
+Vorbis 131.316
+Vorbis 131.757
+Vorbis 132.175
+Vorbis 132.593
+Vorbis 133.011
+Vorbis 133.452
+Vorbis 133.894
+Vorbis 134.285
+Vorbis 134.674
+Vorbis 135.079
+Vorbis 135.461
+Vorbis 135.870
+Vorbis 136.256
+Vorbis -1.000
+Vorbis 136.674
+Vorbis 137.051
+Vorbis 137.432
+Vorbis 137.850
+Vorbis 138.207
+Vorbis 138.648
+Vorbis 139.048
+Vorbis 139.466
+Vorbis 139.876
+Vorbis 140.283
+Vorbis 140.691
+Vorbis 141.092
+Vorbis 141.510
+Vorbis 141.928
+Vorbis 142.369
+Vorbis 142.775
+Vorbis 143.176
+Vorbis 143.533
+Vorbis 143.951
+Vorbis 144.354
+Vorbis 144.760
+Vorbis -1.000
+Vorbis 145.155
+Vorbis 145.564
+Vorbis 145.982
+Vorbis 146.400
+Vorbis 146.818
+Vorbis 147.236
+Vorbis 147.654
+Vorbis 148.048
+Vorbis 148.444
+Vorbis 148.862
+Vorbis 149.303
+Vorbis 149.680
+Vorbis 150.069
+Vorbis 150.481
+Vorbis -1.000
+Vorbis 150.876
+Vorbis 151.248
+Vorbis 151.681
+Vorbis 151.993
+Vorbis 152.382
+Vorbis 152.777
+Vorbis 153.181
+Vorbis 153.599
+Vorbis -1.000
+Vorbis 153.999
+Vorbis 154.407
+Vorbis 154.815
+Vorbis 155.195
+Vorbis 155.585
+Vorbis 155.993
+Vorbis 156.434
+Vorbis 156.875
+Vorbis 157.293
+Vorbis 157.735
+Vorbis 158.169
+Vorbis 158.510
+Vorbis -1.000
+Vorbis 158.899
+Vorbis 159.316
+Vorbis 159.734
+Vorbis 160.176
+Vorbis 160.594
+Vorbis -1.000
+Vorbis 160.977
+Vorbis 161.395
+Vorbis -1.000
+Vorbis 161.836
+Vorbis 162.213
+Vorbis 162.596
+Vorbis 162.991
+Vorbis 163.432
+Vorbis 163.850
+Vorbis 164.262
+Vorbis 164.680
+Vorbis 165.098
+Vorbis 165.510
+Vorbis 165.876
+Vorbis 166.294
+Vorbis 166.680
+Vorbis 167.098
+Vorbis 167.493
+Vorbis 167.934
+Vorbis 168.375
+Vorbis 168.840
+Vorbis 169.207
+Vorbis 169.556
+Vorbis 169.963
+Vorbis 170.343
+Vorbis 170.741
+Vorbis 171.151
+Vorbis 171.524
+Vorbis 171.928
+Vorbis 172.308
+Vorbis 172.727
+Vorbis 173.080
+Vorbis 173.455
+Vorbis 173.851
+Vorbis 174.241
+Vorbis 174.633
+Vorbis 175.039
+Vorbis 175.435
+Vorbis 175.791
+Vorbis 176.196
+Vorbis 176.586
+Vorbis 176.978
+Vorbis 177.360
+Vorbis 177.747
+Vorbis 178.168
+Vorbis 178.589
+Vorbis 178.995
+Vorbis 179.390
+Vorbis 179.808
+Vorbis 180.225
+Vorbis 180.615
+Vorbis 181.027
+Vorbis 181.447
+Vorbis 181.854
+Vorbis 182.272
+Vorbis 182.690
+Vorbis 183.110
+Vorbis 183.503
+Vorbis 183.922
+Vorbis 184.297
+Vorbis 184.684
+Vorbis 185.125
+Vorbis 185.543
+Vorbis 185.947
+Vorbis 186.388
+Vorbis 186.803
+Vorbis 187.221
+Vorbis 187.629
+Vorbis 188.051
+Vorbis 188.423
+Vorbis 188.854
+Vorbis 189.214
+Vorbis 189.610
+Vorbis 190.005
+Vorbis 190.379
+Vorbis 190.797
+Vorbis 191.192
+Vorbis -1.000
+Vorbis 191.586
+Vorbis 191.967
+Vorbis 192.358
+Vorbis 192.727
+Vorbis -1.000
+Vorbis 193.145
+Vorbis 193.525
+Vorbis 193.923
+Vorbis 194.260
+Vorbis 194.654
+Vorbis 195.049
+Vorbis 195.447
+Vorbis 195.856
+Vorbis 196.233
+Vorbis -1.000
+Vorbis 196.651
+Vorbis 197.056
+Vorbis 197.399
+Vorbis 197.785
+Vorbis 198.175
+Vorbis 198.552
+Vorbis -1.000
+Vorbis 198.970
+Vorbis 199.365
+Vorbis 199.769
+Vorbis 200.186
+Vorbis 200.590
+Vorbis 201.008
+Vorbis 201.413
+Vorbis 201.765
+Vorbis 202.151
+Vorbis 202.564
+Vorbis 203.028
+Vorbis 203.442
+Vorbis 203.806
+Vorbis 204.190
+Vorbis 204.598
+Vorbis 205.016
+Vorbis 205.375
+Vorbis -1.000
+Vorbis 205.755
+Vorbis 206.122
+Vorbis 206.523
+Vorbis 206.903
+Vorbis 207.277
+Vorbis 207.695
+Vorbis 208.052
+Vorbis 208.461
+Vorbis 208.879
+Vorbis 209.297
+Vorbis 209.707
+Vorbis 210.132
+Vorbis 210.530
+Vorbis -1.000
+Vorbis 210.932
+Vorbis 211.312
+Vorbis 211.686
+Vorbis 212.081
+Vorbis 212.489
+Vorbis 212.876
+Vorbis 213.256
+Vorbis 213.716
+Vorbis 214.092
+Vorbis 214.504
+Vorbis 214.882
+Vorbis 215.285
+Vorbis 215.535

Added: oogg/trunk/oogg
===================================================================
--- oogg/trunk/oogg	                        (rev 0)
+++ oogg/trunk/oogg	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,541 @@
+Vorbis 0.000
+Vorbis 0.000
+Vorbis 0.000
+Vorbis 0.329
+Vorbis 0.747
+Vorbis 1.160
+Vorbis 1.578
+Vorbis 1.995
+Vorbis 2.413
+Vorbis 2.817
+Vorbis 3.235
+Vorbis 3.641
+Vorbis 4.046
+Vorbis 4.431
+Vorbis 4.825
+Vorbis 5.243
+Vorbis 5.605
+Vorbis 5.978
+Vorbis 6.390
+Vorbis 6.741
+Vorbis 7.159
+Vorbis 7.554
+Vorbis 7.943
+Vorbis 8.346
+Vorbis 8.741
+Vorbis 9.159
+Vorbis 9.554
+Vorbis 9.942
+Vorbis 10.360
+Vorbis 10.746
+Vorbis 11.124
+Vorbis 11.510
+Vorbis 11.951
+Vorbis 12.323
+Vorbis 12.707
+Vorbis 13.138
+Vorbis 13.562
+Vorbis 13.942
+Vorbis 14.356
+Vorbis 14.714
+Vorbis 15.109
+Vorbis 15.527
+Vorbis 15.922
+Vorbis 16.299
+Vorbis 16.717
+Vorbis 17.112
+Vorbis 17.530
+Vorbis 17.948
+Vorbis 18.366
+Vorbis 18.783
+Vorbis 19.175
+Vorbis 19.567
+Vorbis 19.985
+Vorbis 20.389
+Vorbis 20.778
+Vorbis 21.201
+Vorbis 21.596
+Vorbis 22.021
+Vorbis 22.412
+Vorbis 22.815
+Vorbis 23.210
+Vorbis 23.628
+Vorbis 24.036
+Vorbis 24.420
+Vorbis 24.815
+Vorbis 25.233
+Vorbis 25.651
+Vorbis 26.046
+Vorbis 26.440
+Vorbis 26.838
+Vorbis 27.256
+Vorbis 27.687
+Vorbis 28.040
+Vorbis 28.458
+Vorbis 28.875
+Vorbis 29.293
+Vorbis 29.711
+Vorbis 30.153
+Vorbis 30.547
+Vorbis 30.974
+Vorbis 31.392
+Vorbis 31.781
+Vorbis 32.158
+Vorbis 32.553
+Vorbis 32.922
+Vorbis 33.340
+Vorbis 33.766
+Vorbis 34.184
+Vorbis 34.602
+Vorbis 34.977
+Vorbis 35.418
+Vorbis 35.810
+Vorbis 36.204
+Vorbis 36.622
+Vorbis 37.017
+Vorbis 37.374
+Vorbis 37.796
+Vorbis 38.184
+Vorbis 38.602
+Vorbis 38.967
+Vorbis 39.409
+Vorbis 39.827
+Vorbis 40.245
+Vorbis 40.662
+Vorbis 41.069
+Vorbis 41.487
+Vorbis 41.882
+Vorbis 42.265
+Vorbis 42.683
+Vorbis 43.124
+Vorbis 43.565
+Vorbis 43.983
+Vorbis 44.383
+Vorbis 44.777
+Vorbis 45.145
+Vorbis 45.502
+Vorbis 45.867
+Vorbis 46.253
+Vorbis 46.665
+Vorbis 47.061
+Vorbis 47.425
+Vorbis 47.791
+Vorbis 48.151
+Vorbis 48.521
+Vorbis 48.885
+Vorbis 49.265
+Vorbis 49.601
+Vorbis 49.978
+Vorbis 50.345
+Vorbis 50.731
+Vorbis 51.126
+Vorbis 51.521
+Vorbis 51.918
+Vorbis 52.322
+Vorbis 52.734
+Vorbis 53.175
+Vorbis 53.593
+Vorbis 53.953
+Vorbis 54.345
+Vorbis 54.763
+Vorbis 55.181
+Vorbis 55.600
+Vorbis 56.008
+Vorbis 56.380
+Vorbis 56.797
+Vorbis 57.192
+Vorbis 57.610
+Vorbis 58.006
+Vorbis 58.397
+Vorbis 58.748
+Vorbis 59.111
+Vorbis 59.485
+Vorbis 59.903
+Vorbis 60.321
+Vorbis 60.693
+Vorbis 61.090
+Vorbis 61.468
+Vorbis 61.859
+Vorbis 62.257
+Vorbis 62.629
+Vorbis 63.012
+Vorbis 63.430
+Vorbis 63.821
+Vorbis 64.247
+Vorbis 64.576
+Vorbis 64.985
+Vorbis 65.380
+Vorbis 65.781
+Vorbis 66.222
+Vorbis 66.622
+Vorbis 67.037
+Vorbis 67.432
+Vorbis 67.836
+Vorbis 68.245
+Vorbis 68.637
+Vorbis 69.046
+Vorbis 69.409
+Vorbis 69.838
+Vorbis 70.216
+Vorbis 70.631
+Vorbis 71.033
+Vorbis 71.388
+Vorbis 71.783
+Vorbis 72.149
+Vorbis 72.532
+Vorbis 72.927
+Vorbis 73.318
+Vorbis 73.673
+Vorbis 74.076
+Vorbis 74.442
+Vorbis 74.832
+Vorbis 75.167
+Vorbis 75.559
+Vorbis 75.928
+Vorbis 76.346
+Vorbis 76.764
+Vorbis 77.148
+Vorbis 77.492
+Vorbis 77.872
+Vorbis 78.250
+Vorbis 78.662
+Vorbis 79.080
+Vorbis 79.498
+Vorbis 79.920
+Vorbis 80.279
+Vorbis 80.702
+Vorbis 81.094
+Vorbis 81.492
+Vorbis 81.878
+Vorbis 82.303
+Vorbis 82.691
+Vorbis 83.082
+Vorbis 83.500
+Vorbis 83.913
+Vorbis 84.304
+Vorbis 84.676
+Vorbis 85.076
+Vorbis 85.480
+Vorbis 85.878
+Vorbis 86.255
+Vorbis 86.644
+Vorbis 87.023
+Vorbis 87.384
+Vorbis 87.793
+Vorbis 88.182
+Vorbis 88.594
+Vorbis 88.986
+Vorbis 89.381
+Vorbis 89.755
+Vorbis 90.156
+Vorbis 90.574
+Vorbis 91.014
+Vorbis 91.468
+Vorbis 91.909
+Vorbis 92.330
+Vorbis 92.719
+Vorbis 93.084
+Vorbis 93.526
+Vorbis 93.897
+Vorbis 94.260
+Vorbis 94.662
+Vorbis 95.047
+Vorbis 95.464
+Vorbis 95.882
+Vorbis 96.271
+Vorbis 96.689
+Vorbis 97.084
+Vorbis 97.502
+Vorbis 97.908
+Vorbis 98.289
+Vorbis 98.730
+Vorbis 99.184
+Vorbis 99.540
+Vorbis 99.920
+Vorbis 100.320
+Vorbis 100.727
+Vorbis 101.191
+Vorbis 101.516
+Vorbis 101.934
+Vorbis 102.354
+Vorbis 102.715
+Vorbis 103.124
+Vorbis 103.532
+Vorbis 103.902
+Vorbis 104.294
+Vorbis 104.686
+Vorbis 105.127
+Vorbis 105.527
+Vorbis 105.945
+Vorbis 106.363
+Vorbis 106.805
+Vorbis 107.269
+Vorbis 107.640
+Vorbis 108.032
+Vorbis 108.436
+Vorbis 108.832
+Vorbis 109.163
+Vorbis 109.510
+Vorbis 109.925
+Vorbis 110.285
+Vorbis 110.679
+Vorbis 111.065
+Vorbis 111.483
+Vorbis 111.896
+Vorbis 112.313
+Vorbis 112.755
+Vorbis 113.162
+Vorbis 113.521
+Vorbis 113.939
+Vorbis 114.380
+Vorbis 114.798
+Vorbis 115.229
+Vorbis 115.602
+Vorbis 115.976
+Vorbis 116.360
+Vorbis 116.778
+Vorbis 117.168
+Vorbis 117.532
+Vorbis 117.950
+Vorbis 118.359
+Vorbis 118.769
+Vorbis 119.123
+Vorbis 119.506
+Vorbis 119.921
+Vorbis 120.350
+Vorbis 120.768
+Vorbis 121.186
+Vorbis 121.604
+Vorbis 122.022
+Vorbis 122.463
+Vorbis 122.881
+Vorbis 123.299
+Vorbis 123.717
+Vorbis 124.135
+Vorbis 124.577
+Vorbis 124.994
+Vorbis 125.395
+Vorbis 125.836
+Vorbis 126.254
+Vorbis 126.672
+Vorbis 127.113
+Vorbis 127.531
+Vorbis 127.949
+Vorbis 128.367
+Vorbis 128.785
+Vorbis 129.197
+Vorbis 129.615
+Vorbis 130.033
+Vorbis 130.451
+Vorbis 130.875
+Vorbis 131.316
+Vorbis 131.757
+Vorbis 132.175
+Vorbis 132.593
+Vorbis 133.011
+Vorbis 133.452
+Vorbis 133.894
+Vorbis 134.285
+Vorbis 134.674
+Vorbis 135.079
+Vorbis 135.461
+Vorbis 135.870
+Vorbis 136.256
+Vorbis 136.674
+Vorbis 137.051
+Vorbis 137.432
+Vorbis 137.850
+Vorbis 138.207
+Vorbis 138.648
+Vorbis 139.048
+Vorbis 139.466
+Vorbis 139.876
+Vorbis 140.283
+Vorbis 140.691
+Vorbis 141.092
+Vorbis 141.510
+Vorbis 141.928
+Vorbis 142.369
+Vorbis 142.775
+Vorbis 143.176
+Vorbis 143.533
+Vorbis 143.951
+Vorbis 144.354
+Vorbis 144.760
+Vorbis 145.155
+Vorbis 145.564
+Vorbis 145.982
+Vorbis 146.400
+Vorbis 146.818
+Vorbis 147.236
+Vorbis 147.654
+Vorbis 148.048
+Vorbis 148.444
+Vorbis 148.862
+Vorbis 149.303
+Vorbis 149.680
+Vorbis 150.069
+Vorbis 150.481
+Vorbis 150.876
+Vorbis 151.248
+Vorbis 151.681
+Vorbis 151.993
+Vorbis 152.382
+Vorbis 152.777
+Vorbis 153.181
+Vorbis 153.599
+Vorbis 153.999
+Vorbis 154.407
+Vorbis 154.815
+Vorbis 155.195
+Vorbis 155.585
+Vorbis 155.993
+Vorbis 156.434
+Vorbis 156.875
+Vorbis 157.293
+Vorbis 157.735
+Vorbis 158.169
+Vorbis 158.510
+Vorbis 158.899
+Vorbis 159.316
+Vorbis 159.734
+Vorbis 160.176
+Vorbis 160.594
+Vorbis 160.977
+Vorbis 161.395
+Vorbis 161.836
+Vorbis 162.213
+Vorbis 162.596
+Vorbis 162.991
+Vorbis 163.432
+Vorbis 163.850
+Vorbis 164.262
+Vorbis 164.680
+Vorbis 165.098
+Vorbis 165.510
+Vorbis 165.876
+Vorbis 166.294
+Vorbis 166.680
+Vorbis 167.098
+Vorbis 167.493
+Vorbis 167.934
+Vorbis 168.375
+Vorbis 168.840
+Vorbis 169.207
+Vorbis 169.556
+Vorbis 169.963
+Vorbis 170.343
+Vorbis 170.741
+Vorbis 171.151
+Vorbis 171.524
+Vorbis 171.928
+Vorbis 172.308
+Vorbis 172.727
+Vorbis 173.080
+Vorbis 173.455
+Vorbis 173.851
+Vorbis 174.241
+Vorbis 174.633
+Vorbis 175.039
+Vorbis 175.435
+Vorbis 175.791
+Vorbis 176.196
+Vorbis 176.586
+Vorbis 176.978
+Vorbis 177.360
+Vorbis 177.747
+Vorbis 178.168
+Vorbis 178.589
+Vorbis 178.995
+Vorbis 179.390
+Vorbis 179.808
+Vorbis 180.225
+Vorbis 180.615
+Vorbis 181.027
+Vorbis 181.447
+Vorbis 181.854
+Vorbis 182.272
+Vorbis 182.690
+Vorbis 183.110
+Vorbis 183.503
+Vorbis 183.922
+Vorbis 184.297
+Vorbis 184.684
+Vorbis 185.125
+Vorbis 185.543
+Vorbis 185.947
+Vorbis 186.388
+Vorbis 186.803
+Vorbis 187.221
+Vorbis 187.629
+Vorbis 188.051
+Vorbis 188.423
+Vorbis 188.854
+Vorbis 189.214
+Vorbis 189.610
+Vorbis 190.005
+Vorbis 190.379
+Vorbis 190.797
+Vorbis 191.192
+Vorbis 191.586
+Vorbis 191.967
+Vorbis 192.358
+Vorbis 192.727
+Vorbis 193.145
+Vorbis 193.525
+Vorbis 193.923
+Vorbis 194.260
+Vorbis 194.654
+Vorbis 195.049
+Vorbis 195.447
+Vorbis 195.856
+Vorbis 196.233
+Vorbis 196.651
+Vorbis 197.056
+Vorbis 197.399
+Vorbis 197.785
+Vorbis 198.175
+Vorbis 198.552
+Vorbis 198.970
+Vorbis 199.365
+Vorbis 199.769
+Vorbis 200.186
+Vorbis 200.590
+Vorbis 201.008
+Vorbis 201.413
+Vorbis 201.765
+Vorbis 202.151
+Vorbis 202.564
+Vorbis 203.028
+Vorbis 203.442
+Vorbis 203.806
+Vorbis 204.190
+Vorbis 204.598
+Vorbis 205.016
+Vorbis 205.375
+Vorbis 205.755
+Vorbis 206.122
+Vorbis 206.523
+Vorbis 206.903
+Vorbis 207.277
+Vorbis 207.695
+Vorbis 208.052
+Vorbis 208.461
+Vorbis 208.879
+Vorbis 209.297
+Vorbis 209.707
+Vorbis 210.132
+Vorbis 210.530
+Vorbis 210.932
+Vorbis 211.312
+Vorbis 211.686
+Vorbis 212.081
+Vorbis 212.489
+Vorbis 212.876
+Vorbis 213.256
+Vorbis 213.716
+Vorbis 214.092
+Vorbis 214.504
+Vorbis 214.882
+Vorbis 215.285
+Vorbis 215.535

Added: oogg/trunk/oogg_check_checksums.ml
===================================================================
--- oogg/trunk/oogg_check_checksums.ml	                        (rev 0)
+++ oogg/trunk/oogg_check_checksums.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,4 @@
+let f = File.file_open Sys.argv.(1);;
+let istream = File.to_stream f 0;;
+let pstream = Page.to_rawPageStream istream;;
+Page.check_crc pstream;;

Added: oogg/trunk/oogg_copy_file.ml
===================================================================
--- oogg/trunk/oogg_copy_file.ml	                        (rev 0)
+++ oogg/trunk/oogg_copy_file.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,6 @@
+let f = File.file_open Sys.argv.(1);;
+let g = File.file_open ~writable:true Sys.argv.(2);;
+let istream = File.to_stream f 0;;
+let pstream = Page.to_rawPageStream istream;;
+let ostream = File.to_output_stream g 0;;
+Page.write_rawPageStream ostream pstream;;

Added: oogg/trunk/oogg_dump_pages.ml
===================================================================
--- oogg/trunk/oogg_dump_pages.ml	                        (rev 0)
+++ oogg/trunk/oogg_dump_pages.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,4 @@
+let f = File.file_open Sys.argv.(1);;
+let s = File.to_stream f 0;;
+let ps = Page.to_pageStream s;;
+Page_util.print_pageStream ps;;

Added: oogg/trunk/oogg_info.ml
===================================================================
--- oogg/trunk/oogg_info.ml	                        (rev 0)
+++ oogg/trunk/oogg_info.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,17 @@
+open Types
+
+let f = File.file_open Sys.argv.(1);;
+let s = File.to_stream f 0;;
+let pages = Page.to_rawPageStream s;;
+
+let streams = MediaStream.to_mediaStreams pages;;
+
+let rec print_streams l = match l with
+  | h::t -> begin
+              print_oogg32 h.stream_serialno; print_string ": ";
+              print_mediaType h.stream_type; print_newline ();
+              print_streams t
+            end
+  | [] -> ();;
+
+print_streams streams;;

Added: oogg/trunk/oogg_rip.ml
===================================================================
--- oogg/trunk/oogg_rip.ml	                        (rev 0)
+++ oogg/trunk/oogg_rip.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,9 @@
+let f = File.file_open Sys.argv.(1);;
+let s = File.to_stream f 0;;
+let ps = Page.to_rawPageStream s;;
+
+let id = Types.int64_to_oogg32 (Int64.of_string Sys.argv.(2));;
+
+let g = File.file_open ~writable:true Sys.argv.(3);;
+let ostream = File.to_output_stream g 0;;
+Page.write_rawPageStream ostream (MediaStream.filter ps [id])

Added: oogg/trunk/page.ml
===================================================================
--- oogg/trunk/page.ml	                        (rev 0)
+++ oogg/trunk/page.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,255 @@
+open Types
+
+exception OggUnalignedStream;;
+
+let identify_bos page = 
+    let fst_pkt = List.hd page.raw_data in
+    if String.sub fst_pkt 0 7 = "fishead" then Skeleton
+    else if String.sub fst_pkt 0 4 = "CMML" then CMML
+    else if String.sub fst_pkt 1 6 = "theora" then Theora
+    else if String.sub fst_pkt 1 6 = "vorbis" then Vorbis
+    else Unknown
+
+(*
+ * generate a packet size from the stream (n lacing values left).  INTERNAL
+ * FUNCTION
+ *)
+let rec generate_packet stream n =
+  match n with
+  | 0 ->  ((0, 1), 0)
+  | _ ->  let v = IO.read_byte stream in 
+          if v = 255 then
+            let ((r, c), u) = generate_packet stream (n - 1) in
+            ((r + 255, c), u + 1)
+          else
+            ((v, 0), 1)
+
+(*
+ * generate the packet sizes from the n lacing values.  INTERNAL FUNCTION
+ *)
+let rec generate_packets stream n =
+  match n with
+  | 0 -> []
+  | _ -> let (v, r) = generate_packet stream n in 
+                      v::(generate_packets stream (n - r))
+
+(*
+ * extract the packet sizes from the stream.  INTERNAL FUNCTION
+ *)
+let get_packet_sizes stream = 
+  let num_segments = IO.read_byte stream in 
+  generate_packets stream num_segments;; 
+
+(*
+ * extract packets as a string list from stream, given sizes.  Actually returns
+ * (size list, raw packet list, last packet continued).  INTERNAL FUNCTION
+ *)
+let rec extract_packets pkts stream =
+  match pkts with
+    | [] -> ([], [], 0)
+    | [(s,c)] -> ([s], [IO.really_nread stream s], c)
+    | (s,c)::tl -> begin
+                    let p = IO.really_nread stream s in
+                    let (os, op, c) = extract_packets tl stream in
+                      (s::os, p::op, c)
+                  end;;
+
+(* 
+ * make a page.  INTERNAL FUNCTION
+ *)
+let make_page h gp sn seq pkts stream cksum =
+  let (sizes, packets, lpc) = extract_packets pkts stream in
+  { continued = (h land 0x1) > 0;
+    bos = (h land 0x2) > 0;
+    eos = (h land 0x4) > 0;
+    last_packet_complete = (lpc = 0);
+    granulepos = gp;
+    serialno = sn;
+    sequenceno = seq;
+    checksum = cksum;
+    packet_sizes = sizes;
+    raw_data = packets
+  };;
+
+let make_header page = 
+        if page.continued then 1 else 0 +
+        if page.bos then 2 else 0 +
+        if page.eos then 4 else 0 
+    
+let make_checksum page = page.checksum;;
+
+let rec write_lacing_value stream size tpc =
+  if (not tpc) && size == 0 then ()
+  else if size < 255 then IO.write_byte stream size
+  else 
+    begin 
+      IO.write_byte stream 255; 
+      write_lacing_value stream (size - 255) tpc 
+    end;;
+
+let rec num_lacing_values sizes lpc = 
+  match sizes with
+    | [] -> 0
+    | [h] -> ((h - if lpc then 0 else 1) / 255) + 1
+    | h::t -> (h / 255) + 1 + (num_lacing_values t lpc)
+
+let rec write_lacing_values stream sizes lpc = 
+  match sizes with
+    | []    ->  ()
+    | [h]   ->  write_lacing_value stream h lpc
+    | h::t  ->  begin 
+                  write_lacing_value stream h true; 
+                  write_lacing_values stream t lpc
+                end;;
+    
+let rec write_packet_data stream data = 
+  match data with
+    | []    ->  ()
+    | h::t  ->  begin IO.nwrite stream h; write_packet_data stream t end;;
+
+let packets_to_stream stream page = 
+  let sizes = page.packet_sizes in
+  let data = page.raw_data in
+  let lpc = page.last_packet_complete in 
+  IO.write_byte stream (num_lacing_values sizes lpc);
+  write_lacing_values stream sizes lpc;
+  write_packet_data stream data;;
+
+let wrap_value = Int64.sub (Int64.shift_left Int64.one 32) Int64.one;;
+  
+let read_ui32 stream =
+  let b = IO.read_ui16 stream in
+  let a = IO.read_ui16 stream in
+  Int64.add (Int64.shift_left (Int64.of_int a) 16) (Int64.of_int b);;
+
+let mask = Int64.of_int 0xFFFF
+  
+let write_ui32 stream value =
+  let a = Int64.to_int (Int64.shift_right value 16) in
+  let b = Int64.to_int (Int64.logand value mask) in
+  IO.write_ui16 stream b;
+  IO.write_ui16 stream a;;
+
+let read_oogg64 stream = 
+    (IO.read_ui16 stream, IO.read_ui16 stream, IO.read_ui16 stream,
+        IO.read_ui16 stream);;
+
+let write_oogg64 stream (a, b, c, d) = 
+    IO.write_ui16 stream d; IO.write_ui16 stream c; 
+    IO.write_ui16 stream b; IO.write_ui16 stream a;;
+
+let read_oogg32 stream = 
+    (IO.read_ui16 stream, IO.read_ui16 stream);;
+
+let write_oogg32 stream (a, b) =
+    IO.write_ui16 stream b; IO.write_ui16 stream a;;
+
+
+let page_to_raw stream page = 
+  IO.nwrite stream "OggS"; IO.write_byte stream 0;
+  IO.write_byte stream (make_header page);
+  write_oogg64 stream page.granulepos;
+  write_oogg32 stream page.serialno;
+  write_oogg32 stream page.sequenceno;
+  write_oogg32 stream (make_checksum page);
+  packets_to_stream stream page;;
+  
+(*
+ * generate a page stream from a raw stream
+ *)
+let rec to_rawPageStream stream = 
+  try begin
+    let header = IO.nread stream 4 in
+    if header = "OggS" then
+      begin
+        ignore (IO.read_byte stream);
+        let header_type = IO.read_byte stream in
+        let granule_pos = read_oogg64 stream in
+        let serial_no = read_oogg32 stream in
+        let seq_no = read_oogg32 stream in
+        let checksum = read_oogg32 stream in
+        let packets = get_packet_sizes stream in
+        [< 'make_page header_type granule_pos serial_no seq_no packets stream 
+              checksum; to_rawPageStream stream >]
+      end
+    else
+      raise OggUnalignedStream
+  end with IO.No_more_input -> [< >];;
+
+(*
+ * header: 4, granulepos: 8, serialno: 4, seqno: 4, checksum: 4, 
+ * num_lacing_val: 1, lacing_vals: num_lacing_values, packets: sum(sizes)
+ *
+ * total: 25 + num_lacing_values + sum(sizes)
+ *)
+
+let oogg_page_to_string page =
+  let the_string = IO.output_string () in page_to_raw the_string page;
+  IO.close_out the_string;;
+
+type contextRecord = { mutable ct_info : 
+      (serialNo * ((granulePos -> float) option * mediaType)) list };;
+
+let add_bos context rpage =
+  let sn = rpage.serialno in
+  let id = identify_bos rpage in
+  context.ct_info <- 
+          (sn, (Granules.granulerate_function id rpage, id))::context.ct_info;
+  id;;
+
+let lookup_bos context rpage =
+  let (f, id) = List.assoc rpage.serialno context.ct_info in
+  match f with 
+    | Some ff -> (id, ff rpage.granulepos)
+    | None    -> (id, -1.0);;
+
+let rawPage_to_page context rpage = 
+  if rpage.bos then (
+    let id = add_bos context rpage in
+    { raw = rpage; time = 0.0; identity = id }
+  ) else (
+    let (id, time) = lookup_bos context rpage in
+    { raw = rpage; time = time; identity = id }
+  );;
+
+(*
+ * write a page stream to a raw stream
+ *)
+let rec write_rawPageStream stream pstream = 
+  match pstream with parser
+   | [< 'page ; rest >] -> begin 
+                             page_to_raw stream page; 
+                             write_rawPageStream stream rest
+                           end
+   | [< >] -> ();;
+
+let rec check_crc stream =
+  match stream with parser
+    | [< 'page ; rest >] -> 
+      begin
+        let crc = page.checksum in
+        let newpage = {page with checksum=(0, 0)} in
+        let compcrc = Crc.crc (oogg_page_to_string newpage) in
+        if not (compcrc = crc) then begin
+          print_oogg32 crc ; print_string " " ; 
+          print_oogg32 compcrc ; print_newline () end;
+        check_crc rest
+      end
+    | [< >] -> ();;
+
+let rawPageStream_to_pageStream rpstream = 
+  let context = { ct_info = [] } in
+  let rec _rps_to_ps rpstream = match rpstream with parser
+    | [< 'rpage ; rest >] -> 
+          [< 'rawPage_to_page context rpage; _rps_to_ps rest >]
+    | [< >] -> [< >] in
+  _rps_to_ps rpstream;;
+
+let to_pageStream i = rawPageStream_to_pageStream (to_rawPageStream i);;
+
+let rec pageStream_to_rawPageStream pstream = match pstream with parser
+  | [< 'page ; rest >] -> [< 'page.raw; pageStream_to_rawPageStream rest >]
+  | [< >] -> [< >];;
+
+let write_pageStream stream pstream = 
+  write_rawPageStream stream (pageStream_to_rawPageStream pstream);;

Added: oogg/trunk/page.mli
===================================================================
--- oogg/trunk/page.mli	                        (rev 0)
+++ oogg/trunk/page.mli	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,15 @@
+val to_rawPageStream : Types.stream -> Types.rawPageStream;;
+
+val rawPageStream_to_pageStream : Types.rawPageStream -> Types.pageStream;;
+
+val pageStream_to_rawPageStream : Types.pageStream -> Types.rawPageStream;;
+
+val to_pageStream : Types.stream -> Types.pageStream;;
+
+val write_rawPageStream : Types.outStream -> Types.rawPageStream -> unit;;
+
+val write_pageStream : Types.outStream -> Types.pageStream -> unit;;
+
+val check_crc : Types.rawPageStream -> unit;;
+
+val identify_bos : Types.rawPage -> Types.mediaType;;

Added: oogg/trunk/page_util.ml
===================================================================
--- oogg/trunk/page_util.ml	                        (rev 0)
+++ oogg/trunk/page_util.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,44 @@
+open Types
+
+(*
+ * print the list of packet sizes.  INTERNAL FUNCTION
+ *) 
+let print_packet_sizes packets = 
+    let rec _pps packets = match packets with
+      | [] -> print_string "]"; print_newline ()
+      | [s] -> print_int s; _pps []
+      | s::t -> print_int s; print_string ", " ; _pps t in
+    print_string "["; _pps packets;;
+
+(*
+ * print a page.  UTILITY FUNCTION.
+ *)
+let print_rawPage p =
+  print_oogg32 p.serialno;
+  print_string ": gp "; 
+  print_oogg64 p.granulepos;
+  print_string " seq "; 
+  print_oogg32 p.sequenceno; 
+  if p.continued then print_string " (CONTINUATION)";
+  if p.bos then print_string " (BOS)";
+  if p.eos then print_string " (EOS)";
+  if not p.last_packet_complete then print_string " (CONTINUED)";
+  print_newline (); print_string "\t\t"; print_packet_sizes p.packet_sizes;
+  print_newline ();;
+  
+(*
+ * print a page stream.  UTILITY FUNCTION.
+ *)
+let rec print_rawPageStream ps = match ps with parser
+  | [< 'p >] -> print_rawPage p; print_rawPageStream ps
+  | [< >] -> ();;
+
+let print_page p =
+  print_mediaType p.identity;
+  print_string " ";
+  Printf.printf "%.3f\n" p.time;
+  print_rawPage p.raw;;
+
+let rec print_pageStream ps = match ps with parser
+  | [< 'p >] -> print_page p ; print_pageStream ps
+  | [< >] -> ();;

Added: oogg/trunk/page_util.mli
===================================================================
--- oogg/trunk/page_util.mli	                        (rev 0)
+++ oogg/trunk/page_util.mli	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,5 @@
+val print_rawPage : Types.rawPage -> unit;;
+val print_rawPageStream : Types.rawPageStream -> unit;;
+
+val print_page : Types.page -> unit;;
+val print_pageStream : Types.pageStream -> unit;;

Added: oogg/trunk/svn-commit.2.tmp
===================================================================
--- oogg/trunk/svn-commit.2.tmp	                        (rev 0)
+++ oogg/trunk/svn-commit.2.tmp	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,22 @@
+major rearrangement into raw-pages (data available in bitstream directly) vs. 
+pages (additional inferred stream type and time on each page).
+
+per-page gp->time generation for Vorbis and Theora
+
+--This line, and those below, will be ignored--
+
+M    page_util.ml
+M    page.ml
+M    types.mli
+A    granules.ml
+M    page_util.mli
+M    oogg_copy_file.ml
+M    page.mli
+A    granules.mli
+M    mediaStream.ml
+M    oogg_check_checksums.ml
+M    mediaStream.mli
+M    types.ml
+M    oogg_rip.ml
+M    Makefile
+M    oogg_info.ml

Added: oogg/trunk/svn-commit.tmp
===================================================================
--- oogg/trunk/svn-commit.tmp	                        (rev 0)
+++ oogg/trunk/svn-commit.tmp	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,7 @@
+Stripped oogg_ prefix from oogg_types
+
+--This line, and those below, will be ignored--
+
+M    oogg_types.ml
+M    oogg_types.mli
+M    Makefile

Added: oogg/trunk/types.ml
===================================================================
--- oogg/trunk/types.ml	                        (rev 0)
+++ oogg/trunk/types.ml	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,100 @@
+
+type oogg64 = (int * int * int * int);;
+type oogg32 = (int * int);;
+
+type serialNo = oogg32;;
+type granulePos = oogg64;;
+type checksum = oogg32;;
+type sequenceNo = oogg32;;
+
+(* raw byte streams *)
+type stream = IO.input;;
+type outStream = unit IO.output;;
+
+(*
+ * an oogg Page record
+ *) 
+type rawPage = 
+  { continued : bool ;
+    bos : bool ;
+    eos : bool ;
+    last_packet_complete : bool ;
+    granulepos : granulePos ;
+    serialno : serialNo ;
+    sequenceno : sequenceNo ;
+    checksum : checksum ;
+    packet_sizes : int list ;
+    raw_data : string list ;
+  };;
+
+(* media types *)
+type mediaType = Skeleton | CMML | Vorbis | Theora | Unknown;;
+
+type page = 
+  { raw : rawPage ;
+    time : float ; 
+    identity : mediaType
+  };;
+
+type rawPageStream  = rawPage Stream.t;;
+
+type pageStream = page Stream.t;;
+
+(* the type of a media stream *)
+type mediaStream =
+  { stream_serialno : serialNo ;
+    stream_pages : rawPageStream ;
+    stream_type : mediaType ;
+    stream_time : (granulePos -> float) option
+  };;
+
+let oogg32_to_int64 (a, b) =
+    Int64.add (Int64.of_int b) (Int64.shift_left (Int64.of_int a) 16);; 
+
+let oogg64_to_int64 (a,b,c,d) =
+  if (a,b,c,d) = (65535, 65535, 65535, 65535) then -1L else
+  Int64.add 
+    (oogg32_to_int64 (c,d)) 
+    (Int64.shift_left (oogg32_to_int64 (a,b)) 32);;
+
+let int64_to_oogg32 value =
+    (Int64.to_int (Int64.shift_right value 16),
+    Int64.to_int (Int64.logand value (Int64.of_int 0xFFFF)));;
+
+let int64_to_oogg64 value =
+  let mask = Int64.of_int 0xFFFF in
+  (Int64.to_int (Int64.shift_right value 48),
+   Int64.to_int (Int64.logand (Int64.shift_right value 32) mask),
+   Int64.to_int (Int64.logand (Int64.shift_right value 16) mask),
+   Int64.to_int (Int64.logand value mask));;
+
+let oogg64_to_float (a,b,c,d) = 
+  if (a,b,c,d) = (65535, 65535, 65535, 65535) then -1.0 else
+  float_of_int a *. (256. ** 6.) +.
+  float_of_int b *. (256. ** 4.) +.
+  float_of_int c *. (256. ** 2.) +.
+  float_of_int d;;
+
+let oogg32_to_string value = Int64.to_string (oogg32_to_int64 value);;
+
+let print_oogg32 value = 
+  print_string (oogg32_to_string value)
+
+let print_oogg64 (a,b,c,d) =
+  if a > 0 then
+    Printf.printf "%x%04x%04x%04x" a b c d
+  else if b > 0 then
+    Printf.printf "%x%04x%04x" b c d
+  else if c > 0 then
+    Printf.printf "%x%04x" c d
+  else
+    Printf.printf "%x" d;;
+
+let print_mediaType t = print_string (match t with
+  | Skeleton -> "Skeleton"
+  | CMML     -> "CMML"
+  | Vorbis   -> "Vorbis"
+  | Theora   -> "Theora"
+  | Unknown  -> "Unknown!");;
+
+

Added: oogg/trunk/types.mli
===================================================================
--- oogg/trunk/types.mli	                        (rev 0)
+++ oogg/trunk/types.mli	2007-08-13 06:23:51 UTC (rev 3182)
@@ -0,0 +1,64 @@
+(* raw values *)
+type oogg64 = (int * int * int * int);;
+type oogg32 = (int * int);;
+
+(* conversions *)
+val oogg32_to_int64 : oogg32 -> int64
+val oogg64_to_int64 : oogg64 -> int64
+val int64_to_oogg32 : int64 -> oogg32
+val int64_to_oogg64 : int64 -> oogg64
+val oogg32_to_string : oogg32 -> string
+val print_oogg32 : oogg32 -> unit
+val print_oogg64 : oogg64 -> unit
+val oogg64_to_float : oogg64 -> float
+
+(* meaningful values *)
+type serialNo = oogg32;;
+type granulePos = oogg64;;
+type checksum = oogg32;;
+type sequenceNo = oogg32;;
+
+(* raw byte streams *)
+type stream = IO.input;;
+type outStream = unit IO.output;;
+
+(*
+ * an oogg Page record
+ *) 
+type rawPage = 
+  { continued : bool ;
+    bos : bool ;
+    eos : bool ;
+    last_packet_complete : bool ;
+    granulepos : granulePos ;
+    serialno : serialNo ;
+    sequenceno : sequenceNo ;
+    checksum : checksum ;
+    packet_sizes : int list ;
+    raw_data : string list
+  };;
+
+(* media types *)
+type mediaType = Skeleton | CMML | Vorbis | Theora | Unknown;;
+
+type page = 
+  { raw : rawPage ;
+    time : float ; 
+    identity : mediaType
+  };;
+
+(* a stream of pages *)
+type rawPageStream = rawPage Stream.t;;
+
+type pageStream = page Stream.t;;
+
+(* the type of a media stream *)
+type mediaStream =
+  { stream_serialno : serialNo ;
+    stream_pages : rawPageStream ;
+    stream_type : mediaType ;
+    stream_time : (granulePos -> float) option
+  };;
+
+val print_mediaType : mediaType -> unit;;
+



More information about the commits mailing list