summaryrefslogtreecommitdiff
path: root/src/MXF.cpp
diff options
context:
space:
mode:
authorJohn Hurst <jhurst@cinecert.com>2020-10-21 10:50:37 -0700
committerGitHub <noreply@github.com>2020-10-21 10:50:37 -0700
commit8400c964b7852fd5be2b23640bf665cf69d85593 (patch)
treeeb9bfad2d675c910cf4ea75c75d2749fd923b264 /src/MXF.cpp
parentd417531ed59434ecaee487adfdf54646408479bf (diff)
parent6692ed39935bf2a67faefa39d16fcf9cb11431a1 (diff)
Merge pull request #69 from Jason-elkins/check_optional_values_arent_empty
Check optional values arent empty
Diffstat (limited to 'src/MXF.cpp')
-rwxr-xr-xsrc/MXF.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/MXF.cpp b/src/MXF.cpp
index 5cab95e..83954f7 100755
--- a/src/MXF.cpp
+++ b/src/MXF.cpp
@@ -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));
@@ -1231,6 +1231,25 @@ ASDCP::MXF::OPAtomIndexFooter::GetMDObjectsByType(const byte_t* ObjectID, std::l
}
//
+ui64_t
+ASDCP::MXF::OPAtomIndexFooter::ContainerDuration() const
+{
+ ui64_t container_duration = 0;
+ std::list<InterchangeObject*>::iterator li;
+ for ( li = m_PacketList->m_List.begin(); li != m_PacketList->m_List.end(); li++ )
+ {
+ IndexTableSegment *segment = dynamic_cast<IndexTableSegment*>(*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
{