comparison data/fileio/MP3FileReader.h @ 316:3a6725f285d6

* Make RemoteFile far more pervasive, and use it for local files as well so that we can handle both transparently. Make it shallow copy with reference counting, so it can be used by value without having to worry about the cache file lifetime. Use RemoteFile for MainWindow file-open functions, etc
author Chris Cannam
date Thu, 18 Oct 2007 15:31:20 +0000
parents c022976d18e8
children c324d410b096
comparison
equal deleted inserted replaced
315:96ef9746c560 316:3a6725f285d6
33 enum DecodeMode { 33 enum DecodeMode {
34 DecodeAtOnce, // decode the file on construction, with progress dialog 34 DecodeAtOnce, // decode the file on construction, with progress dialog
35 DecodeThreaded // decode in a background thread after construction 35 DecodeThreaded // decode in a background thread after construction
36 }; 36 };
37 37
38 MP3FileReader(QString path, 38 MP3FileReader(RemoteFile source,
39 DecodeMode decodeMode, 39 DecodeMode decodeMode,
40 CacheMode cacheMode, 40 CacheMode cacheMode,
41 size_t targetRate = 0); 41 size_t targetRate = 0);
42 virtual ~MP3FileReader(); 42 virtual ~MP3FileReader();
43 43
44 virtual QString getError() const { return m_error; } 44 virtual QString getError() const { return m_error; }
45 45
46 virtual QString getTitle() const { return m_title; } 46 virtual QString getTitle() const { return m_title; }
47 47
48 static void getSupportedExtensions(std::set<QString> &extensions); 48 static void getSupportedExtensions(std::set<QString> &extensions);
49 49 static bool supportsExtension(QString ext);
50 static bool supportsContentType(QString type);
51 static bool supports(RemoteFile &source);
52
50 virtual int getDecodeCompletion() const { return m_completion; } 53 virtual int getDecodeCompletion() const { return m_completion; }
51 54
52 virtual bool isUpdating() const { 55 virtual bool isUpdating() const {
53 return m_decodeThread && m_decodeThread->isRunning(); 56 return m_decodeThread && m_decodeThread->isRunning();
54 } 57 }
55 58
56 protected: 59 protected:
60 RemoteFile m_source;
57 QString m_path; 61 QString m_path;
58 QString m_error; 62 QString m_error;
59 QString m_title; 63 QString m_title;
60 size_t m_fileSize; 64 size_t m_fileSize;
61 double m_bitrateNum; 65 double m_bitrateNum;