From 017b179b97e034981f803591070b886f3a9e70bb Mon Sep 17 00:00:00 2001 From: John Hurst Date: Mon, 31 Jul 2023 07:59:31 -0700 Subject: feat: added DeleteMDObjectByID() to MXF header and footer classes --- src/MXF.cpp | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/MXF.cpp') diff --git a/src/MXF.cpp b/src/MXF.cpp index c961727..ebb3013 100755 --- a/src/MXF.cpp +++ b/src/MXF.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2005-2021, John Hurst +Copyright (c) 2005-2022, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without @@ -221,6 +221,22 @@ ASDCP::MXF::Partition::PacketList::GetMDObjectByID(const UUID& ObjectID, Interch return RESULT_OK; } +// +ASDCP::Result_t +ASDCP::MXF::Partition::PacketList::DeleteMDObjectByID(const UUID& ObjectID) +{ + std::map::iterator mi = m_Map.find(ObjectID); + + if ( mi == m_Map.end() ) + { + return RESULT_FAIL; + } + + delete (*mi).second; + m_Map.erase(mi); + return RESULT_OK; +} + // ASDCP::Result_t ASDCP::MXF::Partition::PacketList::GetMDObjectByType(const byte_t* ObjectID, InterchangeObject** Object) @@ -885,12 +901,20 @@ ASDCP::MXF::OP1aHeader::InitFromBuffer(const byte_t* p, ui32_t l) return result; } +// ASDCP::Result_t ASDCP::MXF::OP1aHeader::GetMDObjectByID(const UUID& ObjectID, InterchangeObject** Object) { return m_PacketList->GetMDObjectByID(ObjectID, Object); } +// +ASDCP::Result_t +ASDCP::MXF::OP1aHeader::DeleteMDObjectByID(const UUID& ObjectID) +{ + return m_PacketList->DeleteMDObjectByID(ObjectID); +} + // ASDCP::Result_t ASDCP::MXF::OP1aHeader::GetMDObjectByType(const byte_t* ObjectID, InterchangeObject** Object) @@ -1225,12 +1249,20 @@ ASDCP::MXF::OPAtomIndexFooter::Dump(FILE* stream) (*i)->Dump(stream); } +// ASDCP::Result_t ASDCP::MXF::OPAtomIndexFooter::GetMDObjectByID(const UUID& ObjectID, InterchangeObject** Object) { return m_PacketList->GetMDObjectByID(ObjectID, Object); } +// +ASDCP::Result_t +ASDCP::MXF::OPAtomIndexFooter::DeleteMDObjectByID(const UUID& ObjectID) +{ + return m_PacketList->DeleteMDObjectByID(ObjectID); +} + // ASDCP::Result_t ASDCP::MXF::OPAtomIndexFooter::GetMDObjectByType(const byte_t* ObjectID, InterchangeObject** Object) -- cgit v1.2.3