annotate data/fileio/QuickTimeFileReader.h @ 1002:c2316a3bbb81

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