annotate data/fileio/CoreAudioFileReader.h @ 1026:01a90c025eaa coreaudio-metadata

Pending
author Chris Cannam
date Mon, 09 Feb 2015 10:27:21 +0000
parents d03b3d956358
children
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; }
Chris@1026 50 virtual QString getMaker() const { return m_maker; }
luisf@665 51
luisf@665 52 static void getSupportedExtensions(std::set<QString> &extensions);
luisf@665 53 static bool supportsExtension(QString ext);
luisf@665 54 static bool supportsContentType(QString type);
luisf@665 55 static bool supports(FileSource &source);
luisf@665 56
luisf@665 57 virtual int getDecodeCompletion() const { return m_completion; }
luisf@665 58
luisf@665 59 virtual bool isUpdating() const {
luisf@665 60 return m_decodeThread && m_decodeThread->isRunning();
luisf@665 61 }
luisf@665 62
luisf@665 63 public slots:
luisf@665 64 void cancelled();
luisf@665 65
luisf@665 66 protected:
luisf@665 67 FileSource m_source;
luisf@665 68 QString m_path;
luisf@665 69 QString m_error;
luisf@665 70 QString m_title;
Chris@1026 71 QString m_maker;
luisf@665 72
luisf@665 73 class D;
luisf@665 74 D *m_d;
luisf@665 75
luisf@665 76 ProgressReporter *m_reporter;
luisf@665 77 bool m_cancelled;
luisf@665 78 int m_completion;
luisf@665 79
luisf@665 80 class DecodeThread : public Thread
luisf@665 81 {
luisf@665 82 public:
luisf@665 83 // DecodeThread(QuickTimeFileReader *reader) : m_reader(reader) { }
luisf@665 84 virtual void run();
luisf@665 85
luisf@665 86 protected:
luisf@665 87 // QuickTimeFileReader *m_reader;
luisf@665 88 };
luisf@665 89
luisf@665 90 DecodeThread *m_decodeThread;
Chris@1026 91
Chris@1026 92 void readMetadata();
luisf@665 93 };
luisf@665 94
luisf@665 95 #endif
luisf@665 96
luisf@665 97 #endif