24 #if defined(HAVE_CONFIG_H)
43 #if !defined(__EMSCRIPTEN__) && !defined(_MSC_VER)
45 #define HAS_BOOL_ARRAY 1
50 #define fourcc(id) (((uint32_t)(id[0])<<24) | (id[1]<<16) | (id[2]<<8) | (id[3]))
133 uint32_t m_header_size = 0;
136 std::vector<uint8_t> m_uuid_type;
139 bool m_is_full_box =
false;
141 uint8_t m_version = 0;
142 uint32_t m_flags = 0;
210 uint32_t m_major_brand = 0;
211 uint32_t m_minor_version = 0;
212 std::vector<uint32_t> m_compatible_brands;
245 uint32_t m_pre_defined = 0;
246 uint32_t m_handler_type =
fourcc(
"pict");
247 uint32_t m_reserved[3] = {0, };
299 const std::vector<Item>&
get_items()
const {
return m_items; }
302 std::shared_ptr<StreamReader> istr,
303 const std::shared_ptr<class Box_idat>&,
304 std::vector<uint8_t>* dest)
const;
310 const std::vector<uint8_t>& data,
311 uint8_t construction_method=0);
333 std::vector<Item> m_items;
335 mutable size_t m_iloc_box_start = 0;
336 uint8_t m_user_defined_min_version = 0;
337 uint8_t m_offset_size = 0;
338 uint8_t m_length_size = 0;
339 uint8_t m_base_offset_size = 0;
340 uint8_t m_index_size = 0;
380 uint16_t m_item_protection_index = 0;
382 std::string m_item_type;
383 std::string m_item_name;
384 std::string m_content_type;
385 std::string m_content_encoding;
386 std::string m_item_uri_type;
389 bool m_hidden_item =
false;
434 const std::shared_ptr<class Box_ipma>&,
435 std::vector<Property>& out_properties)
const;
438 const std::shared_ptr<class Box_ipma>&,
439 uint32_t property_box_type)
const;
457 m_image_width = width;
458 m_image_height = height;
469 uint32_t m_image_width = 0;
470 uint32_t m_image_height = 0;
524 std::string m_aux_type;
525 std::vector<uint8_t> m_aux_subtypes;
621 std::vector<Reference> m_references;
673 uint8_t m_array_completeness;
674 uint8_t m_NAL_unit_type;
676 std::vector< std::vector<uint8_t> > m_nal_units;
679 configuration m_configuration;
680 uint8_t m_length_size = 4;
682 std::vector<NalArray> m_nal_array;
693 uint64_t start, uint64_t length,
694 std::vector<uint8_t>& out_data)
const;
772 std::vector<uint8_t> m_bits_per_channel;
789 : m_type(type), m_data(data) { }
791 uint32_t
get_type()
const override {
return m_type; }
793 std::vector<uint8_t>
get_data()
const {
return m_data; }
801 std::vector<uint8_t> m_data;
828 uint16_t m_colour_primaries = 0;
829 uint16_t m_transfer_characteristics = 0;
830 uint16_t m_matrix_coefficients = 0;
831 bool m_full_range_flag =
true;
853 std::shared_ptr<const color_profile> m_color_profile;
#define fourcc(id)
Definition: box.h:50
Definition: bitstream.h:134
Error write(StreamWriter &writer) const override
Error parse(BitstreamRange &range) override
std::string get_aux_type() const
Definition: box.h:512
std::string dump(Indent &) const override
void set_aux_type(std::string type)
Definition: box.h:513
Box_auxC()
Definition: box.h:509
std::vector< uint8_t > get_subtypes() const
Definition: box.h:515
Box_auxC(const BoxHeader &hdr)
Definition: box.h:510
int bottom_rounded(int image_height) const
int right_rounded(int image_width) const
int left_rounded(int image_width) const
Box_clap(const BoxHeader &hdr)
Definition: box.h:568
std::string dump(Indent &) const override
int top_rounded(int image_height) const
int get_height_rounded() const
int get_width_rounded() const
Error parse(BitstreamRange &range) override
Box_colr(const BoxHeader &hdr)
Definition: box.h:838
Error write(StreamWriter &writer) const override
std::shared_ptr< const color_profile > get_color_profile() const
Definition: box.h:843
void set_color_profile(std::shared_ptr< const color_profile > prof)
Definition: box.h:844
Error parse(BitstreamRange &range) override
uint32_t get_color_profile_type() const
Definition: box.h:841
Box_colr()
Definition: box.h:837
std::string dump(Indent &) const override
Error parse(BitstreamRange &range) override
std::string dump(Indent &) const override
Box_dinf(const BoxHeader &hdr)
Definition: box.h:725
std::string dump(Indent &) const override
Error parse(BitstreamRange &range) override
Box_dref(const BoxHeader &hdr)
Definition: box.h:736
Error parse(BitstreamRange &range) override
Error write(StreamWriter &writer) const override
void add_compatible_brand(uint32_t brand)
void set_minor_version(uint32_t minor_version)
Definition: box.h:199
void clear_compatible_brands()
Definition: box.h:201
void set_major_brand(uint32_t major_brand)
Definition: box.h:198
std::string dump(Indent &) const override
bool has_compatible_brand(uint32_t brand) const
Box_ftyp(const BoxHeader &hdr)
Definition: box.h:191
Box_ftyp()
Definition: box.h:190
std::string dump(Indent &) const override
Error parse(BitstreamRange &range) override
Box_grpl(const BoxHeader &hdr)
Definition: box.h:705
std::vector< EntityGroup > m_entity_groups
Definition: box.h:719
uint32_t get_handler_type() const
Definition: box.h:235
Box_hdlr(const BoxHeader &hdr)
Definition: box.h:231
Error parse(BitstreamRange &range) override
std::string dump(Indent &) const override
Box_hdlr()
Definition: box.h:230
Error write(StreamWriter &writer) const override
void set_handler_type(uint32_t handler)
Definition: box.h:237
Error write(StreamWriter &writer) const override
std::string dump(Indent &) const override
Box_hvcC()
Definition: box.h:627
Box_hvcC(const BoxHeader &hdr)
Definition: box.h:628
void append_nal_data(const std::vector< uint8_t > &nal)
bool get_headers(std::vector< uint8_t > *dest) const
void append_nal_data(const uint8_t *data, size_t size)
void set_configuration(const configuration &config)
Definition: box.h:659
configuration get_configuration() const
Definition: box.h:661
Error parse(BitstreamRange &range) override
Box_idat(const BoxHeader &hdr)
Definition: box.h:688
Error read_data(std::shared_ptr< StreamReader > istr, uint64_t start, uint64_t length, std::vector< uint8_t > &out_data) const
std::streampos m_data_start_pos
Definition: box.h:699
Error parse(BitstreamRange &range) override
std::string dump(Indent &) const override
Box_iinf(const BoxHeader &hdr)
Definition: box.h:396
Error write(StreamWriter &writer) const override
Error parse(BitstreamRange &range) override
std::string dump(Indent &) const override
void derive_box_version() override
Box_iinf()
Definition: box.h:395
const std::vector< Item > & get_items() const
Definition: box.h:299
Error write_mdat_after_iloc(StreamWriter &writer)
std::string dump(Indent &) const override
Error parse(BitstreamRange &range) override
void derive_box_version() override
Error write(StreamWriter &writer) const override
Error append_data(heif_item_id item_ID, const std::vector< uint8_t > &data, uint8_t construction_method=0)
Error read_data(const Item &item, std::shared_ptr< StreamReader > istr, const std::shared_ptr< class Box_idat > &, std::vector< uint8_t > *dest) const
Box_iloc(const BoxHeader &hdr)
Definition: box.h:278
Box_iloc()
Definition: box.h:277
void set_min_version(uint8_t min_version)
Definition: box.h:306
Error parse(BitstreamRange &range) override
MirrorAxis
Definition: box.h:549
Box_imir(const BoxHeader &hdr)
Definition: box.h:547
std::string dump(Indent &) const override
MirrorAxis get_mirror_axis() const
Definition: box.h:554
bool is_hidden_item() const
Definition: box.h:353
void set_hidden_item(bool hidden)
void derive_box_version() override
Box_infe(const BoxHeader &hdr)
Definition: box.h:349
std::string dump(Indent &) const override
Error parse(BitstreamRange &range) override
Error write(StreamWriter &writer) const override
std::string get_content_type() const
Definition: box.h:367
Box_infe()
Definition: box.h:348
void set_item_ID(heif_item_id id)
Definition: box.h:359
heif_item_id get_item_ID() const
Definition: box.h:357
std::string get_item_type() const
Definition: box.h:361
void set_item_name(std::string name)
Definition: box.h:365
void set_item_type(std::string type)
Definition: box.h:363
void set_content_type(std::string content_type)
Definition: box.h:369
std::string dump(Indent &) const override
Error get_properties_for_item_ID(heif_item_id itemID, const std::shared_ptr< class Box_ipma > &, std::vector< Property > &out_properties) const
Box_ipco(const BoxHeader &hdr)
Definition: box.h:426
Error parse(BitstreamRange &range) override
Box_ipco()
Definition: box.h:425
std::shared_ptr< Box > get_property_for_item_ID(heif_item_id itemID, const std::shared_ptr< class Box_ipma > &, uint32_t property_box_type) const
Box_ipma(const BoxHeader &hdr)
Definition: box.h:477
Box_ipma()
Definition: box.h:476
const std::vector< PropertyAssociation > * get_properties_for_item_ID(heif_item_id itemID) const
Error parse(BitstreamRange &range) override
void derive_box_version() override
std::string dump(Indent &) const override
std::vector< Entry > m_entries
Definition: box.h:503
void add_property_for_item_ID(heif_item_id itemID, PropertyAssociation assoc)
Error write(StreamWriter &writer) const override
Box_iprp(const BoxHeader &hdr)
Definition: box.h:414
std::string dump(Indent &) const override
Box_iprp()
Definition: box.h:413
Error parse(BitstreamRange &range) override
Box_iref()
Definition: box.h:593
void add_reference(heif_item_id from_id, uint32_t type, std::vector< heif_item_id > to_ids)
bool has_references(heif_item_id itemID) const
Error write(StreamWriter &writer) const override
Error parse(BitstreamRange &range) override
std::vector< Reference > get_references_from(heif_item_id itemID) const
std::string dump(Indent &) const override
Box_iref(const BoxHeader &hdr)
Definition: box.h:594
std::vector< heif_item_id > get_references(heif_item_id itemID, uint32_t ref_type) const
void derive_box_version() override
Error parse(BitstreamRange &range) override
int get_rotation() const
Definition: box.h:535
Box_irot(const BoxHeader &hdr)
Definition: box.h:531
std::string dump(Indent &) const override
std::string dump(Indent &) const override
Box_ispe(const BoxHeader &hdr)
Definition: box.h:451
uint32_t get_height() const
Definition: box.h:454
uint32_t get_width() const
Definition: box.h:453
Box_ispe()
Definition: box.h:450
Error parse(BitstreamRange &range) override
Error write(StreamWriter &writer) const override
void set_size(uint32_t width, uint32_t height)
Definition: box.h:456
std::string dump(Indent &) const override
Box_pitm()
Definition: box.h:254
void set_item_ID(heif_item_id id)
Definition: box.h:261
Error parse(BitstreamRange &range) override
Box_pitm(const BoxHeader &hdr)
Definition: box.h:255
Error write(StreamWriter &writer) const override
void derive_box_version() override
heif_item_id get_item_ID() const
Definition: box.h:259
int get_num_channels() const
Definition: box.h:762
Error write(StreamWriter &writer) const override
std::string dump(Indent &) const override
int get_bits_per_channel(int channel) const
Definition: box.h:764
Box_pixi(const BoxHeader &hdr)
Definition: box.h:760
Box_pixi()
Definition: box.h:759
Error parse(BitstreamRange &range) override
std::string m_location
Definition: box.h:754
Error parse(BitstreamRange &range) override
Box_url(const BoxHeader &hdr)
Definition: box.h:747
std::string dump(Indent &) const override
virtual Error write(StreamWriter &writer) const
static Error read(BitstreamRange &range, std::shared_ptr< heif::Box > *box)
static const int READ_CHILDREN_ALL
Definition: box.h:178
virtual std::string dump(Indent &) const
const std::vector< std::shared_ptr< Box > > & get_all_child_boxes() const
Definition: box.h:166
Box(const BoxHeader &hdr)
Definition: box.h:150
std::string dump_children(Indent &) const
std::shared_ptr< Box > get_child_box(uint32_t short_type) const
int append_child_box(std::shared_ptr< Box > box)
Definition: box.h:168
virtual void derive_box_version()
Definition: box.h:157
Error write_children(StreamWriter &writer) const
void derive_box_version_recursive()
std::vector< std::shared_ptr< Box > > m_children
Definition: box.h:176
std::vector< std::shared_ptr< Box > > get_child_boxes(uint32_t short_type) const
virtual Error parse(BitstreamRange &range)
Error read_children(BitstreamRange &range, int number=READ_CHILDREN_ALL)
Box()
Definition: box.h:149
int32_t denominator
Definition: box.h:80
Fraction operator+(const Fraction &) const
Fraction()
Definition: box.h:65
Fraction operator/(int) const
Fraction operator-(int) const
int32_t round_down() const
Fraction(int32_t num, int32_t den)
int32_t numerator
Definition: box.h:79
Fraction operator-(const Fraction &) const
Definition: bitstream.h:256
uint16_t get_transfer_characteristics() const
Definition: box.h:818
uint32_t get_type() const override
Definition: box.h:810
void set_colour_primaries(uint16_t primaries)
Definition: box.h:822
std::string dump(Indent &) const override
void set_full_range_flag(bool full_range)
Definition: box.h:825
uint16_t get_colour_primaries() const
Definition: box.h:817
color_profile_nclx()
Definition: box.h:808
Error write(StreamWriter &writer) const override
void set_transfer_characteristics(uint16_t characteristics)
Definition: box.h:823
bool get_full_range_flag() const
Definition: box.h:820
Error parse(BitstreamRange &range)
void set_matrix_coefficients(uint16_t coefficients)
Definition: box.h:824
uint16_t get_matrix_coefficients() const
Definition: box.h:819
color_profile_raw(uint32_t type, std::vector< uint8_t > data)
Definition: box.h:788
std::vector< uint8_t > get_data() const
Definition: box.h:793
std::string dump(Indent &) const override
uint32_t get_type() const override
Definition: box.h:791
Error write(StreamWriter &writer) const override
virtual uint32_t get_type() const =0
virtual std::string dump(Indent &) const =0
virtual ~color_profile()
Definition: box.h:779
virtual Error write(StreamWriter &writer) const =0
uint32_t heif_item_id
Definition: heif.h:276
Definition: bitstream.h:41
std::vector< heif_item_id > entity_ids
Definition: box.h:716
uint32_t group_id
Definition: box.h:714
BoxHeader header
Definition: box.h:713
bool general_tier_flag
Definition: box.h:633
uint32_t general_profile_compatibility_flags
Definition: box.h:635
uint8_t bit_depth_chroma
Definition: box.h:646
std::bitset< NUM_CONSTRAINT_INDICATOR_FLAGS > general_constraint_indicator_flags
Definition: box.h:638
uint8_t chroma_format
Definition: box.h:644
uint8_t temporal_id_nested
Definition: box.h:651
uint8_t parallelism_type
Definition: box.h:643
uint8_t configuration_version
Definition: box.h:631
uint16_t min_spatial_segmentation_idc
Definition: box.h:642
uint8_t general_profile_idc
Definition: box.h:634
uint8_t general_profile_space
Definition: box.h:632
uint8_t constant_frame_rate
Definition: box.h:649
uint8_t general_level_idc
Definition: box.h:640
uint8_t bit_depth_luma
Definition: box.h:645
uint8_t num_temporal_layers
Definition: box.h:650
uint16_t avg_frame_rate
Definition: box.h:647
static const int NUM_CONSTRAINT_INDICATOR_FLAGS
Definition: box.h:637
std::vector< uint8_t > data
Definition: box.h:287
uint64_t offset
Definition: box.h:284
uint64_t index
Definition: box.h:283
uint64_t length
Definition: box.h:285
uint16_t data_reference_index
Definition: box.h:293
heif_item_id item_ID
Definition: box.h:291
uint64_t base_offset
Definition: box.h:294
uint8_t construction_method
Definition: box.h:292
std::vector< Extent > extents
Definition: box.h:296
bool essential
Definition: box.h:429
std::shared_ptr< Box > property
Definition: box.h:430
std::vector< PropertyAssociation > associations
Definition: box.h:500
heif_item_id item_ID
Definition: box.h:499
uint16_t property_index
Definition: box.h:483
bool essential
Definition: box.h:482
std::vector< heif_item_id > to_item_ID
Definition: box.h:600
heif_item_id from_item_ID
Definition: box.h:599
BoxHeader header
Definition: box.h:597