Audio-Mad

 view release on metacpan or  search on metacpan

lib/Audio/Mad/Frame.pm  view on Meta::CPAN


=item * mode

=item * flags

=item * bitrate

=item * samplerate

  These functions retrieve the information from the currently 
  decoded frame header.  layer,  mode,  and flags correspond
  to the MAD_LAYER_, MAD_MODE_, and MAD_FLAG_ constants.
  bitrate and samplerate are represented as integers.
  
=item * duration

  Returns the duration of the currently decoded frame as an
  Audio::Mad::Timer object.  See Audio::Mad::Timer's manpage
  for details on what this means.
  
=item * NCHANNELS

  Returns number of channels in current frame.  1 or 2.
  
=item * NSBSAMPLES

  Returns number of samples in this frame.

test.pl  view on Meta::CPAN

	my $frame = new Audio::Mad::Frame;
	push(@frames, $frame);
	
	if ($frame->decode($stream) == -1) {
		next FRAME if ($stream->err_ok()); #recoverable
		last FRAME if ($stream->error() == MAD_ERROR_BUFLEN); #done
		print "FAILED,  stream error: " . $stream->error();
		ok(0);
	}
}
print "decoded " . ($#frames + 1) . " frames.. ";
ok(1);

print "timer test..    ";
my $timer = new Audio::Mad::Timer;
foreach my $frame (@frames) {
	$timer += $frame->duration();
}
print "timer total: ${timer}.. ";
ok(1);



( run in 0.380 second using v1.01-cache-2.11-cpan-26ccb49234f )