MpegBitstream.hxx

Go to the documentation of this file.
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                 unsigned long      mBufferFileOffset; 
00048 
00049                 bool               mFatalError;
00050                 FILE*              mpFile;
00051 
00052         public:
00053                 MpegBitstream();
00054                 ~MpegBitstream();
00055 
00056                 void   Init();
00057                 void   Init(FILE*);
00058                 TTime  Finish();
00059                 bool   EOS();
00060                 bool   FatalError();
00061                 bool   NextFrame();
00062                 void   SynthesizeCurrent();
00063                 bool   EnsureEnoughBufferData();
00064                 unsigned long CurrentFrameFileOffset() const;
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 
Generated by  doxygen 1.6.3