Board index » MXF Categories » freeMXF.org Tools
|
Page 1 of 1
|
[ 5 posts ] |
|
Print view
Previous topic | Next topic
Author |
Message |
adron
Rookie
Joined: Wed Dec 20, 2006 6:19 am Posts: 4 Location: US
|
Posted: Wed Dec 20, 2006 6:35 am |
|
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...
|
|
|
|
|
Matt Beard
Insider
Joined: Thu Apr 15, 2004 10:39 am Posts: 198 Location: Scotland
|
Posted: Wed Dec 20, 2006 10:08 am |
|
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
|
|
|
|
|
adron
Rookie
Joined: Wed Dec 20, 2006 6:19 am Posts: 4 Location: US
|
Posted: Wed Dec 20, 2006 6:51 pm |
|
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.
|
|
|
|
|
Matt Beard
Insider
Joined: Thu Apr 15, 2004 10:39 am Posts: 198 Location: Scotland
|
Posted: Wed Dec 20, 2006 7:30 pm |
|
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);
|
|
|
|
|
adron
Rookie
Joined: Wed Dec 20, 2006 6:19 am Posts: 4 Location: US
|
Posted: Wed Dec 20, 2006 7:43 pm |
|
Great! Subclass of DM_Framework - this is what I needed. Works perfect, thanks a lot!
|
|
|
|
|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online
Users browsing this forum: No registered users and 14 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
|
|