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

Add new identification--Please help me!
http://freemxf.org/forum/viewtopic.php?f=2&t=95
Page 1 of 1

Author:  mxfgirl [ Wed Aug 29, 2007 9:13 am ]
Post subject:  Add new identification--Please help me!

Hi,

I am trying to add new identification into header metadata and update the LastModifiedDate. But it doesn't work, please help me. Thanks!
Code:
int main(int argc, char *argv[])
{
   ...
   MasterPartition->ReadMetadata();
   MetadataPtr HMeta = MasterPartition->ParseMetadata();
   
                MDObjectPtr Idens=HMeta[Identifications_UL];
   if(Idens) cout<<"Idens size: "<< Idens->size()<<endl;

   MDObjectPtr LMD=HMeta[LastModifiedDate_UL];
   printf("%s = %s\n", LMD->Name().c_str(), LMD->GetString().c_str());

   HMeta->SetTime();
   //Not changed!!??Why?
                LMD=HMeta[LastModifiedDate_UL];
   printf("%s = %s\n", LMD->Name().c_str(), LMD->GetString().c_str());

   UInt8 ProductGUID_Data[16] = { 0x84, 0x55, 0x23, 0xe2, 0x16, 0x8c, 0xc2, 0x30, 0x85, 0xcb, 0xef, 0x78, 0x9c, 0xde, 0xef, 0x42 };
   ...
   MDObjectPtr Ident = new MDObject(Identification_UL);
   Ident->SetString(CompanyName_UL, CompanyName);
    ...
   Ident->SetValue(ProductUID_UL, DataChunk(16,ProductUID->GetValue()));
   HMeta->UpdateGenerations(Ident);
   Idens=HMeta[Identifications_UL];
   //Not changed!!??Why?
   if(Idens) cout<<"Idens size: "<< Idens->size()<<endl;
                ...

}

Author:  Matt Beard [ Wed Aug 29, 2007 4:07 pm ]
Post subject: 

What you need to to is build an Identification set, call SetTime() then call UpdateGenerations() - this final call will do all the work of adding the identification set and linking it by GenerationUID to any metadata sets whose values have been modified since the data was last read from file, or since the last call to UpdateGenerations(). All SetTime() does is sets the time that will be used when the next recorded modification happens (such as a call to UpdateGenerations() or adding a new package to the file)

Author:  mxfgirl [ Thu Aug 30, 2007 7:24 am ]
Post subject: 

Thank you Matt.

I have tried it (Create a new identification set, call SetTime(), then call UpDateGenerations()), but it didn't work.
Insteed SetTime() I've tried:

Code:
...
LMD=HMeta[LastModifiedDate_UL];
LMD->SetString(Now2String());
HMeta->UpdateGenerations(Ident)
...


It worked!

Author:  Matt Beard [ Tue Sep 11, 2007 9:43 am ]
Post subject: 

This seems to be because you have not actually modified any properties.

UpdateGenerations contains the following note: "The preface does not get modified simply to add the new identification set"

What this is supposed to show is that nothing will get added if you have not changed the file.

I will add a tracker request to allow a new Ident set to be forced into an otherwise unchanged file (there may be a reason to allow this).

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