Skip to content

Commit

Permalink
show item property indices in box dump
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Aug 3, 2024
1 parent bba2ebb commit dc2e421
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions libheif/box.cc
Original file line number Diff line number Diff line change
Expand Up @@ -901,11 +901,12 @@ Error Box::write_children(StreamWriter& writer) const
}


std::string Box::dump_children(Indent& indent) const
std::string Box::dump_children(Indent& indent, bool with_index) const
{
std::ostringstream sstr;

bool first = true;
int idx=1;

indent++;
for (const auto& childBox : m_children) {
Expand All @@ -916,6 +917,11 @@ std::string Box::dump_children(Indent& indent) const
sstr << indent << "\n";
}

if (with_index) {
sstr << indent << "index: " << idx << "\n";
idx++;
}

sstr << childBox->dump(indent);
}
indent--;
Expand Down Expand Up @@ -2034,7 +2040,7 @@ std::string Box_ipco::dump(Indent& indent) const
std::ostringstream sstr;
sstr << Box::dump(indent);

sstr << dump_children(indent);
sstr << dump_children(indent, true);

return sstr.str();
}
Expand Down
2 changes: 1 addition & 1 deletion libheif/box.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class Box : public BoxHeader

Error write_children(StreamWriter& writer) const;

std::string dump_children(Indent&) const;
std::string dump_children(Indent&, bool with_index = false) const;


// --- writing
Expand Down

0 comments on commit dc2e421

Please sign in to comment.