/*
-Copyright (c) 2005-2006, John Hurst
+Copyright (c) 2005-2007, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
#include <KM_log.h>
using Kumu::DefaultLogSink;
+// index segments must be < 64K
+// NOTE: this value may too high if advanced index entry elements are used.
+const ui32_t CBRIndexEntriesPerSegment = 5000;
+
//------------------------------------------------------------------------------------------
//
ASDCP::MXF::Partition::AddChildObject(InterchangeObject* Object)
{
assert(Object);
- UUID TmpID;
- Kumu::GenRandomValue(TmpID);
- Object->InstanceUID = TmpID;
+
+ if ( ! Object->InstanceUID.HasValue() )
+ GenRandomValue(Object->InstanceUID);
+
m_PacketList->AddPacket(Object);
}
KLVFilePacket::Dump(stream, false);
fprintf(stream, " MajorVersion = %hu\n", MajorVersion);
fprintf(stream, " MinorVersion = %hu\n", MinorVersion);
- fprintf(stream, " KAGSize = %lu\n", KAGSize);
+ fprintf(stream, " KAGSize = %u\n", KAGSize);
fprintf(stream, " ThisPartition = %s\n", ui64sz(ThisPartition, identbuf));
fprintf(stream, " PreviousPartition = %s\n", ui64sz(PreviousPartition, identbuf));
fprintf(stream, " FooterPartition = %s\n", ui64sz(FooterPartition, identbuf));
fprintf(stream, " HeaderByteCount = %s\n", ui64sz(HeaderByteCount, identbuf));
fprintf(stream, " IndexByteCount = %s\n", ui64sz(IndexByteCount, identbuf));
- fprintf(stream, " IndexSID = %lu\n", IndexSID);
+ fprintf(stream, " IndexSID = %u\n", IndexSID);
fprintf(stream, " BodyOffset = %s\n", ui64sz(BodyOffset, identbuf));
- fprintf(stream, " BodySID = %lu\n", BodySID);
+ fprintf(stream, " BodySID = %u\n", BodySID);
fprintf(stream, " OperationalPattern = %s\n", OperationalPattern.EncodeString(identbuf, IdentBufferLen));
fputs("Essence Containers:\n", stream); EssenceContainers.Dump(stream, false);
stream = stderr;
KLVPacket::Dump(stream, false);
- fprintf(stream, "Primer: %lu %s\n",
+ fprintf(stream, "Primer: %u %s\n",
LocalTagEntryBatch.size(),
( LocalTagEntryBatch.size() == 1 ? "entry" : "entries" ));
InterchangeObject::Dump(stream);
fprintf(stream, " %22s = %s\n", "LastModifiedDate", LastModifiedDate.EncodeString(identbuf, IdentBufferLen));
fprintf(stream, " %22s = %hu\n", "Version", Version);
- fprintf(stream, " %22s = %lu\n", "ObjectModelVersion", ObjectModelVersion);
+ fprintf(stream, " %22s = %u\n", "ObjectModelVersion", ObjectModelVersion);
fprintf(stream, " %22s = %s\n", "PrimaryPackage", PrimaryPackage.EncodeHex(identbuf, IdentBufferLen));
fprintf(stream, " %22s:\n", "Identifications"); Identifications.Dump(stream);
fprintf(stream, " %22s = %s\n", "ContentStorage", ContentStorage.EncodeHex(identbuf, IdentBufferLen));
{
// OP-Atom states that there will be either two or three partitions,
// one closed header and one closed footer with an optional body
- DefaultLogSink().Error("RIP count is not 2 or 3: %lu\n", test_s);
+ DefaultLogSink().Error("RIP count is not 2 or 3: %u\n", test_s);
return RESULT_FORMAT;
}
else
if ( ASDCP_SUCCESS(result) )
{
if ( HeaderByteCount < 1024 )
- DefaultLogSink().Warn("Improbably small HeaderByteCount value: %lu\n", HeaderByteCount);
+ DefaultLogSink().Warn("Improbably small HeaderByteCount value: %u\n", HeaderByteCount);
result = m_Buffer.Capacity(HeaderByteCount);
}
if ( ASDCP_SUCCESS(result) && read_count != m_Buffer.Capacity() )
{
- DefaultLogSink().Error("Short read of OP-Atom header metadata; wanted %lu, got %lu\n",
+ DefaultLogSink().Error("Short read of OP-Atom header metadata; wanted %u, got %u\n",
m_Buffer.Capacity(), read_count);
return RESULT_FAIL;
}
if ( HeaderSize < 4096 )
{
- DefaultLogSink().Error("HeaderSize %lu is too small. Must be >= 4096\n", HeaderSize);
+ DefaultLogSink().Error("HeaderSize %u is too small. Must be >= 4096\n", HeaderSize);
return RESULT_FAIL;
}
if ( pos > (Kumu::fpos_t)HeaderByteCount )
{
char intbuf[IntBufferLen];
- DefaultLogSink().Error("Header size %s exceeds specified value %lu\n",
+ DefaultLogSink().Error("Header size %s exceeds specified value %u\n",
ui64sz(pos, intbuf),
HeaderSize);
return RESULT_FAIL;
if ( ASDCP_SUCCESS(result) && read_count != m_Buffer.Capacity() )
{
- DefaultLogSink().Error("Short read of footer partition: got %lu, expecting %lu\n",
+ DefaultLogSink().Error("Short read of footer partition: got %u, expecting %u\n",
read_count, m_Buffer.Capacity());
return RESULT_FAIL;
}
m_CurrentSegment->IndexEditRate = m_EditRate;
m_CurrentSegment->IndexStartPosition = 0;
}
- else if ( m_CurrentSegment->IndexEntryArray.size() >= 1486 ) // 1486 gets us 16K packets
+ 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;