00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef BITSTREAMER_INCLUDED
00030 #define BITSTREAMER_INCLUDED
00031
00032 #include "../util/gltypes.h"
00033 #include "SDL_rwops.h"
00034
00035
00036 class GlBitStream
00037 {
00038 public:
00039 static int BitsNeeded( U32 maxValue );
00040
00041 };
00042
00043 class GlWriteBitStream : public GlBitStream
00044 {
00045 public:
00046 GlWriteBitStream( SDL_RWops* fp );
00047 ~GlWriteBitStream();
00048
00049 void WriteBits( U32 data, int nBitsInData );
00050 void Flush();
00051
00052 private:
00053 SDL_RWops* fp;
00054
00055 U8 accum;
00056 int bitsLeft;
00057 };
00058
00059
00060 class GlReadBitStream : public GlBitStream
00061 {
00062 public:
00063 GlReadBitStream( SDL_RWops* fp );
00064 ~GlReadBitStream() {}
00065
00066 U32 ReadBits( int nBitsInData );
00067 void Flush();
00068
00069 private:
00070 SDL_RWops* fp;
00071 int bitsLeft;
00072 U8 accum;
00073 };
00074
00075 #endif