diff options
Diffstat (limited to 'src/Index.cpp')
| -rwxr-xr-x | src/Index.cpp | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/Index.cpp b/src/Index.cpp index f996339..6406e0f 100755 --- a/src/Index.cpp +++ b/src/Index.cpp @@ -79,7 +79,42 @@ ASDCP::MXF::IndexTableSegment::InitFromTLVSet(TLVReader& TLVSet) if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadUi8(OBJ_READ_ARGS(IndexTableSegmentBase, SliceCount)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadUi8(OBJ_READ_ARGS(IndexTableSegmentBase, PosTableCount)); if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS(IndexTableSegment, DeltaEntryArray)); - if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS(IndexTableSegment, IndexEntryArray)); + + if ( ASDCP_SUCCESS(result) ) + { + bool rc = TLVSet.FindTL(m_Dict->Type(MDD_IndexTableSegment_IndexEntryArray)); + + if ( rc ) + { + ui32_t item_count, item_size; + ui32_t const decoder_item_size = IndexEntryArray.ItemSize(); + + if ( TLVSet.ReadUi32BE(&item_count) ) + { + if ( TLVSet.ReadUi32BE(&item_size) ) + { + for ( ui32_t i = 0; i < item_count && rc; ++i ) + { + IndexEntry tmp_item; + rc = tmp_item.Unarchive(&TLVSet); + + if ( rc ) + { + IndexEntryArray.push_back(tmp_item); + + if ( decoder_item_size < item_size ) + { + TLVSet.SkipOffset(item_size - decoder_item_size); + } + } + } + } + } + } + + result = rc ? RESULT_OK : RESULT_FALSE; + } + return result; } @@ -136,7 +171,11 @@ ASDCP::MXF::IndexTableSegment::Dump(FILE* stream) fprintf(stream, " DeltaEntryArray:\n"); DeltaEntryArray.Dump(stream); - if ( IndexEntryArray.size() < 1000 ) + if ( IndexEntryArray.empty() ) + { + fprintf(stream, " IndexEntryArray: NO ENTRIES\n"); + } + else if ( IndexEntryArray.size() < 1000 ) { fprintf(stream, " IndexEntryArray:\n"); IndexEntryArray.Dump(stream); |
