summaryrefslogtreecommitdiff
path: root/src/h__02_Writer.cpp
diff options
context:
space:
mode:
authorPierre-Anthony Lemieux <pal@palemieux.com>2020-08-03 08:20:33 -0700
committerPierre-Anthony Lemieux <pal@palemieux.com>2020-08-03 08:20:33 -0700
commit5842f367d39b9564b29e9127373c9156f57a7ca9 (patch)
tree6817e74e6d7a5a71b252fafdfbf763031d0cfb27 /src/h__02_Writer.cpp
parent474dfebead4e815d5ca374eeccb1c05360b31962 (diff)
Add support for multi-segment index tables to AS_02 write (#52)
Diffstat (limited to 'src/h__02_Writer.cpp')
-rw-r--r--src/h__02_Writer.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/h__02_Writer.cpp b/src/h__02_Writer.cpp
index 9b1c6c6..d7cfaa3 100644
--- a/src/h__02_Writer.cpp
+++ b/src/h__02_Writer.cpp
@@ -161,7 +161,17 @@ AS_02::MXF::AS02IndexWriterVBR::PushIndexEntry(const IndexTableSegment::IndexEnt
m_CurrentSegment->DeltaEntryArray.push_back(IndexTableSegment::DeltaEntry());
m_CurrentSegment->IndexEditRate = m_EditRate;
m_CurrentSegment->IndexStartPosition = 0;
- }
+ } else if (m_CurrentSegment->IndexEntryArray.size() >= CBRIndexEntriesPerSegment) { // no, this one is full, start another
+ m_CurrentSegment->IndexDuration = m_CurrentSegment->IndexEntryArray.size();
+ ui64_t StartPosition = m_CurrentSegment->IndexStartPosition + m_CurrentSegment->IndexDuration;
+
+ m_CurrentSegment = new IndexTableSegment(m_Dict);
+ assert(m_CurrentSegment);
+ AddChildObject(m_CurrentSegment);
+ m_CurrentSegment->DeltaEntryArray.push_back(IndexTableSegment::DeltaEntry());
+ m_CurrentSegment->IndexEditRate = m_EditRate;
+ m_CurrentSegment->IndexStartPosition = StartPosition;
+ }
m_CurrentSegment->IndexEntryArray.push_back(Entry);
}