annotate data/fileio/BQAFileReader.h @ 1762:110f853c3149 by-id

Deleted-model checks, & debug output
author Chris Cannam
date Mon, 15 Jul 2019 14:12:37 +0100
parents b67f5b6a7978
children 14747f24ad04
rev   line source
Chris@1583 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@1583 2
Chris@1583 3 /*
Chris@1583 4 Sonic Visualiser
Chris@1583 5 An audio file viewer and annotation editor.
Chris@1583 6 Centre for Digital Music, Queen Mary, University of London.
Chris@1583 7
Chris@1583 8 This program is free software; you can redistribute it and/or
Chris@1583 9 modify it under the terms of the GNU General Public License as
Chris@1583 10 published by the Free Software Foundation; either version 2 of the
Chris@1583 11 License, or (at your option) any later version. See the file
Chris@1583 12 COPYING included with this distribution for more information.
Chris@1583 13 */
Chris@1583 14
Chris@1583 15 #ifndef SV_BQA_FILE_READER_H
Chris@1583 16 #define SV_BQA_FILE_READER_H
Chris@1583 17
Chris@1583 18 #include <bqaudiostream/AudioReadStreamFactory.h>
Chris@1583 19
Chris@1583 20 #include "CodedAudioFileReader.h"
Chris@1583 21 #include "base/Thread.h"
Chris@1583 22
Chris@1583 23 #include <set>
Chris@1583 24
Chris@1583 25 class ProgressReporter;
Chris@1583 26
Chris@1583 27 /**
Chris@1583 28 * Audio file reader using bqaudiostream library AudioReadStream
Chris@1583 29 * classes.
Chris@1583 30 */
Chris@1583 31 class BQAFileReader : public CodedAudioFileReader
Chris@1583 32 {
Chris@1583 33 Q_OBJECT
Chris@1583 34
Chris@1583 35 public:
Chris@1583 36 BQAFileReader(FileSource source,
Chris@1583 37 DecodeMode decodeMode,
Chris@1583 38 CacheMode cacheMode,
Chris@1583 39 sv_samplerate_t targetRate = 0,
Chris@1583 40 bool normalised = false,
Chris@1583 41 ProgressReporter *reporter = 0);
Chris@1583 42 virtual ~BQAFileReader();
Chris@1583 43
Chris@1587 44 QString getError() const override { return m_error; }
Chris@1587 45 QString getLocation() const override { return m_source.getLocation(); }
Chris@1587 46 QString getTitle() const override { return m_title; }
Chris@1587 47 QString getMaker() const override { return m_maker; }
Chris@1583 48
Chris@1583 49 static void getSupportedExtensions(std::set<QString> &extensions);
Chris@1583 50 static bool supportsExtension(QString ext);
Chris@1583 51 static bool supportsContentType(QString type);
Chris@1583 52 static bool supports(FileSource &source);
Chris@1583 53
Chris@1587 54 int getDecodeCompletion() const override { return m_completion; }
Chris@1583 55
Chris@1587 56 bool isUpdating() const override {
Chris@1583 57 return m_decodeThread && m_decodeThread->isRunning();
Chris@1583 58 }
Chris@1583 59
Chris@1583 60 public slots:
Chris@1583 61 void cancelled();
Chris@1583 62
Chris@1583 63 protected:
Chris@1583 64 FileSource m_source;
Chris@1583 65 QString m_path;
Chris@1583 66 QString m_error;
Chris@1583 67 QString m_title;
Chris@1583 68 QString m_maker;
Chris@1583 69
Chris@1583 70 breakfastquay::AudioReadStream *m_stream;
Chris@1583 71
Chris@1583 72 bool m_cancelled;
Chris@1583 73 int m_completion;
Chris@1583 74 ProgressReporter *m_reporter;
Chris@1583 75
Chris@1583 76 class DecodeThread : public Thread {
Chris@1583 77 public:
Chris@1583 78 DecodeThread(BQAFileReader *reader) : m_reader(reader) { }
Chris@1583 79 virtual void run();
Chris@1583 80 protected:
Chris@1583 81 BQAFileReader *m_reader;
Chris@1583 82 };
Chris@1583 83 DecodeThread *m_decodeThread;
Chris@1583 84 };
Chris@1583 85
Chris@1583 86 #endif
Chris@1583 87