Open mrlimbic opened 5 years ago
@mrlimbic I have the exact same issue. Did you ever find a solution or workaround to this?
I haven't had a chance to look at writing AAFs since then but will later.
I've concentrated on reading them so far and now can do that well (including extracting embedded media). I've also forked the project to add a few hacks when I need it to become less strict (it complained about some elements in Media Composer and Nuendo AAFs).
My guess with what I know since getting them to read well is that a definition for one of the properties is missing or it's alias isn't resolving when creating the AAF using text property names.
I had to fix an alias when reading them too. See example below. There is an alias list that is supposed to work but for some reason it wasn't translating. So I hard coded a little hack as didn't have time to find out the real reason. Here is an example of one hack. So far I've had to add 3 small hacks.
Hopefully I'll get time at some point to find out why aliases aren't working and fix it properly rather than just adding more quick hacks.
private final static Field findInjectionPoint(
PropertyDefinition property) {
try {
ClassDefinition memberOf = property.getMemberOf();
Class<?> memberClass = memberOf.getJavaImplementation();
String name = property.getName();
// TODO Tried adding alias for this but isn't working - why?
if (MajHacks.componentAttributesAliasFix && name.equals("ComponentAttributeList")) {
name = "ComponentAttributes";
System.err.println("Substituted malfunctioning alias ComponentAttributeList for ComponentAttributes");
}
return memberClass.getDeclaredField(
Character.toLowerCase(name.charAt(0)) + name.substring(1));
}
catch (NoSuchFieldException nsfe) {
nsfe.printStackTrace();
return null;
}
}
tried out your fork before an there I get:
Info: Possible unsafe setting of property Preface.DescriptiveSchemes due to a java.lang.NoSuchMethodException: tv.amwa.maj.model.impl.PrefaceImpl.initializeDescriptiveSchemes()
When making a dynamic preface, adding null type for property 'CompositionPackage:Clip effects'.
Could not retrieve a value for required property PropertyDefinition.PropertyType because of a java.lang.IllegalArgumentException: Unable to get the value of property PropertyDefinition.PropertyType becuase of a java.lang.reflect.InvocationTargetException: null
java.lang.IllegalArgumentException: Unable to get the value of property PropertyDefinition.PropertyType becuase of a java.lang.reflect.InvocationTargetException: null
at tv.amwa.maj.meta.impl.PropertyDefinitionImpl.getPropertyValue(PropertyDefinitionImpl.java:479)
at tv.amwa.maj.meta.impl.ClassDefinitionImpl.getProperties(ClassDefinitionImpl.java:802)
at tv.amwa.maj.io.aaf.AAFBuilder.generateAAFStructure(AAFBuilder.java:1878)
at tv.amwa.maj.io.aaf.AAFBuilder.processPropertyValue(AAFBuilder.java:2092)
at tv.amwa.maj.io.aaf.AAFBuilder.generateAAFStructure(AAFBuilder.java:1953)
at tv.amwa.maj.io.aaf.AAFBuilder.processPropertyValue(AAFBuilder.java:2092)
at tv.amwa.maj.io.aaf.AAFBuilder.generateAAFStructure(AAFBuilder.java:1953)
at tv.amwa.maj.io.aaf.AAFBuilder.generateMetaDictionary(AAFBuilder.java:2195)
at tv.amwa.maj.io.aaf.AAFFactory.writePreface(AAFFactory.java:153)
at tv.amwa.maj.example.CompositionExample.main(CompositionExample.java:107)
Caused by: java.lang.NullPointerException
at tv.amwa.maj.meta.impl.PropertyDefinitionImpl.getPropertyType(PropertyDefinitionImpl.java:305)
at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at tv.amwa.maj.meta.impl.MethodBag.get(MethodBag.java:63)
at tv.amwa.maj.meta.impl.TypeDefinitionImpl.getPropertyValue(TypeDefinitionImpl.java:277)
at tv.amwa.maj.meta.impl.PropertyDefinitionImpl.getPropertyValue(PropertyDefinitionImpl.java:474)
... 9 more
Found a required property not in the value map for PropertyDefinition.PropertyType.
Could not retrieve a value for required property PropertyDefinition.PropertyType because of a java.lang.IllegalArgumentException: Unable to get the value of property PropertyDefinition.PropertyType becuase of a java.lang.reflect.InvocationTargetException: null
java.lang.IllegalArgumentException: Unable to get the value of property PropertyDefinition.PropertyType becuase of a java.lang.reflect.InvocationTargetException: null
at tv.amwa.maj.meta.impl.PropertyDefinitionImpl.getPropertyValue(PropertyDefinitionImpl.java:479)
at tv.amwa.maj.meta.impl.ClassDefinitionImpl.getProperties(ClassDefinitionImpl.java:802)
at tv.amwa.maj.io.xml.XMLBuilder.appendObject(XMLBuilder.java:423)
at tv.amwa.maj.io.xml.XMLBuilder.toXML(XMLBuilder.java:385)
at tv.amwa.maj.industry.MediaEngine.toString(MediaEngine.java:894)
at tv.amwa.maj.meta.impl.MetaDefinitionImpl.toString(MetaDefinitionImpl.java:262)
at tv.amwa.maj.io.aaf.AAFBuilder.generateAAFStructure(AAFBuilder.java:1904)
at tv.amwa.maj.io.aaf.AAFBuilder.processPropertyValue(AAFBuilder.java:2092)
at tv.amwa.maj.io.aaf.AAFBuilder.generateAAFStructure(AAFBuilder.java:1953)
at tv.amwa.maj.io.aaf.AAFBuilder.processPropertyValue(AAFBuilder.java:2092)
at tv.amwa.maj.io.aaf.AAFBuilder.generateAAFStructure(AAFBuilder.java:1953)
at tv.amwa.maj.io.aaf.AAFBuilder.generateMetaDictionary(AAFBuilder.java:2195)
at tv.amwa.maj.io.aaf.AAFFactory.writePreface(AAFFactory.java:153)
at tv.amwa.maj.example.CompositionExample.main(CompositionExample.java:107)
Caused by: java.lang.NullPointerException
at tv.amwa.maj.meta.impl.PropertyDefinitionImpl.getPropertyType(PropertyDefinitionImpl.java:305)
at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at tv.amwa.maj.meta.impl.MethodBag.get(MethodBag.java:63)
at tv.amwa.maj.meta.impl.TypeDefinitionImpl.getPropertyValue(TypeDefinitionImpl.java:277)
at tv.amwa.maj.meta.impl.PropertyDefinitionImpl.getPropertyValue(PropertyDefinitionImpl.java:474)
... 13 more
<?xml version="1.0" encoding="UTF-8"?><aaf:PropertyDefinition xmlns:aaf="http://www.smpte-ra.org/schemas/2001-2/2007/aaf">
<aaf:MetaDefinitionName>Clip effects</aaf:MetaDefinitionName>
<aaf:MetaDefinitionIdentification>urn:uuid:c33bb43d-12bf-4bc6-bced-4047f61a0e89</aaf:MetaDefinitionIdentification>
<aaf:MetaDefinitionDescription/>
<aaf:IsUniqueIdentifier>false</aaf:IsUniqueIdentifier>
<aaf:LocalIdentification>0</aaf:LocalIdentification>
<aaf:MemberOf>urn:smpte:ul:060e2b34.02060101.0d010101.01013500</aaf:MemberOf>
<aaf:IsOptional>true</aaf:IsOptional>
<!--Symbol is Clip_effects-->
</aaf:PropertyDefinition>
Asked for a null hashcode.
Exception in thread "main" java.lang.IllegalArgumentException: Unable to get the value of property MetaDefinition.MetaDefinitionIdentification becuase of a java.lang.NullPointerException:
at tv.amwa.maj.meta.impl.PropertyDefinitionImpl.getPropertyValue(PropertyDefinitionImpl.java:479)
at tv.amwa.maj.io.aaf.AAFBuilder.processPropertyValue(AAFBuilder.java:2069)
at tv.amwa.maj.io.aaf.AAFBuilder.generateAAFStructure(AAFBuilder.java:1953)
at tv.amwa.maj.io.aaf.AAFBuilder.generateMetaDictionary(AAFBuilder.java:2195)
at tv.amwa.maj.io.aaf.AAFFactory.writePreface(AAFFactory.java:153)
at tv.amwa.maj.example.CompositionExample.main(CompositionExample.java:107)
Both versions show a lot of warnings like "Warning: Cannot use alias Jupiter_Clip_Offset for property Component.Jupiter Clip Offset because it clashes with another property name or symbol in the same class."
Yes. Doesn't work for me either. I haven't tried to fix/hack writing AAFs yet. I only got reading working for MC and Nuendo AAFs.
I was just providing some information (maybe a clue) about aliasing being broken in case you want to try to find a hack or proper fix yourself.
For reading I had to hack things like the lines below to read AAFs. The following alias should work but it doesn't so I intercepted the name it in code to rename it. It would be way better to find the real cause of aliasing not working properly rather than add endless hacks.
// TODO Tried adding alias for this but isn't working - why?
if (MajHacks.componentAttributesAliasFix && name.equals("ComponentAttributeList")) {
name = "ComponentAttributes";
System.err.println("Substituted malfunctioning alias ComponentAttributeList for ComponentAttributes");
}
ah ok. Sorry I interpreted that message wrong. Writing ist the primary thing I need. I think I will go with pyaaf, because that ist working out of the box.
I will close issue #17 because its a duplicate of this.