freeMXF.org

Open discussion about freeMXF.org tools and MXF in general
It is currently Mon Dec 23, 2024 1:14 am
Board index » MXF Categories » freeMXF.org Tools



Post new topic Reply to topic  [ 4 posts ] 
Author
Search for:
Message

Offline
Board User

Joined: Wed Aug 22, 2007 3:03 pm
Posts: 7

Post Posted: Thu Aug 30, 2007 12:21 pm 
Top  
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;
...

 Profile  

Offline
Insider

Joined: Thu Apr 15, 2004 10:39 am
Posts: 198
Location: Scotland

Post Posted: Sun Sep 09, 2007 7:36 am 
Top  
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.

 Profile WWW  

Offline
Board User

Joined: Wed Aug 22, 2007 3:03 pm
Posts: 7

Post Posted: Mon Sep 10, 2007 5:46 am 
Top  
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?

 Profile  

Offline
Insider

Joined: Thu Apr 15, 2004 10:39 am
Posts: 198
Location: Scotland

Post Posted: Mon Sep 10, 2007 9:42 am 
Top  
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!

 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

Jump to:  


Who is online

Users browsing this forum: No registered users and 6 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group :: Style based on FI Subice by phpBBservice.nl :: All times are UTC