From 26b9971ec350c97c34db54a1ae85473807455837 Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Tue, 11 Jun 2024 01:05:33 +0200 Subject: [PATCH] move find_or_append_child_box() to Box_ipco, because it should only be used for properties (#1175) --- libheif/box.cc | 22 +++++++++++----------- libheif/box.h | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libheif/box.cc b/libheif/box.cc index e10b91945f..1779db120d 100644 --- a/libheif/box.cc +++ b/libheif/box.cc @@ -740,17 +740,6 @@ std::vector> Box::get_child_boxes(uint32_t short_type) cons } -int Box::find_or_append_child_box(const std::shared_ptr& box) -{ - for (int i = 0; i < (int) m_children.size(); i++) { - if (Box::equal(m_children[i], box)) { - return i; - } - } - return append_child_box(box); -} - - bool Box::operator==(const Box& other) const { if (this->get_short_type() != other.get_short_type()) { @@ -1807,6 +1796,17 @@ std::string Box_iprp::dump(Indent& indent) const } +int Box_ipco::find_or_append_child_box(const std::shared_ptr& box) +{ + for (int i = 0; i < (int) m_children.size(); i++) { + if (Box::equal(m_children[i], box)) { + return i; + } + } + return append_child_box(box); +} + + Error Box_ipco::parse(BitstreamRange& range) { //parse_full_box_header(range); diff --git a/libheif/box.h b/libheif/box.h index b0fdf98efe..6e0ae70546 100644 --- a/libheif/box.h +++ b/libheif/box.h @@ -194,8 +194,6 @@ class Box : public BoxHeader return (int) m_children.size() - 1; } - int find_or_append_child_box(const std::shared_ptr& box); - virtual bool operator==(const Box& other) const; static bool equal(const std::shared_ptr& box1, const std::shared_ptr& box2); @@ -543,6 +541,8 @@ class Box_ipco : public Box set_short_type(fourcc("ipco")); } + int find_or_append_child_box(const std::shared_ptr& box); + Error get_properties_for_item_ID(heif_item_id itemID, const std::shared_ptr&, std::vector>& out_properties) const;