diff options
| author | jhurst <jhurst@cinecert.com> | 2021-04-13 15:50:50 -0700 |
|---|---|---|
| committer | jhurst <jhurst@cinecert.com> | 2021-04-13 15:50:50 -0700 |
| commit | b14d706a72c706c9c59dbdf64a9e41f32465e060 (patch) | |
| tree | 642c62a644544afb531a8fdbfd4e610bb72728ed /src/Index.cpp | |
| parent | 4e0891ab9ee94b822043126ea07e97641015e9b7 (diff) | |
o Added a Clone() method to InterchangeObject and derivatives
that allows making a descriptor copy that is not owned by
any other strucure. The caller must arrange to delete the
object pointer returned.
o While implementing the above it became obvious that the
reference-to-a-pointer-to-the-dictionary idiom that is used
throughout the lower levels of the MXF library was the
cause of much more grief than it was originally designed to
prevent. This was made even more obvious when I replaced all
of it with simple pointers, which revealed several shadow
instances of m_Dict that were only reliable while the object
that held them was valid.
Diffstat (limited to 'src/Index.cpp')
| -rwxr-xr-x | src/Index.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/Index.cpp b/src/Index.cpp index 6406e0f..0815f25 100755 --- a/src/Index.cpp +++ b/src/Index.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2005-2012, John Hurst +Copyright (c) 2005-2021, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without @@ -34,8 +34,8 @@ const ui32_t kl_length = ASDCP::SMPTE_UL_LENGTH + ASDCP::MXF_BER_LENGTH; // -ASDCP::MXF::IndexTableSegment::IndexTableSegment(const Dictionary*& d) : - InterchangeObject(d), m_Dict(d), RtFileOffset(0), RtEntryOffset(0), +ASDCP::MXF::IndexTableSegment::IndexTableSegment(const Dictionary* d) : + InterchangeObject(d), RtFileOffset(0), RtEntryOffset(0), IndexStartPosition(0), IndexDuration(0), EditUnitByteCount(0), IndexSID(129), BodySID(1), SliceCount(0), PosTableCount(0) { @@ -48,6 +48,13 @@ ASDCP::MXF::IndexTableSegment::~IndexTableSegment() { } +ASDCP::MXF::IndexTableSegment::IndexTableSegment(const IndexTableSegment& rhs) : InterchangeObject(rhs.m_Dict) +{ + assert(m_Dict); + m_UL = m_Dict->ul(MDD_IndexTableSegment); + Copy(rhs); +} + // void ASDCP::MXF::IndexTableSegment::Copy(const IndexTableSegment& rhs) @@ -66,6 +73,13 @@ ASDCP::MXF::IndexTableSegment::Copy(const IndexTableSegment& rhs) } // +ASDCP::MXF::InterchangeObject* +ASDCP::MXF::IndexTableSegment::Clone() const +{ + return new IndexTableSegment(*this); +} + +// ASDCP::Result_t ASDCP::MXF::IndexTableSegment::InitFromTLVSet(TLVReader& TLVSet) { |
