-
Notifications
You must be signed in to change notification settings - Fork 0
/
BitStream.h
43 lines (32 loc) · 819 Bytes
/
BitStream.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cstring>
class BitStream;
typedef void (*stream_load_callback)(BitStream* self, void *data);
class BitStream {
public:
BitStream(FILE*);
BitStream(BitStream*);
void load_data();
int consume(uint8_t);
bool has_remaining(int);
void next_start_code();
void align();
int skip_bytes_while(int);
void skip(size_t);
bool no_start_code();
int peek(uint8_t);
BitStream* parent_stream;
stream_load_callback load_callback {nullptr};
void* load_callback_data {nullptr};
FILE *fp {nullptr};
size_t bit_index {0};
size_t total_read {0};
size_t size {0};
size_t capacity {0};
int start_code {0};
int type {0};
bool has_ended {false};
uint8_t *data {nullptr};
};