Linux-CDROM

 view release on metacpan or  search on metacpan

lib/Linux/CDROM.pm  view on Meta::CPAN

Note that internally addressing always happens through LBA. 

Note how MSF can be transformed into LBA easily:

    my $lba = ($minute * CD_SECS + $seconds) * CD_FRAMES + $frames;

But you don't have to do that manually. This class provides the appropriate
conversion routines.

=item * B<frame>

Returns the frame of this address. This is B<not> the absolute frame but the
frame in the range of 0 and 74 according to MSF addressing.

=item * B<second>

Returns the second of this address. This is B<not> the absolute second but the second according
to MSF addressing (in the range 0 and 59).

=item * B<minute>

Returns the minute of this address.

=item * B<as_lba>

Returns the absolete frame number.

=item * B<as_msf>

Returns the address broken into minute, second and frame as a list of three values.

=back

=head1 METHODS FOR Linux::CDROM::TocEntry

This kind of object is returned by C<Linux::CDROM::toc_entry(num)>. It
represents one track on the CD. There is no separate constructor for these
objects.

=over 4

=item * B<addr>

Returns the position of this track on the disc as a C<Linux::CDROM::Addr> object.

=item * B<is_data>

Returns a true value if this track is a data track.

=item * B<is_audio>

Returns a true value if this track is an audio track.

=back

=head1 METHODS FOR Linux::CDROM::Subchannel

These objects represent the state of your drive in the moment you call C<<
$cd->poll >>.  Some operations (most notably playing Audio) on the drive are
non-blocking and your program therefore continues with the execution while your
drive is busy carrying out the desired operation. You can now ask the drive
what it is currently doing in a tight loop. The information your drives returns
to you are C<Linux::CDROM::Subchannel> objects.

=over 4

=item * B<status>

The basic status of your drive. It returns one of the following values:

=over 8

=item * B<CDROM_AUDIO_INVALID>

Audio status not supported.

=item * B<CDROM_AUDIO_PLAY>

Your drive is right now busy playing back an Audio track.

=item * B<CDROM_AUDIO_PAUSED>

Audio playback is paused. You can use C<< $cd->resume >> to continue it.

=item * B<CDROM_AUDIO_COMPLETED>

Audio playback successfully completed.

=item * B<CDROM_AUDIO_ERROR>

Audio playback stopped due to an error.

=item * B<CDROM_AUDIO_NO_STATUS>

No current audio status to return.

=back

=item * B<abs_addr>

Returns a C<Linux::CDROM::Addr> object representing the absolute position
where your drive is currently playing audio.

=item * B<rel_addr>

Returns a C<Linux::CDROM::Addr> object representing the relative position
(relative to the current track) where your drive is playing audio.

=item * B<track>

The current track your drive is playing back.

=item * B<index>

Yet another positional information. Returns an offset within the currently
playing track, probably in the range of 0 and 255.

=back

=head1 METHODS FOR Linux::CDROM::Format

This class offers some utility methods that are useful when working with CDROMs on a low level.
All methods are class-methods so there is no object here.

=over 4

=item * B<wav_header(bytes)>

This returns a WAV header suitable for I<bytes> audio data. If you put this at
the end of a file and stuff the data as returned by
C<Linux::CDROM::read_audio> behind it, you'll get a valid WAV file that can be
played back by any sane wave-player:

    # create a header for 30 million bytes of data
    my $header = Linux::CDROM::Format->wav_header( 30_000_000 );
    print WAVFILE $header;
    print WAVFILE $data;

The header specifies that the data will have a sample-rate of 44100Hz, 16 bit



( run in 1.952 second using v1.01-cache-2.11-cpan-5a3173703d6 )