To run a series of tests I am required to be able to alter the value of a single metadata item. I’ve found little to no documentation on this.
The way I thought it would work was by opening the file, altering the value and closing it, as I didn’t find an mxfFile->Save() function:
Code:
if (!mxfFile->Open(filepath, true))
{
perror(filepath);
error("Unable to open file\n");
exit(1);
}
mxfFile->GetRIP();
res = Alter_Item(mxfFile, NewValue);
mxfFile->Close();
Where the alteration looks like (in the case of a channelcount sounddescriptor item):
Code:
…
if(mSoundDesc)
{
mSoundChannelCount = mSoundDesc->Child(ChannelCount_UL);
if(mSoundChannelCount)
{
mSoundChannelCount->SetUInt(ChannelCount);
printf("Just altered count: %u\n", mSoundChannelCount->GetUInt());
}
}
…
The print to stdout displays the correct value, but as soon as the mxfFile()->Close() statement is called the item is returned to it’s old value.
What is the standard way to do such a thing?
edit:
I tried to use
Code:
mxfFile->ReWritePartition(MasterPartition);
before closing the file.
But then I get an error
Code:
ERROR: Not enough space to re-write updated header at position 0x00040020 in AFile.mxf