Open discussion about tools and MXF in general
It is currently Thu Feb 02, 2023 8:15 am
Board index » MXF Categories » Tools

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

Board User

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

Post Posted: Fri Mar 18, 2011 9:15 pm 
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?




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

Post Posted: Wed Mar 23, 2011 10:52 am 
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().

// 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

// 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

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

 Profile WWW  

Board User

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

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

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 2 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
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group :: Style based on FI Subice by :: All times are UTC