comparison data/fileio/OggVorbisFileReader.h @ 392:183ee2a55fc7

* More work to abstract out interactive components used in the data library, so that it does not need to depend on QtGui.
author Chris Cannam
date Fri, 14 Mar 2008 17:14:21 +0000
parents 700cd3350391
children 268c5431936d
comparison
equal deleted inserted replaced
391:5858cc462d0a 392:183ee2a55fc7
25 #include <oggz/oggz.h> 25 #include <oggz/oggz.h>
26 #include <fishsound/fishsound.h> 26 #include <fishsound/fishsound.h>
27 27
28 #include <set> 28 #include <set>
29 29
30 class QProgressDialog; 30 class ProgressReporter;
31 31
32 class OggVorbisFileReader : public CodedAudioFileReader 32 class OggVorbisFileReader : public CodedAudioFileReader
33 { 33 {
34 Q_OBJECT
35
34 public: 36 public:
35 enum DecodeMode { 37 enum DecodeMode {
36 DecodeAtOnce, // decode the file on construction, with progress dialog 38 DecodeAtOnce, // decode the file on construction, with progress
37 DecodeThreaded // decode in a background thread after construction 39 DecodeThreaded // decode in a background thread after construction
38 }; 40 };
39 41
40 OggVorbisFileReader(FileSource source, 42 OggVorbisFileReader(FileSource source,
41 DecodeMode decodeMode, 43 DecodeMode decodeMode,
42 CacheMode cacheMode, 44 CacheMode cacheMode,
43 size_t targetRate = 0); 45 size_t targetRate = 0,
46 ProgressReporter *reporter = 0);
44 virtual ~OggVorbisFileReader(); 47 virtual ~OggVorbisFileReader();
45 48
46 virtual QString getError() const { return m_error; } 49 virtual QString getError() const { return m_error; }
47 50
48 virtual QString getLocation() const { return m_source.getLocation(); } 51 virtual QString getLocation() const { return m_source.getLocation(); }
58 61
59 virtual bool isUpdating() const { 62 virtual bool isUpdating() const {
60 return m_decodeThread && m_decodeThread->isRunning(); 63 return m_decodeThread && m_decodeThread->isRunning();
61 } 64 }
62 65
66 public slots:
67 void cancelled();
68
63 protected: 69 protected:
64 FileSource m_source; 70 FileSource m_source;
65 QString m_path; 71 QString m_path;
66 QString m_error; 72 QString m_error;
67 QString m_title; 73 QString m_title;
68 QString m_maker; 74 QString m_maker;
69 75
70 OGGZ *m_oggz; 76 OGGZ *m_oggz;
71 FishSound *m_fishSound; 77 FishSound *m_fishSound;
72 QProgressDialog *m_progress; 78 ProgressReporter *m_reporter;
73 size_t m_fileSize; 79 size_t m_fileSize;
74 size_t m_bytesRead; 80 size_t m_bytesRead;
75 bool m_commentsRead; 81 bool m_commentsRead;
76 bool m_cancelled; 82 bool m_cancelled;
77 int m_completion; 83 int m_completion;