QuickTimeFileReader.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2006-2007 Chris Cannam and QMUL.
00008 
00009     Based in part on QTAudioFile.h from SoundBite, copyright 2006
00010     Chris Sutton and Mark Levy.
00011     
00012     This program is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU General Public License as
00014     published by the Free Software Foundation; either version 2 of the
00015     License, or (at your option) any later version.  See the file
00016     COPYING included with this distribution for more information.
00017 */
00018 
00019 #ifndef _QUICKTIME_FILE_READER_H_
00020 #define _QUICKTIME_FILE_READER_H_
00021 
00022 #ifdef HAVE_QUICKTIME
00023 
00024 #include "CodedAudioFileReader.h"
00025 
00026 #include "base/Thread.h"
00027 
00028 #include <set>
00029 
00030 class QProgressDialog;
00031 
00032 class QuickTimeFileReader : public CodedAudioFileReader
00033 {
00034 public:
00035     enum DecodeMode {
00036         DecodeAtOnce, // decode the file on construction, with progress dialog
00037         DecodeThreaded // decode in a background thread after construction
00038     };
00039 
00040     QuickTimeFileReader(FileSource source,
00041                         DecodeMode decodeMode,
00042                         CacheMode cacheMode,
00043                         size_t targetRate = 0);
00044     virtual ~QuickTimeFileReader();
00045 
00046     virtual QString getError() const { return m_error; }
00047     virtual QString getLocation() const { return m_source.getLocation(); }
00048     virtual QString getTitle() const { return m_title; }
00049     
00050     static void getSupportedExtensions(std::set<QString> &extensions);
00051     static bool supportsExtension(QString ext);
00052     static bool supportsContentType(QString type);
00053     static bool supports(FileSource &source);
00054 
00055     virtual int getDecodeCompletion() const { return m_completion; }
00056 
00057     virtual bool isUpdating() const {
00058         return m_decodeThread && m_decodeThread->isRunning();
00059     }
00060 
00061 protected:
00062     FileSource m_source;
00063     QString m_path;
00064     QString m_error;
00065     QString m_title;
00066 
00067     class D;
00068     D *m_d;
00069 
00070     QProgressDialog *m_progress;
00071     bool m_cancelled;
00072     int m_completion;
00073 
00074     class DecodeThread : public Thread
00075     {
00076     public:
00077         DecodeThread(QuickTimeFileReader *reader) : m_reader(reader) { }
00078         virtual void run();
00079 
00080     protected:
00081         QuickTimeFileReader *m_reader; 
00082     };
00083 
00084     DecodeThread *m_decodeThread;
00085 };
00086 
00087 #endif
00088 
00089 #endif

Generated on Wed Feb 20 15:45:27 2008 for SonicVisualiser by  doxygen 1.5.1