line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Headerinfo::WAV; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
4
|
1
|
|
|
1
|
|
6
|
use base qw(File::Headerinfo); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
102
|
|
5
|
1
|
|
|
1
|
|
926
|
use Audio::Wav; |
|
1
|
|
|
|
|
2852
|
|
|
1
|
|
|
|
|
167
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
File::Headerinfo::WAV - an extractor of useful information from WAV files. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
I uses Audio::WAV to read the headers of .wav files and extract useful information like their duration and filesize and, er, that's it at the moment. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub parse_file { |
18
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
19
|
1
|
|
|
|
|
4
|
my $w = Audio::Wav->new; |
20
|
1
|
|
|
|
|
32
|
my $info = $w->read($self->path); |
21
|
1
|
50
|
|
|
|
8191
|
return unless $info; |
22
|
1
|
|
|
|
|
6
|
my $details = $info->details; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
30
|
$self->filetype( 'wav' ); |
25
|
1
|
|
|
|
|
7
|
$self->filesize($info->length); |
26
|
1
|
|
|
|
|
6
|
$self->duration($info->length_seconds); |
27
|
1
|
|
|
|
|
6
|
$self->metadata($info->get_info); |
28
|
1
|
|
|
|
|
11
|
$self->freq($details->{sample_rate}); |
29
|
1
|
|
|
|
|
11
|
$self->datarate($details->{bytes_sec}); |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
12
|
undef $info; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 COPYRIGHT |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Copyright 2004 William Ross (wross@cpan.org) |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
This library is free software; you can redistribute it |
39
|
|
|
|
|
|
|
and/or modify it under the same terms as Perl itself. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SEE ALSO |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
L, L |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |