annotate data/fileio/CoreAudioFileReader.h @ 1001:51bf067de517

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