19
PAD_TEMPLATE = """<caps>
21
<direction>%(direction)s</direction>
22
<presence>%(presence)s</presence>
23
<details>%(details)s</details>
18
26
ELEMENT_TEMPLATE = """<element>
19
27
<name>%(name)s</name>
20
28
<longname>%(longname)s</longname>
21
29
<class>%(class)s</class>
22
30
<description>%(description)s</description>
23
31
<author>%(author)s</author>
26
37
PLUGIN_TEMPLATE = """<plugin>
50
61
def get_offset(indent):
51
62
return " " * INDENT_SIZE * indent
64
def output_pad_template(pt, indent=0):
65
print "PAD TEMPLATE", pt.name_template
66
paddir = ("unknown","source","sink")
67
padpres = ("always","sometimes","request")
70
'name': xmlencode(pt.name_template),
71
'direction': xmlencode(paddir[pt.direction]),
72
'presence': xmlencode(padpres[pt.presence]),
73
'details': xmlencode(pt.static_caps.string),
75
block = PAD_TEMPLATE % d
77
offset = get_offset(indent)
78
return offset + ("\n" + offset).join(block.split("\n"))
53
80
def output_element_factory(elf, indent=0):
54
81
print "ELEMENT", elf.get_name()
84
padtemplates = elf.get_static_pad_templates()
85
for padtemplate in padtemplates:
86
padsoutput.append(output_pad_template(padtemplate, indent))
56
89
'name': xmlencode(elf.get_name()),
57
90
'longname': xmlencode(elf.get_longname()),
58
91
'class': xmlencode(elf.get_klass()),
59
92
'description': xmlencode(elf.get_description()),
60
93
'author': xmlencode(elf.get_author()),
94
'pads': "\n".join(padsoutput),
62
96
block = ELEMENT_TEMPLATE % d
64
98
offset = get_offset(indent)
65
99
return offset + ("\n" + offset).join(block.split("\n"))