diff --git a/src/common/ebml.h b/src/common/ebml.h
index 00a53d2c8..1ff0c01eb 100644
--- a/src/common/ebml.h
+++ b/src/common/ebml.h
@@ -203,6 +203,21 @@ GetFirstOrNextChild(EbmlMaster *master,
return nullptr == previous_child ? GetChild(*master) : GetNextChild(*master, *previous_child);
}
+template
+memory_cptr
+find_and_clone_binary(EbmlElement &parent) {
+ auto child = FindChild(static_cast(parent));
+ if (child)
+ return memory_c::clone(child->GetBuffer(), child->GetSize());
+ return memory_cptr{};
+}
+
+template
+memory_cptr
+find_and_clone_binary(EbmlElement *parent) {
+ return find_and_clone_binary(*parent);
+}
+
EbmlElement *empty_ebml_master(EbmlElement *e);
EbmlElement *create_ebml_element(const EbmlCallbacks &callbacks, const EbmlId &id);
EbmlMaster *sort_ebml_master(EbmlMaster *e);
diff --git a/src/common/strings/formatting.h b/src/common/strings/formatting.h
index 857fa239e..97144b7fc 100644
--- a/src/common/strings/formatting.h
+++ b/src/common/strings/formatting.h
@@ -64,6 +64,11 @@ to_hex(const std::string &buf,
bool compact = false) {
return to_hex(reinterpret_cast(buf.c_str()), buf.length(), compact);
}
+inline std::string
+to_hex(memory_cptr const &buf,
+ bool compact = false) {
+ return to_hex(buf->get_buffer(), buf->get_size(), compact);
+}
std::string create_minutes_seconds_time_string(unsigned int seconds, bool omit_minutes_if_zero = false);