Chris@148: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@148: Chris@148: /* Chris@148: Sonic Visualiser Chris@148: An audio file viewer and annotation editor. Chris@148: Centre for Digital Music, Queen Mary, University of London. Chris@148: This file copyright 2006 Chris Cannam. Chris@148: Chris@148: This program is free software; you can redistribute it and/or Chris@148: modify it under the terms of the GNU General Public License as Chris@148: published by the Free Software Foundation; either version 2 of the Chris@148: License, or (at your option) any later version. See the file Chris@148: COPYING included with this distribution for more information. Chris@148: */ Chris@148: Chris@148: #ifndef _MP3_FILE_READER_H_ Chris@148: #define _MP3_FILE_READER_H_ Chris@148: Chris@148: #ifdef HAVE_MAD Chris@148: Chris@148: #include "CodedAudioFileReader.h" Chris@148: Chris@148: #include Chris@148: Chris@148: class QProgressDialog; Chris@148: Chris@148: class MP3FileReader : public CodedAudioFileReader Chris@148: { Chris@148: public: Chris@148: MP3FileReader(QString path, bool showProgress, CacheMode cacheMode); Chris@148: virtual ~MP3FileReader(); Chris@148: Chris@148: virtual QString getError() const { return m_error; } Chris@148: Chris@148: protected: Chris@148: QString m_path; Chris@148: QString m_error; Chris@148: size_t m_fileSize; Chris@148: double m_bitrateNum; Chris@148: size_t m_bitrateDenom; Chris@148: Chris@148: QProgressDialog *m_progress; Chris@148: bool m_cancelled; Chris@148: Chris@148: struct DecoderData Chris@148: { Chris@148: unsigned char const *start; Chris@148: unsigned long length; Chris@148: MP3FileReader *reader; Chris@148: }; Chris@148: Chris@148: bool decode(void *mm, size_t sz); Chris@148: enum mad_flow accept(struct mad_header const *, struct mad_pcm *); Chris@148: Chris@148: static enum mad_flow input(void *, struct mad_stream *); Chris@148: static enum mad_flow output(void *, struct mad_header const *, struct mad_pcm *); Chris@148: static enum mad_flow error(void *, struct mad_stream *, struct mad_frame *); Chris@148: }; Chris@148: Chris@148: #endif Chris@148: Chris@148: #endif