/[amv]/amv.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /amv.pl

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

revision 5 by dpavlin, Thu Jul 19 20:53:33 2007 UTC revision 15 by dpavlin, Sat Jul 21 11:05:43 2007 UTC
# Line 3  Line 3 
3  # amv.pl  # amv.pl
4  #  #
5  # 07/19/07 19:21:39 CEST Dobrica Pavlinusic <dpavlin@rot13.org>  # 07/19/07 19:21:39 CEST Dobrica Pavlinusic <dpavlin@rot13.org>
6    #
7    # Various useful links used to produce this:
8    # http://www.moviecodec.com/topics/15431p1.html
9    # http://en.wikipedia.org/wiki/RIFF_(File_format)
10    # http://www.obrador.com/essentialjpeg/HeaderInfo.htm
11    # http://lists.helixcommunity.org/pipermail/datatype-dev/2005-January/001886.html
12    
13  use strict;  use strict;
14    
15  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
16  use Carp qw/confess/;  use Carp qw/confess/;
17    use File::Path;
18    use Getopt::Long;
19    
20    my $dump = 0;
21    my $debug = 0;
22    my $dump_dir = '/tmp/dump/';
23    
24    GetOptions(
25            "dump!"                 => \$dump,
26            "debug!"                => \$debug,
27            "dump-dir=s"    => \$dump_dir,
28    );
29    
30  my $path = shift @ARGV || die "usage: $0 movie.amv\n";  my $path = shift @ARGV || die "usage: $0 movie.amv\n";
31    
32    
33    rmtree $dump_dir if -e $dump_dir;
34    mkpath $dump_dir || die "can't create $dump_dir: $!";
35    
36  open(my $fh, '<', $path) || die "can't open $path: $!";  open(my $fh, '<', $path) || die "can't open $path: $!";
37    
38  # offset in file  # offset in file
# Line 20  my $o = 0; Line 42  my $o = 0;
42  my $d;  my $d;
43    
44  sub hex_dump {  sub hex_dump {
45          my $bytes = shift || return;          return unless $dump;
46    
47            my ( $bytes, $offset ) = @_;
48            return unless $bytes;
49    
50            my $old_o;
51            if (defined($offset)) {
52                    $old_o = $o;
53                    $o = $offset;
54            }
55    
56          my $ascii = $bytes;          my $ascii = $bytes;
57          $ascii =~ s/\W/./gs;          $ascii =~ s/\W/./gs;
58          my $hex = unpack('h*', $bytes);          my $hex = uc( unpack('h*', $bytes) );
59          $hex =~ s/(..)/$1 /g;          $hex =~ s/(..)/$1 /g;
60          # calculate number of characters for offset          # calculate number of characters for offset
61          #my $d = length( sprintf("%x",length($bytes)) );          #my $d = length( sprintf("%x",length($bytes)) );
62          my $d = 4;          my $d = 4;
63            my $prefix = '#.';
64          while ( $hex =~ s/^((?:\w\w\s){1,16})// ) {          while ( $hex =~ s/^((?:\w\w\s){1,16})// ) {
65                  printf "## %0${d}x | %-48s| %s\n", $o, $1, substr( $ascii, 0, 16 );                  printf "$prefix %0${d}x | %-48s| %s\n", $o, $1, substr( $ascii, 0, 16 );
66                    $prefix = '##';
67                  if ( length($ascii) >= 16 ) {                  if ( length($ascii) >= 16 ) {
68                          $ascii = substr( $ascii, 16 );                          $ascii = substr( $ascii, 16 );
69                          $o += 16;                          $o += 16;
# Line 39  sub hex_dump { Line 72  sub hex_dump {
72                          last;                          last;
73                  }                  }
74          }          }
75    
76            $o = $old_o if $old_o;
77  }  }
78    
79  sub x {  sub x {
# Line 60  sub x { Line 95  sub x {
95    
96          if ( $format ) {          if ( $format ) {
97                  my @data = unpack($format, $bytes);                  my @data = unpack($format, $bytes);
98                  warn "## unpacked = ",dump(@data),"\n";                  warn "## unpacked = ",dump(@data),"\n" if $debug;
99                  return @data;                  return @data;
100          } else {          } else {
101                  return $bytes;                  return $bytes;
# Line 75  sub next_part { Line 110  sub next_part {
110          if ( $expected_len ) {          if ( $expected_len ) {
111                  confess "expected $expected_len bytes for $part got $len" if $len != $expected_len;                  confess "expected $expected_len bytes for $part got $len" if $len != $expected_len;
112          }          }
113          printf ">> %s - %d 0x%x bytes\n", $part, $len, $len;          printf "<< %s - %d 0x%x bytes\n", $part, $len, $len;
114          x($len) if $skip;          x($len) if $skip;
115          return $len;          return $len;
116  }  }
117    
118  my ( $riff, $amv ) = x(12, 'Z8Z4');  sub huffman {
119  die "not RIFF but $riff" if $riff ne 'RIFF';  
120  die "not AMV but $amv" if $amv ne 'AMV ';  # JPEG DHT Segment for YCrCb omitted from MJPG data
121    return
122    "\xFF\xC4\x01\xA2" .
123    "\x00\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00" .
124    "\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x01" .
125    "\x00\x03\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00" .
126    "\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x10\x00" .
127    "\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04\x00\x00\x01\x7D" .
128    "\x01\x02\x03\x00\x04\x11\x05\x12\x21\x31\x41\x06\x13\x51\x61" .
129    "\x07\x22\x71\x14\x32\x81\x91\xA1\x08\x23\x42\xB1\xC1\x15\x52" .
130    "\xD1\xF0\x24\x33\x62\x72\x82\x09\x0A\x16\x17\x18\x19\x1A\x25" .
131    "\x26\x27\x28\x29\x2A\x34\x35\x36\x37\x38\x39\x3A\x43\x44\x45" .
132    "\x46\x47\x48\x49\x4A\x53\x54\x55\x56\x57\x58\x59\x5A\x63\x64" .
133    "\x65\x66\x67\x68\x69\x6A\x73\x74\x75\x76\x77\x78\x79\x7A\x83" .
134    "\x84\x85\x86\x87\x88\x89\x8A\x92\x93\x94\x95\x96\x97\x98\x99" .
135    "\x9A\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xB2\xB3\xB4\xB5\xB6" .
136    "\xB7\xB8\xB9\xBA\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xD2\xD3" .
137    "\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8" .
138    "\xE9\xEA\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\x11\x00\x02" .
139    "\x01\x02\x04\x04\x03\x04\x07\x05\x04\x04\x00\x01\x02\x77\x00" .
140    "\x01\x02\x03\x11\x04\x05\x21\x31\x06\x12\x41\x51\x07\x61\x71" .
141    "\x13\x22\x32\x81\x08\x14\x42\x91\xA1\xB1\xC1\x09\x23\x33\x52" .
142    "\xF0\x15\x62\x72\xD1\x0A\x16\x24\x34\xE1\x25\xF1\x17\x18\x19" .
143    "\x1A\x26\x27\x28\x29\x2A\x35\x36\x37\x38\x39\x3A\x43\x44\x45" .
144    "\x46\x47\x48\x49\x4A\x53\x54\x55\x56\x57\x58\x59\x5A\x63\x64" .
145    "\x65\x66\x67\x68\x69\x6A\x73\x74\x75\x76\x77\x78\x79\x7A\x82" .
146    "\x83\x84\x85\x86\x87\x88\x89\x8A\x92\x93\x94\x95\x96\x97\x98" .
147    "\x99\x9A\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xB2\xB3\xB4\xB5" .
148    "\xB6\xB7\xB8\xB9\xBA\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xD2" .
149    "\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xE2\xE3\xE4\xE5\xE6\xE7\xE8" .
150    "\xE9\xEA\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA";
151    
152    }
153    
154    sub mkjpg {
155            my ($path,$data) = @_;
156            open(my $fh, '>', $path) || die "can't create $path: $!";
157    
158            confess "no SOI marker in data" if substr($data,0,2) ne "\xFF\xD8";
159            $data = substr($data,2);
160    
161            my $header =
162                    "\xFF\xD8".     # Start of Image (SOI) marker
163    #------------------------------------------------------------------
164                    "\xFF\xE0".     # JFIF marker
165            pack("nZ5CCCnnCC",
166                    16,                     # length
167                    'JFIF',         # identifier
168                    1,1,            # version
169                    0,                      # units (none)
170                    1,1,            # X,Y density
171                    0,0,            # X,Y thumbnail
172            ).
173    #------------------------------------------------------------------
174            "\xFF\xC0".     # Start of frame
175            pack("ncnncc9",
176                    17,                     # len
177                    8,                      # sample precision in bits
178                    120,160,        # X,Y size
179                    3,                      # number of components
180                    1,0x21,0,       # Component ID, H+V sampling factors, Quantization table number
181                    2,0x11,1,
182                    3,0x11,1,
183            ).
184    #------------------------------------------------------------------
185            "\xFF\xDB".             # Define Quantization table marker
186            "\x00\x84".             # len
187            "\x00".                 # 8 bit values, (byte) table 0
188            "\x10\x0B\x0C\x0E\x0C".
189            "\x0A\x10\x0E\x0D\x0E".
190            "\x12\x11\x10\x13\x18".
191            "\x28\x1A\x18\x16\x16".
192            "\x18\x31\x23\x25\x1D".
193            "\x28\x3A\x33\x3D\x3C".
194            "\x39\x33\x38\x37\x40".
195            "\x48\x5C\x4E\x40\x44".
196            "\x57\x45\x37\x38\x50".
197            "\x6D\x51\x57\x5F\x62".
198            "\x67\x68\x67\x3E\x4D".
199            "\x71\x79\x70\x64\x78".
200            "\x5C\x65\x67\x63".
201            "\x01".         # 8 bit values, (byte) table 1
202            "\x11\x12\x12\x18\x15".
203            "\x18\x2F\x1A\x1A\x2F".
204            "\x63\x42\x38\x42\x63".
205            "\x63\x63\x63\x63\x63".
206            "\x63\x63\x63\x63\x63".
207            "\x63\x63\x63\x63\x63".
208            "\x63\x63\x63\x63\x63".
209            "\x63\x63\x63\x63\x63".
210            "\x63\x63\x63\x63\x63".
211            "\x63\x63\x63\x63\x63".
212            "\x63\x63\x63\x63\x63".
213            "\x63\x63\x63\x63\x63".
214            "\x63\x63\x63\x63".
215    #------------------------------------------------------------------
216    #       huffman("\x00").        # 0 DC
217    #       huffman("\x01").        # 1 DC
218    #       huffman("\x10").        # 0 AC
219    #       huffman("\x11").        # 1 AC
220    #------------------------------------------------------------------
221            # Define huffman table (section B.2.4.1)
222            "\xFF\xC4".             # Marker
223            "\x00\x1F".             # Length (31 bytes)
224            "\x00".                 # DC, (byte) table 0
225            "\x00\x01\x05\x01\x01".
226            "\x01\x01\x01\x01\x00".
227            "\x00\x00\x00\x00\x00".
228            "\x00\x00\x01\x02\x03".
229            "\x04\x05\x06\x07\x08".
230            "\x09\x0A\x0B".
231            # Define huffman table (section B.2.4.1)
232            "\xFF\xC4".             # Marker
233            "\x00\xB5".             # Length (181 bytes)
234            "\x10".                 # AC, (byte) table 0
235            "\x00\x02\x01\x03\x03".
236            "\x02\x04\x03\x05\x05".
237            "\x04\x04\x00\x00\x01".
238            "\x7D\x01\x02\x03\x00".
239            "\x04\x11\x05\x12\x21".
240            "\x31\x41\x06\x13\x51".
241            "\x61\x07\x22\x71\x14".
242            "\x32\x81\x91\xA1\x08".
243            "\x23\x42\xB1\xC1\x15".
244            "\x52\xD1\xF0\x24\x33".
245            "\x62\x72\x82\x09\x0A".
246            "\x16\x17\x18\x19\x1A".
247            "\x25\x26\x27\x28\x29".
248            "\x2A\x34\x35\x36\x37".
249            "\x38\x39\x3A\x43\x44".
250            "\x45\x46\x47\x48\x49".
251            "\x4A\x53\x54\x55\x56".
252            "\x57\x58\x59\x5A\x63".
253            "\x64\x65\x66\x67\x68".
254            "\x69\x6A\x73\x74\x75".
255            "\x76\x77\x78\x79\x7A".
256            "\x83\x84\x85\x86\x87".
257            "\x88\x89\x8A\x92\x93".
258            "\x94\x95\x96\x97\x98".
259            "\x99\x9A\xA2\xA3\xA4".
260            "\xA5\xA6\xA7\xA8\xA9".
261            "\xAA\xB2\xB3\xB4\xB5".
262            "\xB6\xB7\xB8\xB9\xBA".
263            "\xC2\xC3\xC4\xC5\xC6".
264            "\xC7\xC8\xC9\xCA\xD2".
265            "\xD3\xD4\xD5\xD6\xD7".
266            "\xD8\xD9\xDA\xE1\xE2".
267            "\xE3\xE4\xE5\xE6\xE7".
268            "\xE8\xE9\xEA\xF1\xF2".
269            "\xF3\xF4\xF5\xF6\xF7".
270            "\xF8\xF9\xFA".
271            # Define huffman table (section B.2.4.1)
272            "\xFF\xC4".             # Marker
273            "\x00\x1F".             # Length (31 bytes)
274            "\x01".                 # DC, (byte) table 1
275            "\x00\x03\x01\x01\x01".
276            "\x01\x01\x01\x01\x01".
277            "\x01\x00\x00\x00\x00".
278            "\x00\x00\x01\x02\x03".
279            "\x04\x05\x06\x07\x08".
280            "\x09\x0A\x0B".
281            # Define huffman table (section B.2.4.1)
282            "\xFF\xC4".             # Marker
283            "\x00\xB5".             # Length (181 bytes)
284            "\x11".                 # AC, (byte) table 1
285            "\x00\x02\x01\x02\x04".
286            "\x04\x03\x04\x07\x05".
287            "\x04\x04\x00\x01\x02".
288            "\x77\x00\x01\x02\x03".
289            "\x11\x04\x05\x21\x31".
290            "\x06\x12\x41\x51\x07".
291            "\x61\x71\x13\x22\x32".
292            "\x81\x08\x14\x42\x91".
293            "\xA1\xB1\xC1\x09\x23".
294            "\x33\x52\xF0\x15\x62".
295            "\x72\xD1\x0A\x16\x24".
296            "\x34\xE1\x25\xF1\x17".
297            "\x18\x19\x1A\x26\x27".
298            "\x28\x29\x2A\x35\x36".
299            "\x37\x38\x39\x3A\x43".
300            "\x44\x45\x46\x47\x48".
301            "\x49\x4A\x53\x54\x55".
302            "\x56\x57\x58\x59\x5A".
303            "\x63\x64\x65\x66\x67".
304            "\x68\x69\x6A\x73\x74".
305            "\x75\x76\x77\x78\x79".
306            "\x7A\x82\x83\x84\x85".
307            "\x86\x87\x88\x89\x8A".
308            "\x92\x93\x94\x95\x96".
309            "\x97\x98\x99\x9A\xA2".
310            "\xA3\xA4\xA5\xA6\xA7".
311            "\xA8\xA9\xAA\xB2\xB3".
312            "\xB4\xB5\xB6\xB7\xB8".
313            "\xB9\xBA\xC2\xC3\xC4".
314            "\xC5\xC6\xC7\xC8\xC9".
315            "\xCA\xD2\xD3\xD4\xD5".
316            "\xD6\xD7\xD8\xD9\xDA".
317            "\xE2\xE3\xE4\xE5\xE6".
318            "\xE7\xE8\xE9\xEA\xF2".
319            "\xF3\xF4\xF5\xF6\xF7".
320            "\xF8\xF9\xFA".
321    #------------------------------------------------------------------
322                    "\xFF\xDA".     # Start of Scan marker
323            pack("nC11",
324                    12,                     # length
325                    3,                      # number of components
326                    1,0x00,         # Scan 1: use DC/AC huff tables 0/0
327                    2,0x11,         # Scan 2: use DC/AC huff tables 1/1
328                    3,0x11,         # Scan 3: use DC/AC huff tables 1/1
329                    0,0x3f,         # Ss, Se
330                    0,                      # Ah, Ai (not used)
331            );
332    #------------------------------------------------------------------
333    
334            my $header =
335            # SOI
336            "\xFF\xD8".
337            # JFIF
338            "\xFF\xE0".
339            "\x00\x0e\x41\x56\x49\x31\x00\x00\x00\x00\x00\x00\x00\x00".
340            "\xff\xDD\x00\x04\x00\x00".
341            # quantization table
342            "\xFF\xDB".
343            "\x00\x43\x00\x21\x16\x18".
344            "\x1D\x18\x14\x21\x1D\x1B\x1D\x25".
345            "\x23\x21\x27\x31\x53\x36\x31\x2D".
346            "\x2D\x31\x65\x48\x4c\x3c\x53\x78".
347            "\x6a\x7e\x7c\x76\x6a\x74\x72\x85".
348            "\x95\xbf\xa2\x85\x8d\xb4\x8f\x72".
349            "\x74\xa6\xe2\xa8\xb4\xc5\xcb\xd6".
350            "\xd8\xd6\x80\xa0\xeb\xfb\xe8\xd0".
351            "\xf9\xbf\xd2\xd6\xcd".
352            # quantization table
353            "\xff\xdb".
354            "\x00\x43\x01\x23\x25\x25\x31\x2b\x31".
355            "\x61\x36\x36\x61\xcd\x89\x74\x89".
356            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
357            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
358            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
359            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
360            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
361            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
362            "\xcd\xcd".
363            # Define huffman table (section B.2.4.1)
364            "\xFF\xC4".     # Marker
365            "\x00\x1F".     # Length (31 bytes)
366            "\x00".         # DC luminance, table 0
367            "\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00".
368            "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B".
369            # Define huffman table (section B.2.4.1)
370            "\xFF\xC4".     # Marker
371            "\x00\x1F".     # Length (31 bytes)
372            "\x01".         # DC chrominance, table 1
373            "\x00\x03\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00".
374            "\x00\x00\x00\x00".
375            "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B".
376            # Define huffman table (section B.2.4.1)
377            "\xFF\xC4".     # Marker
378            "\x00\xB5".     # Length (181 bytes)
379            "\x10".         # AC luminance, table 0
380            "\x00\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04\x00\x00\x01\x7D".
381            "\x01\x02\x03\x00\x04\x11\x05\x12".
382            "\x21\x31\x41\x06\x13\x51\x61\x07\x22\x71\x14\x32".
383            "\x81\x91\xA1\x08\x23\x42\xB1\xC1\x15\x52\xD1\xF0".
384            "\x24\x33\x62\x72\x82\x09\x0A\x16\x17\x18\x19\x1A".
385            "\x25\x26\x27\x28\x29\x2A\x34\x35\x36\x37\x38\x39".
386            "\x3A\x43\x44\x45\x46\x47\x48\x49\x4A\x53\x54\x55".
387            "\x56\x57\x58\x59\x5A\x63\x64\x65\x66\x67\x68\x69".
388            "\x6A\x73\x74\x75\x76\x77\x78\x79\x7A\x83\x84\x85".
389            "\x86\x87\x88\x89\x8A\x92\x93\x94\x95\x96\x97\x98".
390            "\x99\x9A\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xB2".
391            "\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xC2\xC3\xC4\xC5".
392            "\xC6\xC7\xC8\xC9\xCA\xD2\xD3\xD4\xD5\xD6\xD7\xD8".
393            "\xD9\xDA\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA".
394            "\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA".
395            #/* Define huffman table (section B.2.4.1) */
396            "\xFF\xC4".     # Marker
397            "\x00\xB5".     # Length (181 bytes)
398            "\x11".         # AC chrominance, table 1
399            "\x00\x02\x01\x02\x04\x04\x03\x04\x07\x05\x04\x04".
400            "\x00\x01\x02\x77".
401            "\x00\x01\x02\x03\x11\x04\x05\x21".
402            "\x31\x06\x12\x41\x51\x07\x61\x71\x13\x22\x32\x81".
403            "\x08\x14\x42\x91\xA1\xB1\xC1\x09\x23\x33\x52\xF0".
404            "\x15\x62\x72\xD1\x0A\x16\x24\x34\xE1\x25\xF1\x17".
405            "\x18\x19\x1A\x26\x27\x28\x29\x2A\x35\x36\x37\x38".
406            "\x39\x3A\x43\x44\x45\x46\x47\x48\x49\x4A\x53\x54".
407            "\x55\x56\x57\x58\x59\x5A\x63\x64\x65\x66\x67\x68".
408            "\x69\x6A\x73\x74\x75\x76\x77\x78\x79\x7A\x82\x83".
409            "\x84\x85\x86\x87\x88\x89\x8A\x92\x93\x94\x95\x96".
410            "\x97\x98\x99\x9A\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9".
411            "\xAA\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xC2\xC3".
412            "\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xD2\xD3\xD4\xD5\xD6".
413            "\xD7\xD8\xD9\xDA\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9".
414            "\xEA\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA".
415            # start of frame
416            "\xff\xc0".
417            "\x00\x11\x08".
418            pack("nn", 120, 160).
419            "\x03\x01\x21\x00\x02\x11\x01\x03\x11\x01".
420            #
421            "\xff\xda".
422            "\x00\x0c\x03\x01\x00\x02\x11\x03\x11".
423            "\x00\x3f\x00";
424    
425            if ( $dump ) {
426                    warn "## created JPEG header...\n";
427                    hex_dump( $header, 0 );
428            }
429    
430            print $fh $header || die "can't write header into $path: $!";
431            print $fh $data || die "can't write frame into $path: $!";
432            close $fh || die "can't close $path: $!";
433            print ">> created $path ", -s $path, " bytes\n";
434    }
435    
436    my ( $riff, $amv ) = x(12, 'Z4x4Z4');
437    die "$path not RIFF but $riff" if $riff ne 'RIFF';
438    die "$path not AMV but $amv" if $amv ne 'AMV ';
439    
440  while ( ! defined($d->{eof}) ) {  while ( ! defined($d->{eof}) ) {
441          my ( $list, $name ) = x(12,'A4x4A4');          my ( $list, $name ) = x(12,'A4x4A4');
442          die "not LIST but $list" if $list ne 'LIST';          die "not LIST but $list" if $list ne 'LIST';
443          print "> $list .. $name\n";          print "< $list * $name\n";
444    
445          if ( $name eq 'hdrl' ) {          if ( $name eq 'hdrl' ) {
446    
# Line 102  while ( ! defined($d->{eof}) ) { Line 455  while ( ! defined($d->{eof}) ) {
455                  } x($len, 'Vx28VVVx8CCv');                  } x($len, 'Vx28VVVx8CCv');
456    
457                  printf "## %s %d*%d %s fps (%d ms/frame) %02d:%02d:%02d\n",                  printf "## %s %d*%d %s fps (%d ms/frame) %02d:%02d:%02d\n",
458                          $h->{path},                          $path,
459                          $h->{width}, $h->{height}, $h->{fps}, $h->{ms_per_frame},                          $h->{width}, $h->{height}, $h->{fps}, $h->{ms_per_frame},
460                          $h->{hh}, $h->{mm}, $h->{ss};                          $h->{hh}, $h->{mm}, $h->{ss};
461    
# Line 118  while ( ! defined($d->{eof}) ) { Line 471  while ( ! defined($d->{eof}) ) {
471                  while (1) {                  while (1) {
472                          my $frame = $d->{movi}++;                          my $frame = $d->{movi}++;
473                                    
474                          my $len = next_part( '00dc', 0, 1 );                          my $len = next_part( '00dc' );
475                          last unless $len;                          last unless $len;
476                          printf ">> %s 00dc - frame %d jpeg %d 0x%x bytes\n", $name, $frame, $len, $len;                          printf "<< %s 00dc - frame %d jpeg %d 0x%x bytes\n", $name, $frame, $len, $len;
477                            mkjpg( sprintf("$dump_dir/%03d.jpg", $frame ), x($len) );
478    
479                          my $len = next_part( '01wb', 0, 1 );                          $len = next_part( '01wb', 0, 1 );
480                          printf ">> %s 01wb - frame %d audio %d 0x%x bytes\n", $name, $frame, $len, $len;                          printf "<< %s 01wb - frame %d audio %d 0x%x bytes\n", $name, $frame, $len, $len;
481                  };                  };
482    
483          } else {          } else {

Legend:
Removed from v.5  
changed lines
  Added in v.15

  ViewVC Help
Powered by ViewVC 1.1.26