Exemple #1
0
    def test_classdef(self):

        f = aaf.open()
        class_id = AUID.from_urn_smpte_ul("urn:smpte:ul:060e2b34.02060101.0d010101.01015900")
        parent_classdef = f.dictionary.lookup_classdef("InterchangeObject")
        sub_descriptor_classdef = aaf.define.ClassDef(f,
                                     class_id, parent_classdef, "SubDescriptor", False)

        f.dictionary.register_def(sub_descriptor_classdef)

        ame_id = AUID.from_urn_smpte_ul("urn:smpte:ul:060e2b34.01040101.0e040301.01000000")
        typedef_pairs = [('did', 'UInt8'),('sdid', 'UInt8')]
        ame_typdef = aaf.define.TypeDefRecord(f, typedef_pairs, ame_id, 'AvidManifestElement')
        f.dictionary.register_def(ame_typdef)

        ama_id = AUID.from_urn_smpte_ul("urn:smpte:ul:060e2b34.01040101.0e040402.01000000")
        ama_typdef = aaf.define.TypeDefVariableArray(f, ame_typdef, ama_id, "AvidManifestArray")
        f.dictionary.register_def(ama_typdef)

        class_id = AUID.from_urn_smpte_ul("urn:smpte:ul:060e2b34.02060101.0d010101.01015c00")
        parent_classdef = f.dictionary.lookup_classdef("DataEssenceDescriptor")
        ancd_classdef = aaf.define.ClassDef(f,
                                    class_id, parent_classdef, "ANCDataDescriptor", True)

        prop_id = AUID.from_urn_smpte_ul("urn:smpte:ul:060e2b34.01010101.0e040101.01010105")
        ancd_classdef.register_optional_propertydef(ama_typdef, prop_id, 'ManifestArray')

        f.dictionary.register_def(ancd_classdef)


        desc = f.create.ANCDataDescriptor()
        self.assertEqual(desc.classdef().name, 'ANCDataDescriptor')

        desc['Length'].value = 10
        self.assertEqual(desc['Length'].value, 10)

        manifest = [{'did':0, 'sdid':1}, {'did':1, 'sdid':2}, {'did':3, 'sdid':4}]
        desc['ManifestArray'].value = manifest
        self.assertEqual(list(desc['ManifestArray'].value), manifest)

        self.assertRaises(RuntimeError, f.create.SubDescriptor)

        f.save("test.xml")
    def test_typedef(self):
        type_name = "TEST_String"
        type_id = AUID.from_list([0xb9da6c9e, 0x2b3c, 0x11d4, 0x8e, 0x50, 0x0, 0x90, 0x27, 0xdf, 0xcc, 0x26])

        prop_name = "STR Property Name"
        prop_id = AUID.from_list([0xb9da6c9f, 0x2b3c, 0x11d4, 0x8e, 0x50, 0x0, 0x90, 0x27, 0xdf, 0xcc, 0x26])
        f = aaf.open()

        string_typedef = aaf.define.TypeDefString(f, type_id, type_name)
        print(string_typedef)

        f.dictionary.register_def(string_typedef)

        mob_classdef = f.dictionary.lookup_classdef("Mob")

        mob_classdef.register_optional_propertydef(string_typedef, prop_id, prop_name)

        test_value = "Test Value"
        mob = f.create.MasterMob()
        mob[prop_name].value = test_value

        f.storage.add_mob(mob)

        self.assertEqual(mob[prop_name].value, test_value)
