annotate data/fileio/MP3FileReader.h @ 282:d9319859a4cf tip

(none)
author benoitrigolleau
date Fri, 31 Oct 2008 11:00:24 +0000
parents fc9323a41f5a
children
rev   line source
lbajardsilogic@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
lbajardsilogic@0 2
lbajardsilogic@0 3 /*
lbajardsilogic@0 4 Sonic Visualiser
lbajardsilogic@0 5 An audio file viewer and annotation editor.
lbajardsilogic@0 6 Centre for Digital Music, Queen Mary, University of London.
lbajardsilogic@0 7 This file copyright 2006 Chris Cannam.
lbajardsilogic@0 8
lbajardsilogic@0 9 This program is free software; you can redistribute it and/or
lbajardsilogic@0 10 modify it under the terms of the GNU General Public License as
lbajardsilogic@0 11 published by the Free Software Foundation; either version 2 of the
lbajardsilogic@0 12 License, or (at your option) any later version. See the file
lbajardsilogic@0 13 COPYING included with this distribution for more information.
lbajardsilogic@0 14 */
lbajardsilogic@0 15
lbajardsilogic@0 16 #ifndef _MP3_FILE_READER_H_
lbajardsilogic@0 17 #define _MP3_FILE_READER_H_
lbajardsilogic@0 18
lbajardsilogic@0 19 #ifdef HAVE_MAD
lbajardsilogic@0 20
lbajardsilogic@0 21 #include "CodedAudioFileReader.h"
lbajardsilogic@0 22
lbajardsilogic@0 23 #include <mad.h>
lbajardsilogic@0 24
lbajardsilogic@0 25 #include <set>
lbajardsilogic@0 26
lbajardsilogic@0 27 class QProgressDialog;
lbajardsilogic@0 28
lbajardsilogic@0 29 class MP3FileReader : public CodedAudioFileReader
lbajardsilogic@0 30 {
lbajardsilogic@0 31 public:
lbajardsilogic@0 32 MP3FileReader(QString path, bool showProgress, CacheMode cacheMode);
lbajardsilogic@0 33 virtual ~MP3FileReader();
lbajardsilogic@0 34
lbajardsilogic@0 35 virtual QString getError() const { return m_error; }
lbajardsilogic@0 36
lbajardsilogic@0 37 static void getSupportedExtensions(std::set<QString> &extensions);
lbajardsilogic@0 38
lbajardsilogic@0 39 protected:
lbajardsilogic@0 40 QString m_path;
lbajardsilogic@0 41 QString m_error;
lbajardsilogic@0 42 size_t m_fileSize;
lbajardsilogic@0 43 double m_bitrateNum;
lbajardsilogic@0 44 size_t m_bitrateDenom;
lbajardsilogic@0 45
lbajardsilogic@0 46 QProgressDialog *m_progress;
lbajardsilogic@0 47 bool m_cancelled;
lbajardsilogic@0 48
lbajardsilogic@0 49 struct DecoderData
lbajardsilogic@0 50 {
lbajardsilogic@0 51 unsigned char const *start;
lbajardsilogic@0 52 unsigned long length;
lbajardsilogic@0 53 MP3FileReader *reader;
lbajardsilogic@0 54 };
lbajardsilogic@0 55
lbajardsilogic@0 56 bool decode(void *mm, size_t sz);
lbajardsilogic@0 57 enum mad_flow accept(struct mad_header const *, struct mad_pcm *);
lbajardsilogic@0 58
lbajardsilogic@0 59 static enum mad_flow input(void *, struct mad_stream *);
lbajardsilogic@0 60 static enum mad_flow output(void *, struct mad_header const *, struct mad_pcm *);
lbajardsilogic@0 61 static enum mad_flow error(void *, struct mad_stream *, struct mad_frame *);
lbajardsilogic@0 62 };
lbajardsilogic@0 63
lbajardsilogic@0 64 #endif
lbajardsilogic@0 65
lbajardsilogic@0 66 #endif