OSDLCDROMDrive.h

Go to the documentation of this file.
00001 #ifndef OSDL_CD_ROM_DRIVE_H_
00002 #define OSDL_CD_ROM_DRIVE_H_
00003 
00004 
00005 // for OSDL::CDROMDriveException, CDROMDriveNumber :
00006 #include "OSDLCDROMDriveHandler.h"   
00007 
00008 #include "Ceylan.h"                  // for inheritance
00009 
00010 
00011 #include <string>
00012 #include <map>
00013 
00014 
00015 // Forward declaration.
00016 struct SDL_CD ;
00017 
00018 // Forward declaration.
00019 struct SDL_CDtrack ;
00020 
00021 
00022 
00023 namespace OSDL
00024 {
00025     
00026     
00027     // Tracks are parts of CD data that can be counted. 
00028     typedef Ceylan::Count TrackNumber ;
00029     
00030     
00032     typedef Ceylan::Uint32 FrameCount ;
00033     
00034     
00036     enum TrackType { audioTrack, dataTrack } ;
00037     
00038     
00039     
00045     class OSDL_DLL CDTrack : public Ceylan::TextDisplayable
00046     {
00047     
00048         
00049         public:
00050         
00051         
00058             CDTrack( const SDL_CDtrack & track ) throw() ;
00059             
00061             virtual ~CDTrack() throw() ;
00062             
00063             
00065             virtual TrackNumber getTrackNumber() const throw() ;
00066             
00068             virtual TrackType getTrackType() const throw() ;
00069             
00071             virtual FrameCount getLength() const throw() ;
00072             
00074             virtual FrameCount getFrameOffset() const throw() ;
00075         
00076 
00087             virtual const std::string toString( 
00088                 Ceylan::VerbosityLevels level = Ceylan::high ) const throw() ;
00089 
00090 
00091         
00092         protected:
00093         
00094         
00095             const SDL_CDtrack * _trackData ;
00096                     
00097                         
00098             
00099         private:    
00100         
00101 
00110             explicit CDTrack( const CDTrack & source ) throw() ;
00111             
00112             
00121             CDTrack & operator = ( const CDTrack & source ) throw() ;
00122             
00123     } ;
00124     
00125     
00126     
00127     
00133     class OSDL_DLL CDROMDrive : public Ceylan::Object
00134     {
00135     
00136     
00137         // The CD-ROM drive handler must be able to instanciate CD-ROM drives.
00138         friend class CDROMDriveHandler ;
00139         
00140         
00141         public:
00142         
00143 
00145             static const FrameCount FramesPerSecond ;
00146             
00147             
00149             enum Status { TrayEmpty, Stopped, Playing, Paused, InError } ; 
00150             
00151             
00163             virtual void open() throw( CDROMDriveException ) ;
00164             
00165             
00175             virtual void close() throw( CDROMDriveException ) ;
00176             
00177             
00186             virtual void eject() const throw( CDROMDriveException ) ;
00187              
00188              
00198             virtual Status getStatus() throw( CDROMDriveException ) ;
00199 
00200 
00209             virtual Status getConstStatus() const throw( CDROMDriveException ) ;
00210             
00211             
00222             virtual bool isCDInDrive() throw( CDROMDriveException ) ;
00223             
00224             
00232             virtual TrackNumber getTracksCount() const 
00233                 throw( CDROMDriveException ) ;
00234             
00235             
00245             virtual FrameCount getTrackDuration( TrackNumber targetTrack ) 
00246                 const throw( CDROMDriveException ) ;
00247              
00248             
00258             virtual CDTrack & getTrack( TrackNumber targetTrack ) 
00259                 const throw( CDROMDriveException ) ;
00260                 
00261                 
00273             virtual void playFrames( FrameCount startingFrame, 
00274                 FrameCount durationInFrames ) throw( CDROMDriveException ) ;
00275                 
00276                 
00300             virtual void playTracks( 
00301                     TrackNumber startingTrack, 
00302                     TrackNumber numberOfTracks, 
00303                     FrameCount startingFrameOffset = 0,
00304                     FrameCount stoppingFrameOffset = 0 ) 
00305                 throw( CDROMDriveException ) ;
00306             
00307             
00314             virtual void pause() const throw( CDROMDriveException ) ;
00315             
00316             
00323             virtual void resume() const throw( CDROMDriveException ) ;
00324             
00325 
00336             virtual const std::string toString( 
00337                 Ceylan::VerbosityLevels level = Ceylan::high ) const throw() ;
00338 
00339 
00340 
00341             
00342             // Static section.
00343             
00344             
00353             static FrameCount ConvertTimeToFrameCount( 
00354                 Ceylan::System::Second duration ) throw() ;
00355 
00356 
00367             static Ceylan::System::Second ConvertFrameCountToTime( 
00368                 FrameCount duration ) throw() ;
00369 
00370 
00371 
00372         protected:
00373         
00374             
00376             CDROMDriveNumber _driveNumber ;
00377     
00378     
00379         
00380         private:
00381     
00382     
00384             bool _statusUpdated ;
00385             
00386                 
00394             SDL_CD * _driveStatus ;
00395             
00396             
00410             explicit CDROMDrive( CDROMDriveNumber driveNumber ) 
00411                 throw( CDROMDriveException ) ;
00412             
00413             
00415             virtual ~CDROMDrive() throw() ;
00416             
00417             
00418 
00426             explicit CDROMDrive( const CDROMDrive & source ) throw() ;
00427             
00428             
00436             CDROMDrive & operator = ( const CDROMDrive & source ) throw() ;
00437             
00438     
00439     } ;
00440 
00441 
00442 }
00443 
00444 
00445 
00446 #endif // OSDL_CD_ROM_DRIVE_H_

Generated on Fri Mar 30 14:46:59 2007 for OSDL by  doxygen 1.5.1