00001 #ifndef CDDECODER_H_
00002 #define CDDECODER_H_
00003
00004 #include "decoder.h"
00005
00006 #include <mythtv/mythconfig.h>
00007
00008 #ifdef CONFIG_DARWIN
00009 #include <vector>
00010 #endif
00011
00012 #ifdef __linux__
00013 #include <cdaudio.h>
00014 extern "C" {
00015 #include <cdda_interface.h>
00016 #include <cdda_paranoia.h>
00017 }
00018 #endif
00019
00020 class Metadata;
00021
00022 class CdDecoder : public Decoder
00023 {
00024 public:
00025 CdDecoder(const QString &file, DecoderFactory *, QIODevice *, AudioOutput *);
00026 virtual ~CdDecoder(void);
00027
00028 bool initialize();
00029 double lengthInSeconds();
00030 void seek(double);
00031 void stop();
00032
00033 int getNumTracks(void);
00034 int getNumCDAudioTracks(void);
00035
00036
00037
00038 Metadata *getMetadata(int track);
00039 Metadata *getMetadata(void);
00040 Metadata *getLastMetadata(void);
00041
00042 void commitMetadata(Metadata *mdata);
00043 void setDevice(const QString &dev) { devicename = dev; }
00044 void setCDSpeed(int speed);
00045
00046 private:
00047 void run();
00048
00049 void flush(bool = FALSE);
00050 void deinit();
00051
00052 bool inited, user_stop;
00053
00054
00055 QString devicename;
00056
00057 #ifdef CONFIG_DARWIN
00058 void CdDecoder::lookupCDDB(const QString &hexID, uint tracks);
00059
00060 uint32_t m_diskID;
00061 uint m_firstTrack,
00062 m_lastTrack,
00063 m_leadout;
00064 double m_lengthInSecs;
00065 vector<int> m_tracks;
00066 vector<Metadata*> m_mData;
00067 #endif
00068
00069 int stat;
00070 char *output_buf;
00071 ulong output_bytes, output_at;
00072
00073 unsigned int bks;
00074 bool done, finish;
00075 long len, freq, bitrate;
00076 int chan;
00077 unsigned long output_size;
00078 double totalTime, seekTime;
00079
00080 int settracknum;
00081 int tracknum;
00082
00083 #ifdef __linux__
00084 cdrom_drive *device;
00085 cdrom_paranoia *paranoia;
00086 #endif
00087
00088 long int start;
00089 long int end;
00090 long int curpos;
00091 };
00092
00093 #endif
00094