annotate data/fileio/DecodingWavFileReader.h @ 1598:d2555df635ec bqaudiostream

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