freeMXF.org
http://www.freemxf.org/forum/

Saving an alteration of the value of a property
http://www.freemxf.org/forum/viewtopic.php?f=2&t=126
Page 1 of 1

Author:  Pardus [ Mon Dec 17, 2007 8:46 am ]
Post subject:  Saving an alteration of the value of a property

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

Author:  Matt Beard [ Tue Dec 18, 2007 12:08 pm ]
Post subject: 

The problem is that in order to write a modified copy of the header metadata the 377M specification states that you must add an Identification Set describing the device that makes this modification (and link via GenerationUID).

This makes the revised header metadata bigger. If the header metadata in the file is followed by a filler then the ReWritePartition() function reduces this filler so that the revised metadata fits. If this is not possible then you are stuck.

The only other option is to turn the header into an open header and rewrite the footer as an updated version.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/