void AvidMJPEGTrack::WriteVBEIndexTable(Partition *partition) { KAGFillerWriter kag_filler_writer(partition); partition->markIndexStart(mMXFFile); IndexTableSegment segment; segment.setIndexEditRate(mDescriptorHelper->GetSampleRate()); segment.setIndexSID(mIndexSID); segment.setBodySID(mBodySID); segment.setEditUnitByteCount(0); uint32_t num_index_entries = mIndexSegment.GetSize() / INDEX_ENTRY_SIZE; BMX_ASSERT(num_index_entries >= 1); int64_t index_duration = num_index_entries - 1; mxfUUID uuid; mxf_generate_uuid(&uuid); segment.setInstanceUID(uuid); segment.setIndexStartPosition(0); segment.setIndexDuration(index_duration); segment.writeHeader(mMXFFile, 0, num_index_entries); // Avid ignores the 16-bit llen and uses the number of index entries (uint32) instead segment.writeAvidIndexEntryArrayHeader(mMXFFile, 0, 0, num_index_entries); mMXFFile->write(mIndexSegment.GetBytes(), mIndexSegment.GetSize()); kag_filler_writer.write(mMXFFile); partition->markIndexEnd(mMXFFile); }
void AS02MPEG2LGTrack::WriteVBEIndexTable(Partition *partition) { if (mIndexSegments.empty()) return; partition->markIndexStart(mMXFFile); IndexTableSegment segment; segment.setIndexEditRate(mDescriptorHelper->GetSampleRate()); segment.setIndexSID(mIndexSID); segment.setBodySID(mBodySID); segment.setEditUnitByteCount(0); int64_t index_start_position = mIndexStartPosition; uint32_t index_duration; mxfUUID uuid; size_t i; for (i = 0; i < mIndexSegments.size(); i++) { index_duration = mIndexSegments[i]->GetSize() / INDEX_ENTRY_SIZE; mxf_generate_uuid(&uuid); segment.setInstanceUID(uuid); segment.setIndexStartPosition(index_start_position); segment.setIndexDuration(index_duration); segment.writeHeader(mMXFFile, 1, index_duration); segment.writeDeltaEntryArrayHeader(mMXFFile, 1); segment.writeDeltaEntry(mMXFFile, -1, 0, 0); segment.writeIndexEntryArrayHeader(mMXFFile, 0, 0, index_duration); mMXFFile->write(mIndexSegments[i]->GetBytes(), mIndexSegments[i]->GetSize()); delete mIndexSegments[i]; index_start_position += index_duration; } mIndexSegments.clear(); mIndexStartPosition = index_start_position; partition->fillToKag(mMXFFile); partition->markIndexEnd(mMXFFile); }