VideoCodec/Decoder/BinaryStreamReader.h
#ifndef BINARYSTREAMREADER_H_
#define BINARYSTREAMREADER_H_
#include "../Logger.h"
#include "../Modules/Input/StreamInputModule.h"
// The size of the reading buffer in number of short ints.
#define STREAM_READ_BUFFER_SIZE 1048576
namespace VideoCodec
{
class BinaryStreamReader
{
public:
BinaryStreamReader(StreamInputModule* streamInput);
virtual ~BinaryStreamReader();
void OpenFile(std::string fileName);
void CloseFile();
void AdvanceReader(unsigned char bitCount);
void AlignReader();
unsigned short int GetBits(unsigned char bitCount);
bool MatchBits(unsigned char bitCount, unsigned short int pattern);
private:
unsigned long int readBufferPosition;
unsigned short int* bufferStart;
unsigned short int* readBuffer;
StreamInputModule* inputStream;
};
}
#endif /*BINARYSTREAMREADER_H_*/