00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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