annotate data/fileio/QuickTimeFileReader.h @ 308:14e0f60435b8

* Make it possible to drop audio files, layer files, session files and images onto SV panes. Need to do a bit more work on where we expect the dropped file to go, particularly in the case of audio files -- at the moment they're always opened in new panes, but it may be better to by default replace whatever is in the target pane.
author Chris Cannam
date Wed, 10 Oct 2007 15:18:02 +0000
parents c022976d18e8
children 3a6725f285d6
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@281 30 class QProgressDialog;
Chris@281 31
Chris@281 32 class QuickTimeFileReader : public CodedAudioFileReader
Chris@281 33 {
Chris@281 34 public:
Chris@281 35 enum DecodeMode {
Chris@281 36 DecodeAtOnce, // decode the file on construction, with progress dialog
Chris@281 37 DecodeThreaded // decode in a background thread after construction
Chris@281 38 };
Chris@281 39
Chris@297 40 QuickTimeFileReader(QString path,
Chris@297 41 DecodeMode decodeMode,
Chris@297 42 CacheMode cacheMode,
Chris@297 43 size_t targetRate = 0);
Chris@281 44 virtual ~QuickTimeFileReader();
Chris@281 45
Chris@290 46 virtual QString getError() const { return m_error; }
Chris@290 47 virtual QString getTitle() const { return m_title; }
Chris@281 48
Chris@290 49 static void getSupportedExtensions(std::set<QString> &extensions);
Chris@281 50
Chris@281 51 virtual int getDecodeCompletion() const { return m_completion; }
Chris@281 52
Chris@281 53 virtual bool isUpdating() const {
Chris@281 54 return m_decodeThread && m_decodeThread->isRunning();
Chris@281 55 }
Chris@281 56
Chris@281 57 protected:
Chris@290 58 QString m_path;
Chris@290 59 QString m_error;
Chris@290 60 QString m_title;
Chris@281 61
Chris@281 62 class D;
Chris@281 63 D *m_d;
Chris@281 64
Chris@282 65 QProgressDialog *m_progress;
Chris@281 66 bool m_cancelled;
Chris@281 67 int m_completion;
Chris@281 68
Chris@281 69 class DecodeThread : public Thread
Chris@281 70 {
Chris@281 71 public:
Chris@281 72 DecodeThread(QuickTimeFileReader *reader) : m_reader(reader) { }
Chris@281 73 virtual void run();
Chris@281 74
Chris@281 75 protected:
Chris@281 76 QuickTimeFileReader *m_reader;
Chris@281 77 };
Chris@281 78
Chris@281 79 DecodeThread *m_decodeThread;
Chris@281 80 };
Chris@281 81
Chris@281 82 #endif
Chris@281 83
Chris@281 84 #endif