00001 #ifndef CDDECODER_H_
00002 #define CDDECODER_H_
00003
00004 #include "decoder.h"
00005
00006 #include <mythconfig.h>
00007
00008 #if CONFIG_DARWIN
00009 #include <vector>
00010 using std::vector;
00011 #endif
00012
00013 #ifdef HAVE_CDIO
00014 # include <cdio/cdda.h>
00015 # include <cdio/paranoia.h>
00016 #endif
00017
00018 class Metadata;
00019
00020 class CdDecoder : public Decoder
00021 {
00022 public:
00023 CdDecoder(const QString &file, DecoderFactory *, QIODevice *, AudioOutput *);
00024 virtual ~CdDecoder();
00025
00026
00027 virtual bool initialize();
00028 virtual void seek(double);
00029 virtual void stop();
00030
00031
00032 virtual Metadata *getMetadata(void);
00033 virtual void commitMetadata(Metadata *mdata);
00034
00035
00036
00037 Metadata *getMetadata(int track);
00038 Metadata *getLastMetadata();
00039
00040 #if CONFIG_DARWIN
00041 double lengthInSeconds();
00042 #endif
00043 int getNumTracks();
00044 int getNumCDAudioTracks();
00045
00046 void setDevice(const QString &dev);
00047 void setCDSpeed(int speed);
00048
00049 private:
00050 void run();
00051
00052 void writeBlock();
00053 void deinit();
00054
00055 volatile bool m_inited;
00056 volatile bool m_user_stop;
00057
00058 QString m_devicename;
00059
00060 #if CONFIG_DARWIN
00061 void lookupCDDB(const QString &hexID, uint tracks);
00062
00063 uint32_t m_diskID;
00064 uint m_firstTrack,
00065 m_lastTrack,
00066 m_leadout;
00067 double m_lengthInSecs;
00068 vector<int> m_tracks;
00069 vector<Metadata*> m_mData;
00070 #endif
00071 static QMutex& getCdioMutex();
00072
00073 DecoderEvent::Type m_stat;
00074 char *m_output_buf;
00075 std::size_t m_output_at;
00076
00077 std::size_t m_bks, m_bksFrames, m_decodeBytes;
00078 bool m_finish;
00079 long m_freq, m_bitrate;
00080 int m_chan;
00081 double m_seekTime;
00082
00083 int m_settracknum;
00084 int m_tracknum;
00085
00086 #ifdef HAVE_CDIO
00087 CdIo_t *m_cdio;
00088 cdrom_drive_t *m_device;
00089 cdrom_paranoia_t *m_paranoia;
00090 lsn_t m_start, m_end, m_curpos;
00091 #endif
00092 };
00093
00094 #endif
00095