~ubuntu-branches/ubuntu/maverick/ocaml-vorbis/maverick

« back to all changes in this revision

Viewing changes to examples/ogg2wav.ml

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2007-09-18 21:54:19 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070918215419-v6dsdhjrrdlunswt
Tags: 0.3.1-3
Corrected link.dpatch, closes: #442961.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
  @author Samuel Mimram
25
25
  *)
26
26
 
27
 
(* $Id: ogg2wav.ml 2907 2007-03-02 13:32:11Z metamorph68 $ *)
 
27
(* $Id: ogg2wav.ml 3734 2007-05-22 11:49:18Z metamorph68 $ *)
28
28
 
29
29
let bufsize = 16 * 1024
30
30
 
97
97
 
98
98
  let infos = Vorbis.get_info !src in
99
99
  let vdr, cmt = Vorbis.get_comments !src in
100
 
    Printf.printf "Input file characteristics: vorbis codec v%d, %d channel(s), %d Hz, %d s\n" infos.Vorbis.vorbis_version infos.Vorbis.audio_channels infos.Vorbis.audio_sample_rate infos.Vorbis.duration;
 
100
    Printf.printf "Input file characteristics: vorbis codec v%d, %d channel(s), %d Hz, %f s\n" infos.Vorbis.vorbis_version infos.Vorbis.audio_channels infos.Vorbis.audio_sample_rate infos.Vorbis.duration;
101
101
    Printf.printf "* vendor: %s\n" vdr;
102
102
    Array.iter (fun (c, v) -> Printf.printf "* %s: %s\n" c v) cmt;
103
103
 
111
111
      }
112
112
    in
113
113
    let tmpdst,oc = Filename.open_temp_file ~mode:[Open_binary] "ogg2wav" ".raw" in
114
 
    let df = Vorbis.open_dec_file !src params in
 
114
    let df = Vorbis.open_dec_file !src ~fmt:params in
115
115
      (
116
116
        let buf = String.create bufsize in
117
117
        let pos = ref 0 in
118
 
        let tot = infos.Vorbis.duration * 44100 * 2 * 2 in
 
118
        let tot = (int_of_float infos.Vorbis.duration) * 44100 * 2 * 2 in
119
119
          try
120
120
            while true
121
121
            do