CLAM-Development
1.1
|
00001 /* 00002 * Copyright (c) 2004 MUSIC TECHNOLOGY GROUP (MTG) 00003 * UNIVERSITAT POMPEU FABRA 00004 * 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 00022 #ifndef __MpegBitstream__ 00023 #define __MpegBitstream__ 00024 00025 #if USE_MAD != 1 00026 #error USE_MAD was not set to 1 in your settings.cfg file, but you are including files that require this. Please fix your settings.cfg 00027 #endif 00028 00029 #include <mad.h> 00030 #include <cstdio> 00031 #include "DataTypes.hxx" 00032 00033 namespace CLAM 00034 { 00035 00036 namespace AudioCodecs 00037 { 00038 class MpegBitstream 00039 { 00040 struct mad_stream mBitstream; 00041 struct mad_frame mCurrentFrame; 00042 struct mad_synth mMpegSynth; 00043 mad_timer_t mStreamTimer; 00044 00045 unsigned char* mInputBuffer; 00046 static const int mInputBufferSize; 00047 00048 int mStatus; 00049 bool mFatalError; 00050 int mDecodedFrames; 00051 FILE* mpFile; 00052 00053 public: 00054 MpegBitstream( FILE* bitstream ); 00055 MpegBitstream(); 00056 ~MpegBitstream(); 00057 00058 void Init(); 00059 void Init(FILE*); 00060 TTime Finish(); 00061 bool EOS(); 00062 bool FatalError(); 00063 bool NextFrame(); 00064 bool SynthesizeCurrent(); 00065 struct mad_frame& CurrentFrame(); 00066 struct mad_synth& CurrentSynthesis(); 00067 struct mad_stream& StreamState(); 00068 }; 00069 00070 inline struct mad_stream& MpegBitstream::StreamState() 00071 { 00072 return mBitstream; 00073 } 00074 } 00075 00076 00077 } 00078 00079 00080 #endif // MpegBitstream.hxx 00081