5 #ifndef PACKAGER_MEDIA_BASE_BIT_READER_H_
6 #define PACKAGER_MEDIA_BASE_BIT_READER_H_
11 #include <absl/log/check.h>
12 #include <absl/log/log.h>
14 #include <packager/macros/classes.h>
25 BitReader(
const uint8_t* data,
size_t size);
39 DCHECK_LE(num_bits,
sizeof(T) * 8);
41 bool ret = ReadBitsInternal(num_bits, &temp);
42 *out =
static_cast<T
>(temp);
47 bool ReadBits(
size_t num_bits,
bool* out) {
48 DCHECK_EQ(num_bits, 1u);
50 bool ret = ReadBitsInternal(num_bits, &temp);
73 bool condition_read =
true;
76 return condition_read == condition ?
SkipBits(num_bits) :
true;
93 return 8 * bytes_left_ + num_remaining_bits_in_curr_byte_;
104 bool ReadBitsInternal(
size_t num_bits, uint64_t* out);
109 void UpdateCurrByte();
112 const uint8_t* data_;
115 size_t initial_size_;
125 size_t num_remaining_bits_in_curr_byte_;
All the methods that are virtual are virtual for mocking.