MP3-Mplib
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
}
goto &$AUTOLOAD;
}
bootstrap MP3::Mplib $VERSION;
# Preloaded methods go here.
# Autoload methods go after =cut, and are processed by the autosplit program.
=head1 NAME
MP3::Mplib - Speedy access to id3v1 and id3v2 tags
=head1 SYNOPSIS
use MP3::Mplib;
my $mp3 = MP3::Mplib->new("/path/to/file.mp3");
my $v1tag = $mp3->get_v1tag;
my $v2tag = $mp3->get_v2tag;
while (my ($key, $val) = each %$v1tag) {
print "$key: $val\n";
}
while (my ($key, $val) = each %$v2tag) {
...
}
$mp3->add_to_v2tag( { TYER => 2002 } );
=head1 DESCRIPTION
MP3::Mplib is a wrapper around Stefan Podkowinski's mplib written in C. It combines the best of both worlds: C's speed and Perl's nice object-orientedness. Note that B<MP3::Mplib> ships with its own version of mplib (currently 1.0.1).
There is no sophistaced class hierarchy. You simply create a B<MP3::Mplib> object. Each method either returns a native Perl data-structure or takes one. Bang. That's it.
=head1 METHODS
=over 4
=item B<new(file)>
Constructor that takes a filename as only argument.
my $mp3_object = MP3::Mplib->new("file.mp3");
=back
=cut
sub new {
my ($class, $file) = @_;
$class = ref($class) || $class;
my $self = { _mp_file => $file,
_mp_id3v1 => undef,
_mp_id3v2 => undef,
_mp_header => undef,
_mp_v2header => undef,};
bless $self => $class;
}
=pod
=over 4
=item B<header>
Returns a hash-ref to the mpeg-header.
my $mpeg_header = $mp3->header;
print $mpeg_header->{bitrate}, "\n";
...
The hash-ref contains the following fields:
=over 8
=item * I<syncword> (integer)
=item * I<version> (string)
=item * I<layer> (string)
=item * I<protbit> (boolean)
=item * I<bitrate> (string)
=item * I<samplingfreq> (string)
=item * I<padbit> (boolean)
=item * I<privbit> (boolean)
=item * I<mode> (string)
=item * I<mode_ext> (boolean)
=item * I<copyright> (boolean)
=item * I<originalhome> (boolean)
=item * I<emphasis> (boolean)
=back
=back
Z<>
=cut
sub header {
my $self = shift;
return ($self->{_mp_header} ||= get_header($self->{_mp_file}));
}
=pod
=over 4
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.705 second using v1.00-cache-2.02-grep-82fe00e-cpan-503542c4f10 )