summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hurst <jhurst@cinecert.com>2023-07-31 07:59:31 -0700
committerJohn Hurst <jhurst@cinecert.com>2023-07-31 07:59:31 -0700
commit017b179b97e034981f803591070b886f3a9e70bb (patch)
tree59b2d2ebb4e4af1275fe784c6c08d9427839ba9f /src
parent765ff525559eb6f7dd0d9e7a899be313775e7b2e (diff)
feat: added DeleteMDObjectByID() to MXF header and footer classes
Diffstat (limited to 'src')
-rwxr-xr-xsrc/MXF.cpp34
-rwxr-xr-xsrc/MXF.h5
2 files changed, 37 insertions, 2 deletions
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
@@ -223,6 +223,22 @@ ASDCP::MXF::Partition::PacketList::GetMDObjectByID(const UUID& ObjectID, Interch
//
ASDCP::Result_t
+ASDCP::MXF::Partition::PacketList::DeleteMDObjectByID(const UUID& ObjectID)
+{
+ std::map<UUID, InterchangeObject*>::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)
{
ASDCP_TEST_NULL(ObjectID);
@@ -885,6 +901,7 @@ 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)
{
@@ -893,6 +910,13 @@ ASDCP::MXF::OP1aHeader::GetMDObjectByID(const UUID& ObjectID, InterchangeObject*
//
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)
{
InterchangeObject* TmpObject;
@@ -1225,6 +1249,7 @@ ASDCP::MXF::OPAtomIndexFooter::Dump(FILE* stream)
(*i)->Dump(stream);
}
+//
ASDCP::Result_t
ASDCP::MXF::OPAtomIndexFooter::GetMDObjectByID(const UUID& ObjectID, InterchangeObject** Object)
{
@@ -1233,6 +1258,13 @@ ASDCP::MXF::OPAtomIndexFooter::GetMDObjectByID(const UUID& ObjectID, Interchange
//
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)
{
InterchangeObject* TmpObject;
diff --git a/src/MXF.h b/src/MXF.h
index d27bc47..8ce77e1 100755
--- a/src/MXF.h
+++ b/src/MXF.h
@@ -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
@@ -130,6 +130,7 @@ namespace ASDCP
~PacketList();
void AddPacket(InterchangeObject* ThePacket); // takes ownership
Result_t GetMDObjectByID(const UUID& ObjectID, InterchangeObject** Object);
+ Result_t DeleteMDObjectByID(const UUID& ObjectID);
Result_t GetMDObjectByType(const byte_t* ObjectID, InterchangeObject** Object);
Result_t GetMDObjectsByType(const byte_t* ObjectID, std::list<InterchangeObject*>& ObjectList);
};
@@ -449,6 +450,7 @@ namespace ASDCP
virtual Result_t WriteToFile(Kumu::FileWriter& Writer, ui32_t HeaderLength = 16384);
virtual void Dump(FILE* = 0);
virtual Result_t GetMDObjectByID(const UUID&, InterchangeObject** = 0);
+ virtual Result_t DeleteMDObjectByID(const UUID& ObjectID);
virtual Result_t GetMDObjectByType(const byte_t*, InterchangeObject** = 0);
virtual Result_t GetMDObjectsByType(const byte_t* ObjectID, std::list<InterchangeObject*>& ObjectList);
Identification* GetIdentification();
@@ -485,6 +487,7 @@ namespace ASDCP
virtual void Dump(FILE* = 0);
virtual Result_t GetMDObjectByID(const UUID&, InterchangeObject** = 0);
+ virtual Result_t DeleteMDObjectByID(const UUID& ObjectID);
virtual Result_t GetMDObjectByType(const byte_t*, InterchangeObject** = 0);
virtual Result_t GetMDObjectsByType(const byte_t* ObjectID, std::list<InterchangeObject*>& ObjectList);