/[mldonkey]/mldonkey/src/utils/lib/avifile.ml
ViewVC logotype

Diff of /mldonkey/src/utils/lib/avifile.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by mldonkey, Fri Jan 30 06:11:07 2004 UTC revision 1.3 by spiralvoice, Thu Jul 7 00:25:46 2005 UTC
# Line 105  let print_string4 v s = Line 105  let print_string4 v s =
105      if int > 31 && int <127 then      if int > 31 && int <127 then
106        lprint_char c        lprint_char c
107      else lprintf "[%d]" int      else lprintf "[%d]" int
108    done;    done
   lprint_newline ()  
109    
110  let print_int32 s i=  let print_int32 s i=
111    lprintf "%s: %s" s (Int64.to_string i);    lprintf_nl "%s: %s" s (Int64.to_string i)
   lprint_newline ()  
112    
113  let print_int16 s i=  let print_int16 s i=
114    lprintf "%s: %d" s i;    lprintf "%s: %d" s i
115    lprint_newline ()  
     
116  let load file =  let load file =
117    let ic = open_in file in    let ic = open_in file in
118  (* pos: 0 *)  (* pos: 0 *)
# Line 124  let load file = Line 121  let load file =
121    
122  (* pos: 4 *)  (* pos: 4 *)
123    let size = input_int32 ic in    let size = input_int32 ic in
124    lprintf "SIZE %s" (Int64.to_string size);    lprintf_nl "SIZE %s" (Int64.to_string size);
   lprint_newline ();  
125    
126  (* pos: 8 *)  (* pos: 8 *)
127    let s = input_string4 ic in    let s = input_string4 ic in
# Line 137  let load file = Line 133  let load file =
133    
134  (* position 16 *)  (* position 16 *)
135    let rec iter_list pos end_pos =    let rec iter_list pos end_pos =
136      lprintf "POS %s/%s" (Int64.to_string pos) (Int64.to_string end_pos);      lprintf_nl "POS %s/%s" (Int64.to_string pos) (Int64.to_string end_pos);
     lprint_newline ();      
137      if pos < end_pos then begin      if pos < end_pos then begin
138  (* on peut s'arreter quand size = 0 *)  (* on peut s'arreter quand size = 0 *)
139          seek_in ic (Int64.to_int pos);          seek_in ic (Int64.to_int pos);
140          let size2 = input_int32 ic in          let size2 = input_int32 ic in
141          lprintf "SIZE2 %s" (Int64.to_string size2);          lprintf_nl "SIZE2 %s" (Int64.to_string size2);
         lprint_newline ();  
142                    
143          let header_name = input_string4 ic in          let header_name = input_string4 ic in
144          print_string4 "header" header_name; lprint_newline ();          print_string4 "header" header_name; lprintf_nl "";
145  (* pos: pos + 8 *)        (* pos: pos + 8 *)      
146          begin          begin
147            match header_name with            match header_name with
148              "hdrl" ->              "hdrl" ->
149                lprintf "HEADER"; lprint_newline ();                lprintf_nl "HEADER";
150                                
151                let s = input_string4 ic in                let s = input_string4 ic in
152                if s <> "avih" then failwith "Bad AVI file (avih absent)";                if s <> "avih" then failwith "Bad AVI file (avih absent)";
# Line 196  let load file = Line 190  let load file =
190                    iter_list pos_in last_pos                    iter_list pos_in last_pos
191                                
192            | "movi" ->            | "movi" ->
193                lprintf "CHUNKS"; lprint_newline ();                lprintf_nl "CHUNKS"
194                                
195            | "strl" ->            | "strl" ->
196                lprintf "STREAM DESCRIPTION"; lprint_newline ();                lprintf_nl "STREAM DESCRIPTION";
197                                
198                let offset = Int64.of_int 4  in                let offset = Int64.of_int 4  in
199                let pos0 = Int64.add pos offset in                let pos0 = Int64.add pos offset in
# Line 207  let load file = Line 201  let load file =
201                iter_list pos0 end_pos0                iter_list pos0 end_pos0
202    
203            | "strh" ->            | "strh" ->
204                lprintf "STREAM HEADER"; lprint_newline ();                lprintf_nl "STREAM HEADER";
205                                
206                ignore (input_string4 ic);                ignore (input_string4 ic);
207                                

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26