/usr/share/perl5/Audio/File/AudioProperties.pm is in libaudio-file-perl 0.11-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | package Audio::File::AudioProperties;
use strict;
use warnings;
our $VERSION = '0.02';
=head1 NAME
Audio::File::AudioProperties - abstract an audio files audio properties.
=head1 DESCRIPTION
Audio::File::AudioProperties is the base class for other file format independant
audio property classes like Audio::File::Flac::AudioProperties or
Audio::File::Ogg::AudioProperties. You should not use this class yourself exept
you're writing an own file format dependant subclass.
=head1 METHODS
=head2 new
Constructor. Creates new Audio::File::AudioProperties object. You shoud not use
this method yourself. It's called by the filetype-dependant subclasses of
Audio::File::Type automatically.
=cut
sub new {
my($class, $filename) = @_;
$class = ref $class || $class;
my $self = { filename => $filename };
bless $self, $class;
$self->init(@_) or return;
return $self;
}
=head2 init
Initializes the object. It's called by the constructor and empty by default.
It's ought to be overwritten by subclasses.
=cut
sub init {
}
=head2 length
Returns the length of the audio file in seconds.
=cut
sub length {
my $self = shift;
if( @_ ) {
$self->{length} = shift;
return 1;
}
return int $self->{length};
}
=head2 bitrate
Returns the bitrate of the file.
=cut
sub bitrate {
my $self = shift;
if( @_ ) {
$self->{bitrate} = shift;
return 1;
}
return int $self->{bitrate};
}
=head2 sample_rate
Returns the sample rate of the audio file.
=cut
sub sample_rate {
my $self = shift;
if( @_ ) {
$self->{sample_rate} = shift;
return 1;
}
return $self->{sample_rate};
}
=head2 channels
Returns the number of channels the audio file has.
=cut
sub channels {
my $self = shift;
if( @_ ) {
$self->{channels} = shift;
return 1;
}
return $self->{channels};
}
=head2 all
Get all audio properties.
=cut
sub all {
my $self = shift;
if (@_) {
my $props = shift;
$self->$_($props->{$_}) for keys %{$props};
return 1;
}
return {
length => $self->length(),
bitrate => $self->bitrate(),
sample_rate => $self->sample_rate(),
channels => $self->channels()
};
}
1;
=head1 SEE ALSO
L<Audio::File>, L<Audio::File::Type>, L<Audio::File::Tag>
=head1 AUTHOR
Florian Ragwitz <flora@cpan.org>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2004 Florian Ragwitz
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
=cut
|