21 #ifndef LIBHEIF_BITSTREAM_H
22 #define LIBHEIF_BITSTREAM_H
24 #if defined(HAVE_CONFIG_H)
60 virtual bool read(
void* data,
size_t size) = 0;
79 bool read(
void* data,
size_t size)
override;
84 std::unique_ptr<std::istream> m_istr;
99 bool read(
void* data,
size_t size)
override;
104 const uint8_t* m_data;
109 uint8_t* m_owned_data =
nullptr;
122 bool read(
void* data,
size_t size)
override {
return !m_func_table->
read(data,size,m_userdata); }
159 if (m_parent_range) {
166 if (m_parent_range) {
168 m_parent_range->skip_without_advancing_file_pos(m_remaining);
171 m_istr->seek_cur(m_remaining);
179 if (m_parent_range) {
187 return m_remaining == 0;
211 std::shared_ptr<StreamReader> m_istr;
213 int m_nesting_level = 0;
216 bool m_error =
false;
219 void skip_without_advancing_file_pos(int64_t nBytes);
239 return data_length - bytes_remaining - nextbits_cnt/8;
264 void write(
const std::vector<uint8_t>&);
277 const std::vector<uint8_t>
get_data()
const {
return m_data; }
280 std::vector<uint8_t> m_data;
281 size_t m_position = 0;
Definition: bitstream.h:225
void skip_bits_fast(int n)
bool get_svlc(int *value)
BitReader(const uint8_t *buffer, int len)
void skip_to_byte_boundary()
bool get_uvlc(int *value)
int get_current_byte_index() const
Definition: bitstream.h:238
Definition: bitstream.h:134
bool eof() const
Definition: bitstream.h:186
void skip_to_end_of_box()
Definition: bitstream.h:164
int get_nesting_level() const
Definition: bitstream.h:206
StreamReader::grow_status wait_for_available_bytes(int64_t nBytes)
void skip_to_end_of_file()
Definition: bitstream.h:154
int64_t get_remaining_bytes() const
Definition: bitstream.h:208
std::shared_ptr< StreamReader > get_istream()
Definition: bitstream.h:204
void set_eof_while_reading()
Definition: bitstream.h:176
BitstreamRange(std::shared_ptr< StreamReader > istr, uint64_t length, BitstreamRange *parent=nullptr)
StreamReader::grow_status wait_until_range_is_available()
Error get_error() const
Definition: bitstream.h:194
bool prepare_read(int64_t nBytes)
std::string read_string()
bool error() const
Definition: bitstream.h:190
static Error Ok
Definition: error.h:87
Definition: bitstream.h:114
StreamReader_CApi(const heif_reader *func_table, void *userdata)
int64_t get_position() const override
Definition: bitstream.h:118
bool seek(int64_t position) override
Definition: bitstream.h:123
StreamReader::grow_status wait_for_file_size(int64_t target_size) override
bool read(void *data, size_t size) override
Definition: bitstream.h:122
Definition: bitstream.h:71
bool seek(int64_t position) override
grow_status wait_for_file_size(int64_t target_size) override
bool read(void *data, size_t size) override
StreamReader_istream(std::unique_ptr< std::istream > &&istr)
int64_t get_position() const override
Definition: bitstream.h:90
grow_status wait_for_file_size(int64_t target_size) override
StreamReader_memory(const uint8_t *data, int64_t size, bool copy)
bool read(void *data, size_t size) override
int64_t get_position() const override
bool seek(int64_t position) override
Definition: bitstream.h:44
grow_status
Definition: bitstream.h:50
@ size_beyond_eof
Definition: bitstream.h:53
@ timeout
Definition: bitstream.h:52
@ size_reached
Definition: bitstream.h:51
bool seek_cur(int64_t position_offset)
Definition: bitstream.h:64
virtual bool read(void *data, size_t size)=0
virtual ~StreamReader()
Definition: bitstream.h:46
virtual bool seek(int64_t position)=0
virtual grow_status wait_for_file_size(int64_t target_size)=0
virtual int64_t get_position() const =0
Definition: bitstream.h:256
size_t data_size() const
Definition: bitstream.h:271
void set_position_to_end()
Definition: bitstream.h:275
void write(const std::string &)
void write(const StreamWriter &)
const std::vector< uint8_t > get_data() const
Definition: bitstream.h:277
void write(const std::vector< uint8_t > &)
void write(int size, uint64_t value)
size_t get_position() const
Definition: bitstream.h:273
void set_position(size_t pos)
Definition: bitstream.h:274
@ heif_suberror_End_of_data
Definition: heif.h:131
@ heif_error_Invalid_input
Definition: heif.h:99
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: bitstream.h:41
int64_t(* get_position)(void *userdata)
Definition: heif.h:360
int(* read)(void *data, size_t size, void *userdata)
Definition: heif.h:364
int(* seek)(int64_t position, void *userdata)
Definition: heif.h:367