MpegBitstream.hxx
Go to the documentation of this file.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 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