I've been trying to create a Partial Restore application for XDCAM pal d10 imx 50 mxf files.
As a first step I'm trying to duplicate an example XDCAM file.
The Essence in our XDCAM file is framewrapped.
I've written a custom EssenceSource (RAW_essenceSource) that has a Smartpointer to the Partition that contains the essence in the original file, and also an UL defining the essence stream we wish to extract from this Partition.
When the RAW_essenceSource::BaseGetEssenceData() function is called, it returns the Data(Chunk) of the next retrieved KLVObjectPtr (Partition->NextElement()) that matches with the chosen UL
Thus, I'm able to create an unindexed file.
Code:
...
EssenceSourcePtr Source = new RAW_EssenceSource(ThisPartition,elementUL,UInt8(0x05),UInt8(0x01));
EssenceSourcePtr Source2 = new RAW_EssenceSource(ThisPartition,elementUL_2,UInt8(0x06),UInt8(0x01));
BodyStreamPtr Stream = new BodyStream(BodySID,Source);
Stream->AddSubStream(Source2);
Stream->SetWrapType(BodyStream::StreamWrapFrame);
BodyWriterPtr Writer = new BodyWriter(OutFile);
Writer->SetKAG(512);
Writer->SetForceBER4(true);
Writer->SetMetadataSharing(true, true);
Writer->AddStream(Stream);
PartitionPtr NewPart = new Partition(OpenHeader_UL);
...
NewPart->AddMetadata(HMeta);
Writer->SetPartition(NewPart);
Writer->WriteHeader(true,true);
Writer->WriteBody();
Writer->WriteFooter(false);
OutFile->Close();
The original XDCAM file however contains an index of the type (or so I think):
Code:
Stream->SetIndexType( (BodyStream::IndexType) ( BodyStream::StreamIndexCBRHeader
| BodyStream::StreamIndexCBRBody
| BodyStream::StreamIndexCBRFooter) );
I've tried indexing the file but my console output always returns an infinite number of error messages:
Quote:
ERROR: Attempted to index a stream with no index manager
I've created an IndexManager but I don't know how and cannot find an example on how to link it to the BodyWriter.
Code:
IndexManagerPtr IndexMan = new IndexManager(0,Source->GetEssenceDataSize());
IndexMan->SetBodySID(BodySID);
IndexMan->SetIndexSID(1);
IndexMan->SetEditRate(Source->GetEditRate());
IndexMan->SetValueRelativeIndexing(false);
How does one ceate and add a valid IndexManager, that works with a custom EssenceSource? And how does one link this IndexManager to the considered EssenceSources/BodyStream/BodyWriter ?