From 2343b3cb21b989766144c7f535b1320027d0b3fc Mon Sep 17 00:00:00 2001 From: jelkins Date: Wed, 7 Oct 2020 14:23:20 -0700 Subject: check values for ObjectModelVersion --- src/MXF.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/MXF.cpp') diff --git a/src/MXF.cpp b/src/MXF.cpp index af406ee..6d7cdd8 100755 --- a/src/MXF.cpp +++ b/src/MXF.cpp @@ -629,7 +629,7 @@ ASDCP::MXF::Preface::InitFromTLVSet(TLVReader& TLVSet) Result_t result = InterchangeObject::InitFromTLVSet(TLVSet); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS(Preface, LastModifiedDate)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadUi16(OBJ_READ_ARGS(Preface, Version)); - if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadUi32(OBJ_READ_ARGS_OPT(Preface, ObjectModelVersion)); + if ( ASDCP_SUCCESS(result) && ! ObjectModelVersion.empty() ) result = TLVSet.ReadUi32(OBJ_READ_ARGS_OPT(Preface, ObjectModelVersion)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(Preface, PrimaryPackage)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS(Preface, Identifications)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS(Preface, ContentStorage)); @@ -656,7 +656,7 @@ ASDCP::MXF::Preface::WriteToTLVSet(TLVWriter& TLVSet) Result_t result = InterchangeObject::WriteToTLVSet(TLVSet); if ( ASDCP_SUCCESS(result) ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS(Preface, LastModifiedDate)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.WriteUi16(OBJ_WRITE_ARGS(Preface, Version)); - if ( ASDCP_SUCCESS(result) ) result = TLVSet.WriteUi32(OBJ_WRITE_ARGS_OPT(Preface, ObjectModelVersion)); + if ( ASDCP_SUCCESS(result) && ! ObjectModelVersion.empty() ) result = TLVSet.WriteUi32(OBJ_WRITE_ARGS_OPT(Preface, ObjectModelVersion)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(Preface, PrimaryPackage)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS(Preface, Identifications)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS(Preface, ContentStorage)); -- cgit v1.2.3 From fa71fce41f9fe79ab27a35461d625931d21f588a Mon Sep 17 00:00:00 2001 From: jelkins Date: Fri, 9 Oct 2020 11:45:53 -0700 Subject: add new function to calculate ContainerDuration from IndexTableSegment --- src/MXF.cpp | 19 +++++++++++++++++++ src/MXF.h | 1 + 2 files changed, 20 insertions(+) (limited to 'src/MXF.cpp') diff --git a/src/MXF.cpp b/src/MXF.cpp index c5cc07e..813ee15 100755 --- a/src/MXF.cpp +++ b/src/MXF.cpp @@ -1230,6 +1230,25 @@ ASDCP::MXF::OPAtomIndexFooter::GetMDObjectsByType(const byte_t* ObjectID, std::l return m_PacketList->GetMDObjectsByType(ObjectID, ObjectList); } +// +ui64_t +ASDCP::MXF::OPAtomIndexFooter::ContainerDuration() const +{ + ui64_t container_duration = 0; + std::list::iterator li; + for ( li = m_PacketList->m_List.begin(); li != m_PacketList->m_List.end(); li++ ) + { + IndexTableSegment *segment = dynamic_cast(*li); + + if ( segment != 0 ) + { + container_duration += segment->IndexDuration; + } + } + + return container_duration; +} + // ASDCP::Result_t ASDCP::MXF::OPAtomIndexFooter::Lookup(ui32_t frame_num, IndexTableSegment::IndexEntry& Entry) const diff --git a/src/MXF.h b/src/MXF.h index d6e201a..ee0be96 100755 --- a/src/MXF.h +++ b/src/MXF.h @@ -486,6 +486,7 @@ namespace ASDCP virtual Result_t GetMDObjectByType(const byte_t*, InterchangeObject** = 0); virtual Result_t GetMDObjectsByType(const byte_t* ObjectID, std::list& ObjectList); + virtual ui64_t ContainerDuration() const; virtual Result_t Lookup(ui32_t frame_num, IndexTableSegment::IndexEntry&) const; virtual void PushIndexEntry(const IndexTableSegment::IndexEntry&); virtual void SetDeltaParams(const IndexTableSegment::DeltaEntry&); -- cgit v1.2.3 From 6692ed39935bf2a67faefa39d16fcf9cb11431a1 Mon Sep 17 00:00:00 2001 From: jelkins Date: Mon, 19 Oct 2020 09:44:04 -0700 Subject: revert an empty() check in MXF.cpp because it tests a destination rather than the source. --- src/MXF.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/MXF.cpp') diff --git a/src/MXF.cpp b/src/MXF.cpp index 813ee15..83954f7 100755 --- a/src/MXF.cpp +++ b/src/MXF.cpp @@ -629,7 +629,7 @@ ASDCP::MXF::Preface::InitFromTLVSet(TLVReader& TLVSet) Result_t result = InterchangeObject::InitFromTLVSet(TLVSet); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS(Preface, LastModifiedDate)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadUi16(OBJ_READ_ARGS(Preface, Version)); - if ( ASDCP_SUCCESS(result) && ! ObjectModelVersion.empty() ) result = TLVSet.ReadUi32(OBJ_READ_ARGS_OPT(Preface, ObjectModelVersion)); + if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadUi32(OBJ_READ_ARGS_OPT(Preface, ObjectModelVersion)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(Preface, PrimaryPackage)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS(Preface, Identifications)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS(Preface, ContentStorage)); -- cgit v1.2.3