comparison data/fileio/CoreAudioFileReader.h @ 751:8b79ad680ee7

Merge
author Chris Cannam
date Wed, 26 Sep 2012 21:28:14 +0100
parents c8ab5f63360d
children f3cda3280398 59e7fe1b1003
comparison
equal deleted inserted replaced
750:5bfc4930588d 751:8b79ad680ee7
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-2012 Chris Cannam and QMUL.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #ifndef _COREAUDIO_FILE_READER_H_
17 #define _COREAUDIO_FILE_READER_H_
18
19 #ifdef HAVE_COREAUDIO
20
21 #include "CodedAudioFileReader.h"
22
23 #include "base/Thread.h"
24
25 #include <set>
26
27 class ProgressReporter;
28
29 class CoreAudioFileReader : public CodedAudioFileReader
30 {
31 Q_OBJECT
32
33 public:
34 enum DecodeMode {
35 DecodeAtOnce, // decode the file on construction, with progress
36 DecodeThreaded // decode in a background thread after construction
37 };
38
39 CoreAudioFileReader(FileSource source,
40 DecodeMode decodeMode,
41 CacheMode cacheMode,
42 size_t targetRate = 0,
43 ProgressReporter *reporter = 0);
44 virtual ~CoreAudioFileReader();
45
46 virtual QString getError() const { return m_error; }
47 virtual QString getLocation() const { return m_source.getLocation(); }
48 virtual QString getTitle() const { return m_title; }
49
50 static void getSupportedExtensions(std::set<QString> &extensions);
51 static bool supportsExtension(QString ext);
52 static bool supportsContentType(QString type);
53 static bool supports(FileSource &source);
54
55 virtual int getDecodeCompletion() const { return m_completion; }
56
57 virtual bool isUpdating() const {
58 return m_decodeThread && m_decodeThread->isRunning();
59 }
60
61 public slots:
62 void cancelled();
63
64 protected:
65 FileSource m_source;
66 QString m_path;
67 QString m_error;
68 QString m_title;
69
70 class D;
71 D *m_d;
72
73 ProgressReporter *m_reporter;
74 bool m_cancelled;
75 int m_completion;
76
77 class DecodeThread : public Thread
78 {
79 public:
80 // DecodeThread(QuickTimeFileReader *reader) : m_reader(reader) { }
81 virtual void run();
82
83 protected:
84 // QuickTimeFileReader *m_reader;
85 };
86
87 DecodeThread *m_decodeThread;
88 };
89
90 #endif
91
92 #endif