/[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 4 by dpavlin, Thu Jul 19 20:49:06 2007 UTC revision 7 by dpavlin, Thu Jul 19 21:16:30 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    
11  use strict;  use strict;
12    
# Line 29  sub hex_dump { Line 33  sub hex_dump {
33          # calculate number of characters for offset          # calculate number of characters for offset
34          #my $d = length( sprintf("%x",length($bytes)) );          #my $d = length( sprintf("%x",length($bytes)) );
35          my $d = 4;          my $d = 4;
36            my $prefix = '#.';
37          while ( $hex =~ s/^((?:\w\w\s){1,16})// ) {          while ( $hex =~ s/^((?:\w\w\s){1,16})// ) {
38                  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 );
39                    $prefix = '##';
40                  if ( length($ascii) >= 16 ) {                  if ( length($ascii) >= 16 ) {
41                          $ascii = substr( $ascii, 16 );                          $ascii = substr( $ascii, 16 );
42                          $o += 16;                          $o += 16;
# Line 53  sub x { Line 59  sub x {
59          hex_dump( $bytes );          hex_dump( $bytes );
60    
61          if ( $bytes eq 'AMV_END_' ) {          if ( $bytes eq 'AMV_END_' ) {
62                  warn "## end of file marker AMV_END_\n";                  warn "> end of file marker AMV_END_\n";
63                  $d->{eof}++;                  $d->{eof}++;
64                  return;                  return;
65          }          }
# Line 75  sub next_part { Line 81  sub next_part {
81          if ( $expected_len ) {          if ( $expected_len ) {
82                  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;
83          }          }
84          printf ">>> %s | %d 0x%x bytes\n", $part, $len, $len;          printf ">> %s - %d 0x%x bytes\n", $part, $len, $len;
85          x($len) if $skip;          x($len) if $skip;
86          return $len;          return $len;
87  }  }

Legend:
Removed from v.4  
changed lines
  Added in v.7

  ViewVC Help
Powered by ViewVC 1.1.26