Audio-MPC
view release on metacpan or search on metacpan
lib/Audio/MPC.pm view on Meta::CPAN
This is called when the decoder wants to acquire more data to decode. I<reader> is
the object as returned by C<< Audio::MPC::Reader->new >> and I<size> denotes the
number of bytes that should be read from the stream. The function is expected to
return the data read from the underlying filehandle.
sub my_read {
my ($reader, $size) = @_;
read $reader->fh, my ($buf), $size;
return $buf;
}
=item * seek (reader, offset)
I<offset> is the byte position to seek to. The function is expected to return true
if the seek operation was succesful:
sub my_seek {
my ($reader, $offset) = @_;
return seek $reader->fh, $offset, SEEK_SET;
}
=item * tell (reader)
The function is expected to return the filepointer's current position in the stream:
sub my_tell {
my $reader = shift;
return tell $reader->fh;
}
=item * get_size (reader)
The function is expected to return the size of the complete data-stream:
sub my_get_size {
my $reader = shift;
return -s $reader->fh;
}
=item * canseek (reader)
The function is expected to return a true value if the underlying filehandle
is seekable. However, experiments showed that non-seekable streams cannot be
decoded and are therefore not handled at all:
sub canseek {
my $reader = shift;
return seek $reader->fh, 0, SEEK_CUR; # test if seek succeeded
}
=back
=head1 EXPORT
These symbols are exported by default:
WAV_HEADER_SIZE
MPC_LITTLE_ENDIAN
MPC_BIG_ENDIAN
=head1 BUGS AND LIMITATIONS
I am not aware of any outright bugs yet.
A limitation of libmpcdec seems to be that you cannot decode from STDIN as it
is not seekable. It should however be possible to craft your own
C<Audio::MPC::Reader> object which maintains an internal character buffer as
userdata that can be used to fake up a seekable filehandle.
=for readme continue
=begin readme
=head1 INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
make install
=head1 DEPENDENCIES
Due to a subtle but unpleasant interaction between C++ method overloading and
the perl internals, you need at least perl5.8.0.
You need a working C++ compiler and libmpcdec as available from L<http://www.musepack.net/>.
Furthermore:
Test::More
Test::LongString
=end readme
=begin changes
=head1 Revision history for Perl extension Audio::MPC
=over 4
=item * 0.04 Tue Mar 7 11:44:00 CEST 2006
- updated to use libmpcdec who replaces libmusepack
=item * 0.03 Fri Sep 30 08:02:00 CEST 2005
- there was a segfault when a file passed by filename
could not be opened: fixed
- errstr() method now includes $! when appropriate
- fixed the SYNOPSIS section of the perldocs:
the little script given in there now works
=item * 0.02 Mon May 16 13:13:58 CEST 2005
- check.c had the wrong #include that would prevent
installation on most systems
=item * 0.01 Wed May 4 08:30:27 2005
- original version; created by h2xs 1.23 with options
( run in 2.284 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )