A CD-ROM drive allows to control a particular CD-ROM device attached to the system. More...
#include <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 () |
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 () |
Closes this CD-ROM drive, a bit like 'unmounting' this device. | |
virtual void | eject () const |
Ejects the CD-ROM which is in the drive. | |
virtual Status | getStatus () |
Returns the current status of this drive. | |
virtual Status | getConstStatus () const |
Returns the current status of this drive. | |
virtual bool | isCDInDrive () |
Tells whether there is a CD in drive. | |
virtual TrackNumber | getTracksCount () const |
Returns the number of tracks in the CD in this drive. | |
virtual FrameCount | getTrackDuration (TrackNumber targetTrack) const |
Returns the duration, in frames, of the specified track. | |
virtual CDTrack & | getTrack (TrackNumber targetTrack) const |
Returns the CD track of specified number. | |
virtual void | playFrames (FrameCount startingFrame, FrameCount durationInFrames) |
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) |
Plays the CD-ROM in drive, starting from specified CD track, for specified number of tracks. | |
virtual void | pause () const |
Pauses play on this CD-ROM. | |
virtual void | resume () const |
Resumes play on this CD-ROM. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const |
Returns an user-friendly description of the state of this drive. | |
Static Public Member Functions | |
static std::list< std::string > | GetListOfInsertedMedia () |
Returns a list of inserted disc media, such as DVD-ROM, HD-DVD, CDRW, and Blu-Ray discs. | |
static FrameCount | ConvertTimeToFrameCount (Ceylan::System::Second duration) |
Returns the number of CD frames corresponding to the specified time. | |
static Ceylan::System::Second | ConvertFrameCountToTime (FrameCount duration) |
Returns the duration in seconds corresponding to the specified number of CD frames. | |
Static Public Attributes | |
static const FrameCount | FramesPerSecond = 75 |
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) | |
A CD-ROM drive object (CDROMDrive) will be associated uniquely to a CD-ROM device. | |
virtual | ~CDROMDrive () throw () |
Virtual destructor. | |
CDROMDrive (const CDROMDrive &source) | |
Copy constructor made private to ensure that it will be never called. | |
CDROMDrive & | operator= (const CDROMDrive &source) |
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. | |
LowLevelCDROM * | _driveStatus |
Gathers some informations about this drive and its status. | |
Friends | |
class | CDROMDriveHandler |
A CD-ROM drive allows to control a particular CD-ROM device attached to the system.
Definition at line 213 of file OSDLCDROMDrive.h.
Describes the status possibilites of a CD drive.
Definition at line 232 of file OSDLCDROMDrive.h.
CDROMDrive::CDROMDrive | ( | CDROMDriveNumber | driveNumber | ) | [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 265 of file OSDLCDROMDrive.cc.
CDROMDrive::~CDROMDrive | ( | ) | throw () [private, virtual] |
Virtual destructor.
Definition at line 283 of file OSDLCDROMDrive.cc.
References _driveStatus, and close().
OSDL::CDROMDrive::CDROMDrive | ( | const CDROMDrive & | source | ) | [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::close | ( | ) | [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 314 of file OSDLCDROMDrive.cc.
References _driveStatus.
Referenced by ~CDROMDrive().
Ceylan::System::Second CDROMDrive::ConvertFrameCountToTime | ( | FrameCount | duration | ) | [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 706 of file OSDLCDROMDrive.cc.
References FramesPerSecond.
Referenced by OSDL::CDTrack::toString().
FrameCount CDROMDrive::ConvertTimeToFrameCount | ( | Ceylan::System::Second | duration | ) | [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 696 of file OSDLCDROMDrive.cc.
References FramesPerSecond.
void CDROMDrive::eject | ( | ) | const [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 334 of file OSDLCDROMDrive.cc.
References _driveStatus, and OSDL::Utils::getBackendLastError().
CDROMDrive::Status CDROMDrive::getConstStatus | ( | ) | const [virtual] |
Returns the current status of this drive.
CDROMDriveException | if drive not already open. |
Definition at line 365 of file OSDLCDROMDrive.cc.
References _driveStatus, InError, Paused, Playing, Stopped, and TrayEmpty.
Referenced by getStatus(), and toString().
std::list< std::string > CDROMDrive::GetListOfInsertedMedia | ( | ) | [static] |
Returns a list of inserted disc media, such as DVD-ROM, HD-DVD, CDRW, and Blu-Ray discs.
CDROMDriveException | if the operation failed. |
Definition at line 666 of file OSDLCDROMDrive.cc.
References OSDL::EmbeddedFileSystemManager::SecureEmbeddedFileSystemManager().
CDROMDrive::Status CDROMDrive::getStatus | ( | ) | [virtual] |
Returns the current status of this drive.
CDROMDriveException | if drive not already open. |
This method cannot be 'const' since status update flag has to be updated.
Definition at line 352 of file OSDLCDROMDrive.cc.
References _statusUpdated, and getConstStatus().
Referenced by isCDInDrive(), and playTracks().
CDTrack & CDROMDrive::getTrack | ( | TrackNumber | targetTrack | ) | const [virtual] |
Returns the CD track of specified number.
targetTrack | the track to return. |
CDROMDriveException | if the operation failed. |
Definition at line 470 of file OSDLCDROMDrive.cc.
References _driveStatus, getTracksCount(), and OSDL::Video::Pixels::toString().
FrameCount CDROMDrive::getTrackDuration | ( | TrackNumber | targetTrack | ) | const [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 447 of file OSDLCDROMDrive.cc.
References _driveStatus, getTracksCount(), and OSDL::Video::Pixels::toString().
TrackNumber CDROMDrive::getTracksCount | ( | ) | const [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 426 of file OSDLCDROMDrive.cc.
References _driveStatus.
Referenced by getTrack(), getTrackDuration(), and toString().
bool CDROMDrive::isCDInDrive | ( | ) | [virtual] |
Tells whether there is a CD in drive.
CDROMDriveException | if drive not already open. |
Cannot be 'const' since 'getStatus' neither.
Definition at line 415 of file OSDLCDROMDrive.cc.
References getStatus(), InError, and TrayEmpty.
void CDROMDrive::open | ( | ) | [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 293 of file OSDLCDROMDrive.cc.
References _driveNumber, _driveStatus, and OSDL::Utils::getBackendLastError().
CDROMDrive& OSDL::CDROMDrive::operator= | ( | const CDROMDrive & | source | ) | [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.
void CDROMDrive::pause | ( | ) | const [virtual] |
Pauses play on this CD-ROM.
CDROMDriveException | if an error occured. |
Definition at line 538 of file OSDLCDROMDrive.cc.
References _driveStatus, and OSDL::Utils::getBackendLastError().
void CDROMDrive::playFrames | ( | FrameCount | startingFrame, | |
FrameCount | durationInFrames | |||
) | [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 494 of file OSDLCDROMDrive.cc.
References _driveStatus, and OSDL::Utils::getBackendLastError().
void CDROMDrive::playTracks | ( | TrackNumber | startingTrack, | |
TrackNumber | numberOfTracks, | |||
FrameCount | startingFrameOffset = 0 , |
|||
FrameCount | stoppingFrameOffset = 0 | |||
) | [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 514 of file OSDLCDROMDrive.cc.
References _driveStatus, _statusUpdated, OSDL::Utils::getBackendLastError(), and getStatus().
void CDROMDrive::resume | ( | ) | const [virtual] |
Resumes play on this CD-ROM.
CDROMDriveException | if an error occured. |
Definition at line 557 of file OSDLCDROMDrive.cc.
References _driveStatus, and OSDL::Utils::getBackendLastError().
const string CDROMDrive::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns an user-friendly description of the state of this drive.
level | the requested verbosity level. |
Definition at line 576 of file OSDLCDROMDrive.cc.
References _driveNumber, _driveStatus, generate_master_palette::count, getConstStatus(), getTracksCount(), InError, Paused, Playing, Stopped, OSDL::CDTrack::toString(), OSDL::Video::Pixels::toString(), and TrayEmpty.
friend class CDROMDriveHandler [friend] |
Definition at line 218 of file OSDLCDROMDrive.h.
CDROMDriveNumber OSDL::CDROMDrive::_driveNumber [protected] |
Records the number associated with this drive object.
Definition at line 491 of file OSDLCDROMDrive.h.
Referenced by open(), and toString().
LowLevelCDROM* 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 512 of file OSDLCDROMDrive.h.
Referenced by close(), eject(), getConstStatus(), getTrack(), getTrackDuration(), getTracksCount(), open(), pause(), playFrames(), playTracks(), resume(), toString(), and ~CDROMDrive().
bool OSDL::CDROMDrive::_statusUpdated [private] |
Telles whether track information about the CD is available.
Definition at line 501 of file OSDLCDROMDrive.h.
Referenced by getStatus(), and playTracks().
const FrameCount CDROMDrive::FramesPerSecond = 75 [static] |
Tells how many CD frames make one second.
Definition at line 227 of file OSDLCDROMDrive.h.
Referenced by ConvertFrameCountToTime(), and ConvertTimeToFrameCount().