annotate data/fileio/CoreAudioFileReader.h @ 856:8593a3fe50ac tonioni

Merge from branch "tonioni_multi_transform"
author Chris Cannam
date Wed, 04 Dec 2013 18:29:53 +0000
parents c8ab5f63360d
children f3cda3280398 59e7fe1b1003
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,
luisf@665 42 size_t targetRate = 0,
luisf@665 43 ProgressReporter *reporter = 0);
luisf@665 44 virtual ~CoreAudioFileReader();
luisf@665 45
luisf@665 46 virtual QString getError() const { return m_error; }
luisf@665 47 virtual QString getLocation() const { return m_source.getLocation(); }
luisf@665 48 virtual QString getTitle() const { return m_title; }
luisf@665 49
luisf@665 50 static void getSupportedExtensions(std::set<QString> &extensions);
luisf@665 51 static bool supportsExtension(QString ext);
luisf@665 52 static bool supportsContentType(QString type);
luisf@665 53 static bool supports(FileSource &source);
luisf@665 54
luisf@665 55 virtual int getDecodeCompletion() const { return m_completion; }
luisf@665 56
luisf@665 57 virtual bool isUpdating() const {
luisf@665 58 return m_decodeThread && m_decodeThread->isRunning();
luisf@665 59 }
luisf@665 60
luisf@665 61 public slots:
luisf@665 62 void cancelled();
luisf@665 63
luisf@665 64 protected:
luisf@665 65 FileSource m_source;
luisf@665 66 QString m_path;
luisf@665 67 QString m_error;
luisf@665 68 QString m_title;
luisf@665 69
luisf@665 70 class D;
luisf@665 71 D *m_d;
luisf@665 72
luisf@665 73 ProgressReporter *m_reporter;
luisf@665 74 bool m_cancelled;
luisf@665 75 int m_completion;
luisf@665 76
luisf@665 77 class DecodeThread : public Thread
luisf@665 78 {
luisf@665 79 public:
luisf@665 80 // DecodeThread(QuickTimeFileReader *reader) : m_reader(reader) { }
luisf@665 81 virtual void run();
luisf@665 82
luisf@665 83 protected:
luisf@665 84 // QuickTimeFileReader *m_reader;
luisf@665 85 };
luisf@665 86
luisf@665 87 DecodeThread *m_decodeThread;
luisf@665 88 };
luisf@665 89
luisf@665 90 #endif
luisf@665 91
luisf@665 92 #endif