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

Check partition status.
http://freemxf.org/forum/viewtopic.php?f=2&t=96
Page 1 of 1

Author:  mxfgirl [ Thu Aug 30, 2007 12:21 pm ]
Post subject:  Check partition status.

Hi everybody,

I'm trying to change the partition status. But the following code doesn't make it (at least not correctly).
Something must be wrong there.

mxfgirl
Code:
...
theFile->Seek(0);
cout <<"Partition IsClosed(before): "<<theFile->ReadPartition()->IsClosed()<<endl;
cout <<"Partition IsComplete(before): "<<theFile->ReadPartition()->IsComplete()<<endl;
theFile->Seek(14);   //Byte No.15: PartitionStatus
Int8 PartitionStatus = 4;  //PartitionStatus (S377m,Table 1) //0x01;0x02;0x03;0x04
theFile->WriteI8(PartitionStatus);
theFile->Seek(0);
cout <<"  Partition IsClosed(after): "<<theFile->ReadPartition()->IsClosed()<<endl;
cout <<"  Partition IsComplete(after): "<<theFile->ReadPartition()->IsComplete()<<endl;
...

Author:  Matt Beard [ Sun Sep 09, 2007 7:36 am ]
Post subject: 

A couple of comments:

a) Simply changing the bytes of a key in an existing file is not a valid way of updating it. You would need to add an Identification set and update Generation UIDs. Also changing an open partition key into a closed one will not make it a closed partition. It is like taking the label off of a can of beans and adding a new one saying "soup" - even though the label now says "soup" it is still a can of beans!!

b) Each call to ReadPartition() will attempt to read a partition pack into memory from the current location in the file, and will move the file pointer forwards. The return value is a smart pointer to that partition in memory. What your code does is move the pointer to the start of the file, then read a partition pack and call IsClosed() on it (fine so far). Next the temporary smart pointer is destroyed at the end of the line (as you have not assigned it anywhere) and the partition is deleted from memory. On the next line the call to ReadPartition() will try and read the next KLV - which will either be a filler or a primer, not the partition pack. Strictly speaking this should flag an error, but currently it doesn't. This means that the second test not being performed on the partition pack.

Author:  mxfgirl [ Mon Sep 10, 2007 5:46 am ]
Post subject: 

Thank you for the reply.
If I only modify some metadata in footer partition and add an Identification set in it, so some metadata values in header and other partitions are not valuable. How can I mark these partitions as open or incomplete?
Before the second call of ReadPartition() I have moved the pointer to the start of the file, again, has the next KLV been read anyway?

Author:  Matt Beard [ Mon Sep 10, 2007 9:42 am ]
Post subject: 

Very good point!

It is fine in this case to change a partition from closed to open.

It is not fine to change from open to closed, or between complete and incomplete.

If you do this please also ensure that FooterPosition is correct in the header as it is awkward knowing that the header is of no use to you, but not being told where the footer is!

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