| Audio-Mad documentation | view source | Contained in the Audio-Mad distribution. |
Audio::Mad::Stream - Interface to mad_stream structure
my $stream = new Audio::Mad::Stream ($options);
$stream->buffer($scalar);
my $remain = substr($scalar, $stream->next_frame);
my $position = $stream->this_frame;
$stream->skip($position + 400);
$stream->sync();
$options = $stream->options();
$options |= MAD_OPTION_IGNORECRC;
$stream->options($options);
unless ($stream->err_ok()) {
print "error code was: " . $stream->error() . "\n";
}
This package provides an interface to the underlying mad_stream structure used in the decoder library. Almost all of the methods from the library are implemented, and work on regualar perl data types.
Allocates and initializes a new mad_stream structure, and provides us with a handle to access it. You may optionally pass an integer value as the first argument to set the stream options.
Takes a scalar, and feeds it's data to the underlying mad_stream_buffer function. This part of the module isn't so hammered out just yet, it should work just fine, but there may be memory leaks / garbage collection issues just yet (although, I haven't seen anything unusual).
Skips 'length' bytes in the input stream.
Skips forward to the next MPEG sync word available in the buffer.
Returns the offset (in bytes) of the current buffer. You may use this as an index into the scalar that was passed to 'buffer'.
Returns the offset (in bytes) of the next frame in the current buffer.
Returns a numeric error code indicating the last problem encountered while gobbling up stream. Error codes correspond to the MAD_ERROR_ constants.
Returns 1 if the last error is recoverable, according to the MAD_RECOVERABLE macro.
Returns the current set of options for the current stream. When called with a paramater, it sets the options of the stream.
Mark McConnell <mischke@cpan.org>
| Audio-Mad documentation | view source | Contained in the Audio-Mad distribution. |