Skip to content

Commit

Permalink
move find_or_append_child_box() to Box_ipco, because it should only b…
Browse files Browse the repository at this point in the history
…e used for properties (#1175)
  • Loading branch information
farindk committed Jun 10, 2024
1 parent 9966dd2 commit 26b9971
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions libheif/box.cc
Original file line number Diff line number Diff line change
Expand Up @@ -740,17 +740,6 @@ std::vector<std::shared_ptr<Box>> Box::get_child_boxes(uint32_t short_type) cons
}


int Box::find_or_append_child_box(const std::shared_ptr<Box>& 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()) {
Expand Down Expand Up @@ -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>& 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);
Expand Down
4 changes: 2 additions & 2 deletions libheif/box.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>& box);

virtual bool operator==(const Box& other) const;

static bool equal(const std::shared_ptr<Box>& box1, const std::shared_ptr<Box>& box2);
Expand Down Expand Up @@ -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>& box);

Error get_properties_for_item_ID(heif_item_id itemID,
const std::shared_ptr<class Box_ipma>&,
std::vector<std::shared_ptr<Box>>& out_properties) const;
Expand Down

0 comments on commit 26b9971

Please sign in to comment.