Exemple #3
0
def setup_avid_extensions(f):
    uint8_typedef = f.dictionary.lookup_typedef("UInt8")
    unit16_typedef = f.dictionary.lookup_typedef("UInt16")
    int32_typedef = f.dictionary.lookup_typedef("Int32")

    # this property seems to stop mastermob from showing up in the bin
    mob_classdef = f.dictionary.lookup_classdef("Mob")
    appcode_id = AUID("urn:uuid:96c46992-4f62-11d3-a022-006094eb75cb")
    mob_classdef.register_optional_propertydef(int32_typedef, appcode_id,
                                               'AppCode')

    bagbit_id = AUID('urn:uuid:ccaa73d1-f538-11d3-a081-006094eb75cb')
    bagbit_typedef = aaf.define.TypeDefVariableArray(f, uint8_typedef,
                                                     bagbit_id,
                                                     'AvidBagOfBits')
    f.dictionary.register_def(bagbit_typedef)

    opdef_id = AUID('urn:uuid:2db619ef-7210-4e89-95d7-970336d72e8c')
    opdef = f.create.OperationDef(opdef_id, 'Title_2', "")
    opdef.media_kind = 'picture'

    # AvidGraphicFXAttr
    param_id = AUID('urn:uuid:1fdd2907-e48c-11d3-a078-006094eb75cb')
    graphic_fx_paramdef = f.create.ParameterDef(param_id, 'AvidGraphicFXAttr',
                                                "", bagbit_typedef)
    f.dictionary.register_def(graphic_fx_paramdef)
    opdef.add_parameterdef(graphic_fx_paramdef)

    # AvidParameterByteOrder
    param_id = AUID('urn:uuid:c0038672-a8cf-11d3-a05b-006094eb75cb')
    paramdef = f.create.ParameterDef(param_id, 'AvidParameterByteOrder', "",
                                     unit16_typedef)
    f.dictionary.register_def(paramdef)
    opdef.add_parameterdef(paramdef)

    # AvidEffectID
    param_id = AUID('urn:uuid:93994bd6-a81d-11d3-a05b-006094eb75cb')
    effect_id_paramdef = f.create.ParameterDef(param_id, 'AvidEffectID', "",
                                               bagbit_typedef)
    f.dictionary.register_def(effect_id_paramdef)
    opdef.add_parameterdef(effect_id_paramdef)

    f.dictionary.register_def(opdef)
from aaf.util import AUID, MobID

import unittest
import os

cur_dir = os.path.dirname(os.path.abspath(__file__))

sandbox = os.path.join(cur_dir, 'sandbox')
if not os.path.exists(sandbox):
    os.makedirs(sandbox)

main_test_file = os.path.join(sandbox, 'test_TypeDef.aaf')

TypeId_Mixed = AUID.from_list([
    0xed9cbe2f, 0x1a42, 0x420c, 0x95, 0x2e, 0x7b, 0x23, 0xad, 0xbb, 0xc4, 0x79
])


class TypeDefRecord(unittest.TestCase):
    def test_basic(self):
        f = aaf.open(main_test_file, 'w')

        try:
            typdef = aaf.define.TypeDefRecord(f, [('some_int')], TypeId_Mixed,
                                              'MixedRecord')

        except ValueError:
            pass
            print(traceback.format_exc())
        else:
from aaf.util import AUID, MobID

import unittest
import os

cur_dir = os.path.dirname(os.path.abspath(__file__))

sandbox = os.path.join(cur_dir,'sandbox')
if not os.path.exists(sandbox):
    os.makedirs(sandbox)

main_test_file = os.path.join(sandbox, 'test_TypeDefVariableArray.aaf')

# TypeDef IDs
TaggedValueStrongRefTypeID =  AUID.from_list([0xda60bb00, 0xba41, 0x11d4, 0xa8, 0x12, 0x8e, 0x54, 0x1b, 0x97, 0x2e, 0xa3 ])

# ValueVariableArray IDs
TEST_VA_TYPE_ID = AUID.from_list([0x47240c2e, 0x19d, 0x11d4, 0x8e, 0x3d, 0x0, 0x90, 0x27, 0xdf, 0xca, 0x7c])
TaggedValueVariableArrayTypeID =  AUID.from_list([0xc9fb1100, 0xba3e, 0x11d4, 0xa8, 0x12, 0x8e, 0x54, 0x1b, 0x97, 0x2e, 0xa3 ])
MobWeakRefVariableArrayTypeID = AUID.from_list([0xe9794b79, 0xab2f, 0x4827, 0x9a, 0x31, 0x35, 0x39, 0xb2, 0x98, 0x67, 0xd6])

# Property IDs
TEST_PROP_ID = AUID.from_list([ 0x47240c2f, 0x19d, 0x11d4, 0x8e, 0x3d, 0x0, 0x90, 0x27, 0xdf, 0xca, 0x7c ])
ComponentAttributesProperty1ID = AUID.from_list([0x198e0c80, 0xba40, 0x11d4, 0xa8, 0x12, 0x8e, 0x54, 0x1b, 0x97, 0x2e, 0xa3])
ComponentAttributesProperty2ID = AUID.from_list([0x198e0c81, 0xba40, 0x11d4,  0xa8, 0x12, 0x8e, 0x54, 0x1b, 0x97, 0x2e, 0xa3])
MobReferencedMobsPropertyID = AUID.from_list([0x6f7b3c85, 0x7f57, 0x490b, 0xa3, 0xa8, 0xe5, 0xf2, 0xb4, 0xb1, 0x44, 0x34])

TEST_MobID = MobID.from_list([0x06, 0x0c, 0x2b, 0x34, 0x02, 0x05, 0x11, 0x01, 0x01, 0x00, 0x10, 0x00, 0x13,
                               0x00, 0x00, 0x00, 0xda, 0x5a, 0xb5, 0xf4, 0x04, 0x05, 0x11, 0xd4, 0x8e, 0x3d, 0x00, 0x90, 0x27, 0xdf, 0xca, 0x7c])
import traceback

from aaf.util import AUID, MobID

import unittest
import os

cur_dir = os.path.dirname(os.path.abspath(__file__))

sandbox = os.path.join(cur_dir,'sandbox')
if not os.path.exists(sandbox):
    os.makedirs(sandbox)

main_test_file = os.path.join(sandbox, 'test_TypeDef.aaf')

TypeId_Mixed = AUID.from_list([0xed9cbe2f, 0x1a42, 0x420c, 0x95, 0x2e, 0x7b, 0x23, 0xad, 0xbb, 0xc4, 0x79 ])

class TypeDefRecord(unittest.TestCase):
    def test_basic(self):
        f = aaf.open(main_test_file, 'w')

        try:
            typdef = aaf.define.TypeDefRecord(f, [('some_int')], TypeId_Mixed, 'MixedRecord')

        except ValueError:
            pass
            print(traceback.format_exc())
        else:
            raise

        auid_typedef = f.dictionary.lookup_typedef("AUID")
Exemple #7
0
from aaf.util import AUID, MobID

import unittest
import os

cur_dir = os.path.dirname(os.path.abspath(__file__))

sandbox = os.path.join(cur_dir, 'sandbox')
if not os.path.exists(sandbox):
    os.makedirs(sandbox)

main_test_file = os.path.join(sandbox, 'test_TypeDefVariableArray.aaf')

# TypeDef IDs
TaggedValueStrongRefTypeID = AUID.from_list([
    0xda60bb00, 0xba41, 0x11d4, 0xa8, 0x12, 0x8e, 0x54, 0x1b, 0x97, 0x2e, 0xa3
])

# ValueVariableArray IDs
TEST_VA_TYPE_ID = AUID.from_list(
    [0x47240c2e, 0x19d, 0x11d4, 0x8e, 0x3d, 0x0, 0x90, 0x27, 0xdf, 0xca, 0x7c])
TaggedValueVariableArrayTypeID = AUID.from_list([
    0xc9fb1100, 0xba3e, 0x11d4, 0xa8, 0x12, 0x8e, 0x54, 0x1b, 0x97, 0x2e, 0xa3
])
MobWeakRefVariableArrayTypeID = AUID.from_list([
    0xe9794b79, 0xab2f, 0x4827, 0x9a, 0x31, 0x35, 0x39, 0xb2, 0x98, 0x67, 0xd6
])

# Property IDs
TEST_PROP_ID = AUID.from_list(
    [0x47240c2f, 0x19d, 0x11d4, 0x8e, 0x3d, 0x0, 0x90, 0x27, 0xdf, 0xca, 0x7c])