////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------//
//   bits header                                                              //
//----------------------------------------------------------------------------//
////////////////////////////////////////////////////////////////////////////////
#include <stdio.h>

namespace Mpeg2
{

class Bits
{
  const unsigned int BufferSize;

public:
   Bits ( );
  ~Bits ( );

  bool   initGetbits     ( char * );
  void   finishGetbits   ( );

  unsigned int get1Bit   ( );
  unsigned int getBits   ( int );
  unsigned int lookAhead ( int );
  double bitCount        ( );
  int    endBitStream    ( );
  int    seekSync        ( unsigned int, int );

protected:
  bool refillBuffer      ( );
  void debugOut          ( const char *, ... );

private:
  unsigned char *m_pBuffer;
  int            m_iByteIdx;
  int            m_iBitIdx;
  int            m_iBufferCount;
  double         m_fTotalBits;
  bool           m_bEndOfBitStream;
  FILE          *m_pFile;
};
//#define strlwr(x)

}; // ENd of Namespace Mpeg2

