Mercurial > hg > svcore
comparison data/fileio/CoreAudioFileReader.h @ 665:029dd9e5cc29 coreaudio_tests
tests for using coreaudio to read files in 64-bit mac osx
author | luisf |
---|---|
date | Thu, 18 Nov 2010 11:40:38 +0000 |
parents | |
children | c8ab5f63360d |
comparison
equal
deleted
inserted
replaced
623:f19437971e17 | 665:029dd9e5cc29 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 This file copyright 2006-2007 Chris Cannam and QMUL. | |
8 | |
9 Based in part on QTAudioFile.h from SoundBite, copyright 2006 | |
10 Chris Sutton and Mark Levy. | |
11 | |
12 This program is free software; you can redistribute it and/or | |
13 modify it under the terms of the GNU General Public License as | |
14 published by the Free Software Foundation; either version 2 of the | |
15 License, or (at your option) any later version. See the file | |
16 COPYING included with this distribution for more information. | |
17 */ | |
18 | |
19 #ifndef _COREAUDIO_FILE_READER_H_ | |
20 #define _COREAUDIO_FILE_READER_H_ | |
21 | |
22 #ifdef HAVE_COREAUDIO | |
23 | |
24 #include "CodedAudioFileReader.h" | |
25 | |
26 #include "base/Thread.h" | |
27 | |
28 #include <set> | |
29 | |
30 class ProgressReporter; | |
31 | |
32 class CoreAudioFileReader : public CodedAudioFileReader | |
33 { | |
34 Q_OBJECT | |
35 | |
36 public: | |
37 enum DecodeMode { | |
38 DecodeAtOnce, // decode the file on construction, with progress | |
39 DecodeThreaded // decode in a background thread after construction | |
40 }; | |
41 | |
42 CoreAudioFileReader(FileSource source, | |
43 DecodeMode decodeMode, | |
44 CacheMode cacheMode, | |
45 size_t targetRate = 0, | |
46 ProgressReporter *reporter = 0); | |
47 virtual ~CoreAudioFileReader(); | |
48 | |
49 virtual QString getError() const { return m_error; } | |
50 virtual QString getLocation() const { return m_source.getLocation(); } | |
51 virtual QString getTitle() const { return m_title; } | |
52 | |
53 static void getSupportedExtensions(std::set<QString> &extensions); | |
54 static bool supportsExtension(QString ext); | |
55 static bool supportsContentType(QString type); | |
56 static bool supports(FileSource &source); | |
57 | |
58 virtual int getDecodeCompletion() const { return m_completion; } | |
59 | |
60 virtual bool isUpdating() const { | |
61 return m_decodeThread && m_decodeThread->isRunning(); | |
62 } | |
63 | |
64 public slots: | |
65 void cancelled(); | |
66 | |
67 protected: | |
68 FileSource m_source; | |
69 QString m_path; | |
70 QString m_error; | |
71 QString m_title; | |
72 | |
73 class D; | |
74 D *m_d; | |
75 | |
76 ProgressReporter *m_reporter; | |
77 bool m_cancelled; | |
78 int m_completion; | |
79 | |
80 class DecodeThread : public Thread | |
81 { | |
82 public: | |
83 // DecodeThread(QuickTimeFileReader *reader) : m_reader(reader) { } | |
84 virtual void run(); | |
85 | |
86 protected: | |
87 // QuickTimeFileReader *m_reader; | |
88 }; | |
89 | |
90 DecodeThread *m_decodeThread; | |
91 }; | |
92 | |
93 #endif | |
94 | |
95 #endif |