annotate data/fileio/CoreAudioFileReader.h @ 665:029dd9e5cc29 coreaudio_tests

tests for using coreaudio to read files in 64-bit mac osx
author luisf
date Thu, 18 Nov 2010 11:40:38 +0000
parents
children c8ab5f63360d
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.
luisf@665 7 This file copyright 2006-2007 Chris Cannam and QMUL.
luisf@665 8
luisf@665 9 Based in part on QTAudioFile.h from SoundBite, copyright 2006
luisf@665 10 Chris Sutton and Mark Levy.
luisf@665 11
luisf@665 12 This program is free software; you can redistribute it and/or
luisf@665 13 modify it under the terms of the GNU General Public License as
luisf@665 14 published by the Free Software Foundation; either version 2 of the
luisf@665 15 License, or (at your option) any later version. See the file
luisf@665 16 COPYING included with this distribution for more information.
luisf@665 17 */
luisf@665 18
luisf@665 19 #ifndef _COREAUDIO_FILE_READER_H_
luisf@665 20 #define _COREAUDIO_FILE_READER_H_
luisf@665 21
luisf@665 22 #ifdef HAVE_COREAUDIO
luisf@665 23
luisf@665 24 #include "CodedAudioFileReader.h"
luisf@665 25
luisf@665 26 #include "base/Thread.h"
luisf@665 27
luisf@665 28 #include <set>
luisf@665 29
luisf@665 30 class ProgressReporter;
luisf@665 31
luisf@665 32 class CoreAudioFileReader : public CodedAudioFileReader
luisf@665 33 {
luisf@665 34 Q_OBJECT
luisf@665 35
luisf@665 36 public:
luisf@665 37 enum DecodeMode {
luisf@665 38 DecodeAtOnce, // decode the file on construction, with progress
luisf@665 39 DecodeThreaded // decode in a background thread after construction
luisf@665 40 };
luisf@665 41
luisf@665 42 CoreAudioFileReader(FileSource source,
luisf@665 43 DecodeMode decodeMode,
luisf@665 44 CacheMode cacheMode,
luisf@665 45 size_t targetRate = 0,
luisf@665 46 ProgressReporter *reporter = 0);
luisf@665 47 virtual ~CoreAudioFileReader();
luisf@665 48
luisf@665 49 virtual QString getError() const { return m_error; }
luisf@665 50 virtual QString getLocation() const { return m_source.getLocation(); }
luisf@665 51 virtual QString getTitle() const { return m_title; }
luisf@665 52
luisf@665 53 static void getSupportedExtensions(std::set<QString> &extensions);
luisf@665 54 static bool supportsExtension(QString ext);
luisf@665 55 static bool supportsContentType(QString type);
luisf@665 56 static bool supports(FileSource &source);
luisf@665 57
luisf@665 58 virtual int getDecodeCompletion() const { return m_completion; }
luisf@665 59
luisf@665 60 virtual bool isUpdating() const {
luisf@665 61 return m_decodeThread && m_decodeThread->isRunning();
luisf@665 62 }
luisf@665 63
luisf@665 64 public slots:
luisf@665 65 void cancelled();
luisf@665 66
luisf@665 67 protected:
luisf@665 68 FileSource m_source;
luisf@665 69 QString m_path;
luisf@665 70 QString m_error;
luisf@665 71 QString m_title;
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;
luisf@665 91 };
luisf@665 92
luisf@665 93 #endif
luisf@665 94
luisf@665 95 #endif