5 #ifndef PACKAGER_MEDIA_BASE_BIT_READER_H_ 6 #define PACKAGER_MEDIA_BASE_BIT_READER_H_ 11 #include "packager/base/logging.h" 22 BitReader(
const uint8_t* data,
size_t size);
36 DCHECK_LE(num_bits,
sizeof(T) * 8);
38 bool ret = ReadBitsInternal(num_bits, &temp);
39 *out =
static_cast<T
>(temp);
44 bool ReadBits(
size_t num_bits,
bool* out) {
45 DCHECK_EQ(num_bits, 1u);
47 bool ret = ReadBitsInternal(num_bits, &temp);
70 bool condition_read =
true;
73 return condition_read == condition ?
SkipBits(num_bits) :
true;
90 return 8 * bytes_left_ + num_remaining_bits_in_curr_byte_;
98 bool ReadBitsInternal(
size_t num_bits, uint64_t* out);
103 void UpdateCurrByte();
106 const uint8_t* data_;
109 size_t initial_size_;
119 size_t num_remaining_bits_in_curr_byte_;
128 #endif // PACKAGER_MEDIA_BASE_BIT_READER_H_
All the methods that are virtual are virtual for mocking.