#include <OSDLCDROMDrive.h>
Definition at line 133 of file OSDLCDROMDrive.h.
Public Types | |
enum | Status { TrayEmpty, Stopped, Playing, Paused, InError } |
Describes the status possibilites of a CD drive. More... | |
Public Member Functions | |
virtual void | open () throw ( CDROMDriveException ) |
Opens for access this CD-ROM drive, so that the CD that must be in it can be directly read afterwards, a bit like 'mounting' this device. | |
virtual void | close () throw ( CDROMDriveException ) |
Closes this CD-ROM drive, a bit like 'unmounting' this device. | |
virtual void | eject () const throw ( CDROMDriveException ) |
Ejects the CD-ROM which is in the drive. | |
virtual Status | getStatus () throw ( CDROMDriveException ) |
Returns the current status of this drive. | |
virtual Status | getConstStatus () const throw ( CDROMDriveException ) |
Returns the current status of this drive. | |
virtual bool | isCDInDrive () throw ( CDROMDriveException ) |
Tells whether there is a CD in drive. | |
virtual TrackNumber | getTracksCount () const throw ( CDROMDriveException ) |
Returns the number of tracks in the CD in this drive. | |
virtual FrameCount | getTrackDuration (TrackNumber targetTrack) const throw ( CDROMDriveException ) |
Returns the duration, in frames, of the specified track. | |
virtual CDTrack & | getTrack (TrackNumber targetTrack) const throw ( CDROMDriveException ) |
Returns the CD track of specified number. | |
virtual void | playFrames (FrameCount startingFrame, FrameCount durationInFrames) throw ( CDROMDriveException ) |
Plays the CD-ROM in drive, starting from specified CD frame, for specified duration. | |
virtual void | playTracks (TrackNumber startingTrack, TrackNumber numberOfTracks, FrameCount startingFrameOffset=0, FrameCount stoppingFrameOffset=0) throw ( CDROMDriveException ) |
Plays the CD-ROM in drive, starting from specified CD track, for specified number of tracks. | |
virtual void | pause () const throw ( CDROMDriveException ) |
Pauses play on this CD-ROM. | |
virtual void | resume () const throw ( CDROMDriveException ) |
Resumes play on this CD-ROM. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const throw () |
Returns an user-friendly description of the state of this drive. | |
Static Public Member Functions | |
static FrameCount | ConvertTimeToFrameCount (Ceylan::System::Second duration) throw () |
Returns the number of CD frames corresponding to the specified time. | |
static Ceylan::System::Second | ConvertFrameCountToTime (FrameCount duration) throw () |
Returns the duration in seconds corresponding to the specified number of CD frames. | |
Static Public Attributes | |
static const FrameCount | FramesPerSecond |
Tells how many CD frames make one second. | |
Protected Attributes | |
CDROMDriveNumber | _driveNumber |
Records the number associated with this drive object. | |
Private Member Functions | |
CDROMDrive (CDROMDriveNumber driveNumber) throw ( CDROMDriveException ) | |
A CD-ROM drive object (CDROMDrive) will be associated uniquely to a CD-ROM device. | |
virtual | ~CDROMDrive () throw () |
Virtual destructor. | |
CDROMDrive (const CDROMDrive &source) throw () | |
Copy constructor made private to ensure that it will be never called. | |
CDROMDrive & | operator= (const CDROMDrive &source) throw () |
Assignment operator made private to ensure that it will be never called. | |
Private Attributes | |
bool | _statusUpdated |
Telles whether track information about the CD is available. | |
SDL_CD * | _driveStatus |
Gathers some informations about this drive and its status. | |
Friends | |
class | CDROMDriveHandler |
CDROMDrive::CDROMDrive | ( | CDROMDriveNumber | driveNumber | ) | throw ( CDROMDriveException ) [explicit, private] |
A CD-ROM drive object (CDROMDrive) will be associated uniquely to a CD-ROM device.
This constructor is private so that the factory gets total control onto drive instance creations.
driveNumber | the drive number to take control of. |
CDROMDriveException | if specified drive number is not in licit range. |
Definition at line 130 of file OSDLCDROMDrive.cc.
CDROMDrive::~CDROMDrive | ( | ) | throw () [private, virtual] |
Virtual destructor.
Definition at line 141 of file OSDLCDROMDrive.cc.
References _driveStatus, and close().
OSDL::CDROMDrive::CDROMDrive | ( | const CDROMDrive & | source | ) | throw () [explicit, private] |
Copy constructor made private to ensure that it will be never called.
The compiler should complain whenever this undefined constructor is called, implicitly or not.
void CDROMDrive::open | ( | ) | throw ( CDROMDriveException ) [virtual] |
Opens for access this CD-ROM drive, so that the CD that must be in it can be directly read afterwards, a bit like 'mounting' this device.
CDROMDriveException | if the drive could not be opened, for example if it is busy, or with no disc, or already opened. |
Definition at line 150 of file OSDLCDROMDrive.cc.
References _driveNumber, _driveStatus, and OSDL::Utils::getBackendLastError().
void CDROMDrive::close | ( | ) | throw ( CDROMDriveException ) [virtual] |
Closes this CD-ROM drive, a bit like 'unmounting' this device.
CDROMDriveException | if the drive could not be opened, for example if it is busy and not opened. |
Definition at line 166 of file OSDLCDROMDrive.cc.
References _driveStatus.
Referenced by ~CDROMDrive().
void CDROMDrive::eject | ( | ) | const throw ( CDROMDriveException ) [virtual] |
Ejects the CD-ROM which is in the drive.
The drive must be already opened.
CDROMDriveException | if an error occured, for example if drive was not open. |
Definition at line 181 of file OSDLCDROMDrive.cc.
References _driveStatus, and OSDL::Utils::getBackendLastError().
CDROMDrive::Status CDROMDrive::getStatus | ( | ) | throw ( CDROMDriveException ) [virtual] |
Returns the current status of this drive.
CDROMDriveException | if drive not already open. |
Definition at line 195 of file OSDLCDROMDrive.cc.
References _statusUpdated, and getConstStatus().
Referenced by isCDInDrive().
CDROMDrive::Status CDROMDrive::getConstStatus | ( | ) | const throw ( CDROMDriveException ) [virtual] |
Returns the current status of this drive.
CDROMDriveException | if drive not already open. |
Definition at line 207 of file OSDLCDROMDrive.cc.
References _driveStatus, InError, Paused, Playing, Stopped, and TrayEmpty.
Referenced by getStatus().
bool CDROMDrive::isCDInDrive | ( | ) | throw ( CDROMDriveException ) [virtual] |
Tells whether there is a CD in drive.
CDROMDriveException | if drive not already open. |
Definition at line 252 of file OSDLCDROMDrive.cc.
References getStatus(), InError, and TrayEmpty.
TrackNumber CDROMDrive::getTracksCount | ( | ) | const throw ( CDROMDriveException ) [virtual] |
Returns the number of tracks in the CD in this drive.
CDROMDriveException | if an error occured, for example if the drive is not already opened. |
Definition at line 261 of file OSDLCDROMDrive.cc.
References _driveStatus.
FrameCount CDROMDrive::getTrackDuration | ( | TrackNumber | targetTrack | ) | const throw ( CDROMDriveException ) [virtual] |
Returns the duration, in frames, of the specified track.
targetTrack | the track whose duration is to be known. |
CDROMDriveException | if an error occured, for example if an invalid track number is given. |
Definition at line 273 of file OSDLCDROMDrive.cc.
References OSDL::Video::Pixels::toString().
CDTrack & CDROMDrive::getTrack | ( | TrackNumber | targetTrack | ) | const throw ( CDROMDriveException ) [virtual] |
Returns the CD track of specified number.
targetTrack | the track to return. |
Definition at line 288 of file OSDLCDROMDrive.cc.
References OSDL::Video::Pixels::toString().
void CDROMDrive::playFrames | ( | FrameCount | startingFrame, | |
FrameCount | durationInFrames | |||
) | throw ( CDROMDriveException ) [virtual] |
Plays the CD-ROM in drive, starting from specified CD frame, for specified duration.
startingFrame | the frame to start. | |
durationInFrames | the duration, specified in frames. |
CDROMDriveException | if an error occured. |
Definition at line 303 of file OSDLCDROMDrive.cc.
References OSDL::Utils::getBackendLastError().
void CDROMDrive::playTracks | ( | TrackNumber | startingTrack, | |
TrackNumber | numberOfTracks, | |||
FrameCount | startingFrameOffset = 0 , |
|||
FrameCount | stoppingFrameOffset = 0 | |||
) | throw ( CDROMDriveException ) [virtual] |
Plays the CD-ROM in drive, starting from specified CD track, for specified number of tracks.
Frame offsets can be used to start after the beginning of the starting track and to stop after the stopping track.
startingTrack | the track to start with. | |
numberOfTracks | the number of tracks to play from 'startingTrack'. | |
startingFrameOffset | the frame offset, from the beginning of 'startingTrack', at which to start. | |
stoppingFrameOffset | the frame offset, from the beginning of the last track (startingTrack+numberOfTracks), at which to end playing. |
CDROMDriveException | if an error occured. |
Definition at line 318 of file OSDLCDROMDrive.cc.
References OSDL::Utils::getBackendLastError().
void CDROMDrive::pause | ( | ) | const throw ( CDROMDriveException ) [virtual] |
Pauses play on this CD-ROM.
CDROMDriveException | if an error occured. |
Definition at line 337 of file OSDLCDROMDrive.cc.
References _driveStatus, and OSDL::Utils::getBackendLastError().
void CDROMDrive::resume | ( | ) | const throw ( CDROMDriveException ) [virtual] |
Resumes play on this CD-ROM.
CDROMDriveException | if an error occured. |
Definition at line 351 of file OSDLCDROMDrive.cc.
References _driveStatus, and OSDL::Utils::getBackendLastError().
const string CDROMDrive::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const throw () [virtual] |
Returns an user-friendly description of the state of this drive.
level | the requested verbosity level. |
Definition at line 365 of file OSDLCDROMDrive.cc.
References OSDL::Video::Pixels::toString().
FrameCount CDROMDrive::ConvertTimeToFrameCount | ( | Ceylan::System::Second | duration | ) | throw () [static] |
Returns the number of CD frames corresponding to the specified time.
duration | the duration in seconds to convert into CD frames. |
Definition at line 447 of file OSDLCDROMDrive.cc.
Ceylan::System::Second CDROMDrive::ConvertFrameCountToTime | ( | FrameCount | duration | ) | throw () [static] |
Returns the duration in seconds corresponding to the specified number of CD frames.
duration | the duration in seconds to convert into CD frames. | |
The | returned number of second is rounded. |
Definition at line 456 of file OSDLCDROMDrive.cc.
Referenced by OSDL::CDTrack::toString().
CDROMDrive& OSDL::CDROMDrive::operator= | ( | const CDROMDrive & | source | ) | throw () [private] |
Assignment operator made private to ensure that it will be never called.
The compiler should complain whenever this undefined operator is called, implicitly or not.
friend class CDROMDriveHandler [friend] |
Definition at line 138 of file OSDLCDROMDrive.h.
const FrameCount CDROMDrive::FramesPerSecond [static] |
CDROMDriveNumber OSDL::CDROMDrive::_driveNumber [protected] |
Records the number associated with this drive object.
Definition at line 376 of file OSDLCDROMDrive.h.
Referenced by open().
bool OSDL::CDROMDrive::_statusUpdated [private] |
Telles whether track information about the CD is available.
Definition at line 384 of file OSDLCDROMDrive.h.
Referenced by getStatus().
SDL_CD* OSDL::CDROMDrive::_driveStatus [private] |
Gathers some informations about this drive and its status.
Tells too whether the drive is open for access (if non-null) or not (if null).
Definition at line 394 of file OSDLCDROMDrive.h.
Referenced by close(), eject(), getConstStatus(), getTracksCount(), open(), pause(), resume(), and ~CDROMDrive().