in src/main/java/com/netflix/imflibrary/st0377/PartitionPack.java [189:280]
public PartitionPack(ByteProvider byteProvider, Long byteOffset, boolean checkForSucceedingKLVFillItem, @Nullable IMFErrorLogger imfErrorLogger)
throws IOException
{
this.header = new KLVPacket.Header(byteProvider, byteOffset);
validateHeaderKey();
this.partitionPackType = PartitionPackType.getPartitionPackTypeKey(this.header.getSetOrPackKindKey());
MXFPropertyPopulator.populateField(byteProvider, this, "major_version");
MXFPropertyPopulator.populateField(byteProvider, this, "minor_version");
MXFPropertyPopulator.populateField(byteProvider, this, "KAG_size");
MXFPropertyPopulator.populateField(byteProvider, this, "this_partition");
if (this.this_partition < 0)
{
String errorMessage = String.format("Value of this_partition = %d(0x%x) which is outside the supported range 0-0x%x",
this.this_partition, this.this_partition, Long.MAX_VALUE);
handleError(imfErrorLogger, errorMessage);
}
MXFPropertyPopulator.populateField(byteProvider, this, "previous_partition");
if (this.previous_partition < 0)
{
String errorMessage = String.format("Value of previous_partition = %d(0x%x) which is outside the supported range 0-0x%x",
this.previous_partition, this.previous_partition, Long.MAX_VALUE);
handleError(imfErrorLogger, errorMessage);
}
MXFPropertyPopulator.populateField(byteProvider, this, "footer_partition");
if (this.footer_partition < 0)
{
String errorMessage = String.format("Value of footer_partition = %d(0x%x) which is outside the supported range 0-0x%x",
this.footer_partition, this.footer_partition, Long.MAX_VALUE);
handleError(imfErrorLogger, errorMessage);
}
MXFPropertyPopulator.populateField(byteProvider, this, "header_byte_count");
if (this.header_byte_count < 0)
{
String errorMessage = String.format("Value of header_byte_count = %d(0x%x) which is outside the supported range 0-0x%x",
this.header_byte_count, this.header_byte_count, Long.MAX_VALUE);
handleError(imfErrorLogger, errorMessage);
}
MXFPropertyPopulator.populateField(byteProvider, this, "index_byte_count");
if (this.index_byte_count < 0)
{
String errorMessage = String.format("Value of index_byte_count = %d(0x%x) which is outside the supported range 0-0x%x",
this.index_byte_count, this.index_byte_count, Long.MAX_VALUE);
handleError(imfErrorLogger, errorMessage);
}
MXFPropertyPopulator.populateField(byteProvider, this, "index_SID");
MXFPropertyPopulator.populateField(byteProvider, this, "body_offset");
if (this.body_offset < 0)
{
String errorMessage = String.format("Value of body_offset = %d(0x%x) which is outside the supported range 0-0x%x",
this.body_offset, this.body_offset, Long.MAX_VALUE);
handleError(imfErrorLogger, errorMessage);
}
MXFPropertyPopulator.populateField(byteProvider, this, "body_SID");
MXFPropertyPopulator.populateField(byteProvider, this, "operational_pattern");
CompoundDataTypes.MXFCollections.Header cHeader = new CompoundDataTypes.MXFCollections.Header(byteProvider);
List<UL> cList = new ArrayList<>();
if ((cHeader.getNumberOfElements() != 0) && (cHeader.getSizeOfElement() != KLVPacket.KEY_FIELD_SIZE))
{
throw new MXFException(String.format("Element size = %d in EssenceContainerBatch header is different from expected size = %d",
cHeader.getSizeOfElement(), KLVPacket.KEY_FIELD_SIZE));
}
for (long i=0; i<cHeader.getNumberOfElements(); i++)
{
cList.add(new UL(byteProvider.getBytes(KLVPacket.KEY_FIELD_SIZE)));
}
this.essenceContainerBatch = new CompoundDataTypes.MXFCollections.MXFCollection<UL>(cHeader, cList, "EssenceContainerBatch");
if (checkForSucceedingKLVFillItem)
{
//Offset of the next KLV packet would be the offset of the current KLV packet + KLV size
this.nextHeader = new KLVPacket.Header(byteProvider, byteOffset+this.header.getKLSize()+this.header.getVSize());
}
else
{
this.nextHeader = null;
}
}