freeMXF.org

Open discussion about freeMXF.org tools and MXF in general
It is currently Sun Dec 22, 2024 5:16 am
Board index » MXF Categories » freeMXF.org Tools



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

Offline
Board User

Joined: Wed Mar 16, 2011 9:18 pm
Posts: 6

Post Posted: Fri Mar 18, 2011 9:15 pm 
Top  
I am trying to write read klv to/from a buffer.

I create an MDObject, set its value, then write out the klv form to a datachunk.

then i make a new MDObject of same type,and without setting values i write to data chunk to get a pointer to the dataachunk.

then i make the new data chunk pointer 'point' to the original data chunk.

When i do a get string of the new datachunk i see the correct bytes.


but if i try to access the value via the new MDObject it still appears empty.


How can i load an MDObject from a buffer that contains the klv formatted data?

Is this not the correct approach?

Can i not gofrom MDObject to KLV format(in a buffer) back to an MDObject?


I guess i am confused as to how the datachunk relates to the MDObject. Does each MDObject store data in a datachunk that it creates?

thanks
jorge

 Profile  

Offline
Insider

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

Post Posted: Wed Mar 23, 2011 10:52 am 
Top  
I am not entirely sure that I understand what you are asking, but hopefully the following will help:

MDObject::PutData() will build a DataChunk containing the value of the object formatted for the V part of the KLV.

MDObject::ReadValue() will set the value of an MDObject from a DataChunk of the format written by PutData().

So:
Code:
// Build an MDObject suitable for LastModifiedDate property of the Preface (of data type TimeStamp)
MDObjectPtr First = new MDObjectPtr(LastModifiedDate_UL);

// Set a value of noon on November the first 2010
First->SetString("2010-11-01T12:00:00.00");

// Write this into a buffer
DataChunkPtr Val = First->PutData();

// Val now contains the following bytes: 0x07, 0xda, 0x0b, 0x01, 0x0c, 0x00, 0x00, 0x00
// This is the year (0x07da == 2010), month (0x0b = 11), day (0x01 = 1), hour (0x0c = 12) etc.

// Make another object of the same type
MDObjectPtr Second = new MDObjectPtr(LastModifiedDate_UL);

// Set the second object from the data chunk
Second->ReadValue(Val);

// Print "2010-11-01T12:00:00.00"
cout << Second->GetString();

 Profile WWW  

Offline
Board User

Joined: Wed Mar 16, 2011 9:18 pm
Posts: 6

Post Posted: Wed Mar 30, 2011 7:17 pm 
Top  
That is what i am looking for. I appreciate the help.

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

Jump to:  


Who is online

Users browsing this forum: No registered users and 0 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