00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OSDL_CD_ROM_DRIVE_H_
00028 #define OSDL_CD_ROM_DRIVE_H_
00029
00030
00031
00032
00033 #include "OSDLCDROMDriveHandler.h"
00034
00035
00036 #include "Ceylan.h"
00037
00038
00039 #include <string>
00040 #include <list>
00041 #include <map>
00042
00043
00044
00045 #if ! defined(OSDL_USES_SDL) || OSDL_USES_SDL
00046
00047
00048 struct SDL_CD ;
00049 struct SDL_CDtrack ;
00050
00051 #endif // ! defined(OSDL_USES_SDL) || OSDL_USES_SDL
00052
00053
00054
00055
00056 namespace OSDL
00057 {
00058
00059
00060 #if ! defined(OSDL_USES_SDL) || OSDL_USES_SDL
00061
00062
00063
00064
00065
00066
00067
00068
00069 typedef ::SDL_CD LowLevelCDROM ;
00070 typedef ::SDL_CDtrack LowLevelCDROMTrack ;
00071
00072 #else // OSDL_USES_SDL
00073
00074 struct LowLevelCDROM {} ;
00075 struct LowLevelCDROMTrack {} ;
00076
00077 #endif // OSDL_USES_SDL
00078
00079
00080
00081
00082 typedef Ceylan::Count TrackNumber ;
00083
00084
00086 typedef Ceylan::Uint32 FrameCount ;
00087
00088
00090 enum TrackType { audioTrack, dataTrack } ;
00091
00092
00093
00094
00100 class OSDL_DLL CDTrack: public Ceylan::TextDisplayable
00101 {
00102
00103
00104 public:
00105
00106
00107
00117 CDTrack( const LowLevelCDROMTrack & track ) ;
00118
00119
00120
00122 virtual ~CDTrack() throw() ;
00123
00124
00125
00127 virtual TrackNumber getTrackNumber() const ;
00128
00129
00130
00137 virtual TrackType getTrackType() const ;
00138
00139
00140
00142 virtual FrameCount getLength() const ;
00143
00144
00145
00147 virtual FrameCount getFrameOffset() const ;
00148
00149
00150
00161 virtual const std::string toString(
00162 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00163
00164
00165
00166
00167 protected:
00168
00169
00170 const LowLevelCDROMTrack * _trackData ;
00171
00172
00173
00174
00175 private:
00176
00177
00178
00187 explicit CDTrack( const CDTrack & source ) ;
00188
00189
00190
00199 CDTrack & operator = ( const CDTrack & source ) ;
00200
00201
00202 } ;
00203
00204
00205
00206
00207
00213 class OSDL_DLL CDROMDrive: public Ceylan::Object
00214 {
00215
00216
00217
00218 friend class CDROMDriveHandler ;
00219
00220
00221
00222 public:
00223
00224
00225
00227 static const FrameCount FramesPerSecond ;
00228
00229
00230
00232 enum Status { TrayEmpty, Stopped, Playing, Paused, InError } ;
00233
00234
00235
00247 virtual void open() ;
00248
00249
00250
00260 virtual void close() ;
00261
00262
00263
00272 virtual void eject() const ;
00273
00274
00275
00285 virtual Status getStatus() ;
00286
00287
00288
00297 virtual Status getConstStatus() const ;
00298
00299
00300
00311 virtual bool isCDInDrive() ;
00312
00313
00314
00322 virtual TrackNumber getTracksCount() const ;
00323
00324
00325
00335 virtual FrameCount getTrackDuration( TrackNumber targetTrack )
00336 const ;
00337
00338
00339
00351 virtual CDTrack & getTrack( TrackNumber targetTrack ) const ;
00352
00353
00354
00366 virtual void playFrames( FrameCount startingFrame,
00367 FrameCount durationInFrames ) ;
00368
00369
00370
00394 virtual void playTracks(
00395 TrackNumber startingTrack,
00396 TrackNumber numberOfTracks,
00397 FrameCount startingFrameOffset = 0,
00398 FrameCount stoppingFrameOffset = 0 ) ;
00399
00400
00401
00408 virtual void pause() const ;
00409
00410
00411
00418 virtual void resume() const ;
00419
00420
00421
00432 virtual const std::string toString(
00433 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00434
00435
00436
00437
00438
00439
00440
00441
00442
00454 static std::list<std::string> GetListOfInsertedMedia() ;
00455
00456
00457
00466 static FrameCount ConvertTimeToFrameCount(
00467 Ceylan::System::Second duration ) ;
00468
00469
00470
00481 static Ceylan::System::Second ConvertFrameCountToTime(
00482 FrameCount duration ) ;
00483
00484
00485
00486
00487 protected:
00488
00489
00491 CDROMDriveNumber _driveNumber ;
00492
00493
00494
00495
00496 private:
00497
00498
00499
00501 bool _statusUpdated ;
00502
00503
00504
00512 LowLevelCDROM * _driveStatus ;
00513
00514
00515
00529 explicit CDROMDrive( CDROMDriveNumber driveNumber ) ;
00530
00531
00532
00534 virtual ~CDROMDrive() throw() ;
00535
00536
00537
00545 explicit CDROMDrive( const CDROMDrive & source ) ;
00546
00547
00548
00556 CDROMDrive & operator = ( const CDROMDrive & source ) ;
00557
00558
00559
00560 } ;
00561
00562
00563 }
00564
00565
00566
00567 #endif // OSDL_CD_ROM_DRIVE_H_
00568