[xiph-cvs] cvs commit: MTG convert.pl

Monty xiphmont at xiph.org
Thu Jan 31 02:43:58 PST 2002



xiphmont    02/01/31 02:43:57

  Added:       .        convert.pl
  Log:
  External Perl glue for input sample conversion

Revision  Changes    Path
1.1                  MTG/convert.pl

Index: convert.pl
===================================================================
#!/usr/bin/perl -w

my $from=$ARGV[0];
my $to=$ARGV[1];

print "convert.pl 20020130 from $from to $to\n";

my $output=`file $from`;
my $channels=0;

if($output=~m/WAVE/){
    print "input file is WAV...\n";
    if($output=~m/stereo/){
        $channels=2;
    }
    if($output=~m/mono/){
        $channels=1;
    }

    $output=`sox $from -t RAW -w -s -c $channels -r 44100 $to`;
    tack_header();
    exit(0);
}

print "input is an unsupported file type (for now)\n";

1;

ub tack_header{
    my$footer=pack("ii",55,$channels);
    die $! unless open(TEMP,">>$to");
    syswrite TEMP,$footer;
    close(TEMP);
}

<p><p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list