freeMXF.org

Open discussion about freeMXF.org tools and MXF in general
It is currently Wed Apr 08, 2020 2:26 am
Board index » MXF Categories » freeMXF.org Tools



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

Offline
Rookie

Joined: Wed Dec 20, 2006 6:19 am
Posts: 4
Location: US

Post Posted: Wed Dec 20, 2006 6:35 am 
Top  
Can anyone point me out to example of adding custom metadata - to describe them in dict.xml and then add programatically in the wrapper.
For example, I have added this set to dict.xml:

<MXFClasses>
<R_IDENTIFIER_1 base="StructuralComponent" detail="R identifier" type="localSet" globalKey="XXX 1">
<V_IDENTIFIER_1 detail="V identifier" type="localSet" globalKey="XXX 2">
<IDENTIFIER_TYPE_NAME type="Identifier" detail="ID type name" globalKey="XXX 3" />
<IDENTIFIER_NUMBER type="UInt16" detail="ID number" globalKey="XXX 4" />
</V_IDENTIFIER_1>
</R_IDENTIFIER_1>
</MXFClasses>

How then I populate this pattern in my program code? Any hint, please...

 Profile YIM  

Offline
Insider

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

Post Posted: Wed Dec 20, 2006 10:08 am 
Top  
There are two ways to now use this class in your code.

First, you can use the names that you have given for the tags, so for example:

MDObjectPtr NewItem = new MDObject("R_IDENTIFIER_1");
MDObjectPtr NewProperty = NewItem->AddChild("IDENTIFIER_TYPE_NAME");
NewProperty->SetValue( ChunkOfData );
NewItem->SetInt("IDENTIFIER_NUMBER", 14);

Or, you can define ULs for your new classes and properties in ulmap.h or a similar header, then use the "proper" UL identified method (in MXF it is the ULs that are the real identifier, not text names):

MDObjectPtr NewItem = new MDObject(R_IDENTIFIER_1_UL);
MDObjectPtr NewProperty = NewItem->AddChild(IDENTIFIER_TYPE_NAME_UL);
NewProperty->SetValue( ChunkOfData );
NewItem->SetInt(IDENTIFIER_NUMBER_UL, 14);

A few points to note:

* At the moment your fragment will not work because you have a local set within a local set and this is forbidden in MXF.
* It is not a good idea to add your own items to dict.xml as this gets updated with new releases. The proper solution is to write your own dictionary file containing your new sets and load it after dict.xml.
* Similarly you should use your own UL header file, not ulmap.h

 Profile WWW  

Offline
Rookie

Joined: Wed Dec 20, 2006 6:19 am
Posts: 4
Location: US

Post Posted: Wed Dec 20, 2006 6:51 pm 
Top  
Ok, thanks - this is clear enough.

Now where I attach this MDObject to existing metadata? Should I create a new partition, or can I add it somewhere to existing? All that I need is to specify some additional structural info for the wrapped essence.

I'm sorry, I'm novice in MXF world and there is not too much documentation about this format available online.

 Profile YIM  

Offline
Insider

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

Post Posted: Wed Dec 20, 2006 7:30 pm 
Top  
It will need to be added to the existing metadata.

The best way to do this is to link it by a strong reference.

To acheive this you will have to ensure that your class is derived directly of indirectly from "InterchangeObject".

The following is for structural metadata:
=========================

If it is not a sub-class of an existing type base it on "GenerationInterchangeObject" do this by including base="GenerationInterchangeObject" in the class definition line.

Then you will need to make a strong reference somewhere suitable, for example if it is details that apply to everything in a package add a new optional property to "GenericPackage" that is a strong reference to your new set, so in your dictionary you would have:

<!-- Extend the definition of Generic Package -->
<GenericPackage>
<MyExtraMetadata detail="Link to my extra metadata" type="UUID" ref="strong" target="R_IDENTIFIER_1" use="optional" globalKey="yyy"/>
</GenericPackage>

Then in the code you would add a property to the appropriate package that links to your new object of type R_IDENTIFIER_1:

MDObjectPtr NewItem = new MDObject("R_IDENTIFIER_1");
MDObjectPtr NewProperty = NewItem->AddChild("IDENTIFIER_TYPE_NAME");
NewProperty->SetValue( ChunkOfData );
NewItem->SetInt("IDENTIFIER_NUMBER", 14);

/* Note: FPackage = already existing File Package */
MDObjectPtr Link = FPackage->AddChild("MyExtraMetadata");
Link->MakeRef(NewItem);


DESCRIPTIVE METADATA
================

If your new class is some form of descriptive metadata you should base it on the class called "DM_Framework" and add DM tracks and DM DMSegments that reference your new set. Here you will not have to define a new strong reference property, but will simply use the existing "DMFramework" property of "DMSegment".

For example:

/* Note: MPackage = already existing Material Package */
TrackPtr MyTrack = MPackage->AddDMTrack(PackageEditRate);
DMSegmentPtr MySegment = MyTrack->AddDMSegment(0, PackageDuration);
MDObjectPtr MyFramework = MySegment->AddChild(DMFramework_UL);
MyFramewotk->MakeLink(NewItem);

 Profile WWW  

Offline
Rookie

Joined: Wed Dec 20, 2006 6:19 am
Posts: 4
Location: US

Post Posted: Wed Dec 20, 2006 7:43 pm 
Top  
Great! Subclass of DM_Framework - this is what I needed. Works perfect, thanks a lot!

 Profile YIM  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group :: Style based on FI Subice by phpBBservice.nl :: All times are UTC