Exemple #1
0
void RDD9IndexTable::WriteVBESegments(File *mxf_file, vector<RDD9IndexTableSegment*> &segments)
{
    size_t i;
    for (i = 0; i < segments.size(); i++) {
        IndexTableSegment *segment = segments[i]->GetSegment();
        ByteArray *entries = segments[i]->GetEntries();

        mxfUUID uuid;
        mxf_generate_uuid(&uuid);
        segment->setInstanceUID(uuid);

        // Note: RDD9 states that PosTableCount is not encoded but mxf_write_index_table_segment will write it with
        //       the default value 0
        segment->writeHeader(mxf_file, (uint32_t)mDeltaEntries.size(), (uint32_t)segment->getIndexDuration());

        if (!mDeltaEntries.empty()) {
            segment->writeDeltaEntryArrayHeader(mxf_file, (uint32_t)mDeltaEntries.size());
            size_t j;
            for (j = 0; j < mDeltaEntries.size(); j++) {
                segment->writeDeltaEntry(mxf_file, mDeltaEntries[j].pos_table_index, mDeltaEntries[j].slice,
                                         mDeltaEntries[j].element_delta);
            }
        }

        segment->writeIndexEntryArrayHeader(mxf_file, mSliceCount, 0, (uint32_t)segment->getIndexDuration());
        mxf_file->write(entries->GetBytes(), entries->GetSize());
    }
}
Exemple #2
0
void OP1AIndexTable::WriteVBESegments(File *mxf_file)
{
    BMX_ASSERT(mInputDuration < 0);
    size_t i;
    for (i = 0; i < mIndexSegments.size(); i++) {
        IndexTableSegment *segment = mIndexSegments[i]->GetSegment();
        ByteArray *entries = mIndexSegments[i]->GetEntries();

        segment->writeHeader(mxf_file, (uint32_t)mDeltaEntries.size(), (uint32_t)segment->getIndexDuration());

        if (!mDeltaEntries.empty()) {
            segment->writeDeltaEntryArrayHeader(mxf_file, (uint32_t)mDeltaEntries.size());
            size_t j;
            for (j = 0; j < mDeltaEntries.size(); j++) {
                segment->writeDeltaEntry(mxf_file, mDeltaEntries[j].pos_table_index, mDeltaEntries[j].slice,
                                         mDeltaEntries[j].element_delta);
            }
        }

        segment->writeIndexEntryArrayHeader(mxf_file, mSliceCount, 0, (uint32_t)segment->getIndexDuration());
        mxf_file->write(entries->GetBytes(), entries->GetSize());

        delete mIndexSegments[i];
    }

    mIndexSegments.clear();
}
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);
}