comparison data/fileio/BQAFileReader.h @ 1583:c8fad3c14a2b bqaudiostream

Start wiring in BQAudioStream stuff
author Chris Cannam
date Thu, 06 Dec 2018 12:50:28 +0000
parents
children b67f5b6a7978
comparison
equal deleted inserted replaced
1578:07f23b90701a 1583:c8fad3c14a2b
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
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
13 */
14
15 #ifndef SV_BQA_FILE_READER_H
16 #define SV_BQA_FILE_READER_H
17
18 #include <bqaudiostream/AudioReadStreamFactory.h>
19
20 #include "CodedAudioFileReader.h"
21 #include "base/Thread.h"
22
23 #include <set>
24
25 class ProgressReporter;
26
27 /**
28 * Audio file reader using bqaudiostream library AudioReadStream
29 * classes.
30 */
31 class BQAFileReader : public CodedAudioFileReader
32 {
33 Q_OBJECT
34
35 public:
36 BQAFileReader(FileSource source,
37 DecodeMode decodeMode,
38 CacheMode cacheMode,
39 sv_samplerate_t targetRate = 0,
40 bool normalised = false,
41 ProgressReporter *reporter = 0);
42 virtual ~BQAFileReader();
43
44 virtual QString getError() const { return m_error; }
45 virtual QString getLocation() const { return m_source.getLocation(); }
46 virtual QString getTitle() const { return m_title; }
47 virtual QString getMaker() const { return m_maker; }
48 virtual TagMap getTags() const { return m_tags; }
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 QString m_maker;
70 TagMap m_tags;
71
72 breakfastquay::AudioReadStream *m_stream;
73
74 bool m_cancelled;
75 int m_completion;
76 ProgressReporter *m_reporter;
77
78 class DecodeThread : public Thread {
79 public:
80 DecodeThread(BQAFileReader *reader) : m_reader(reader) { }
81 virtual void run();
82 protected:
83 BQAFileReader *m_reader;
84 };
85 DecodeThread *m_decodeThread;
86 };
87
88 #endif
89