5 from string import Template
7 TEMPLATE = Template('''
13 gst_init_static_plugins (void)
15 static gsize initialization_value = 0;
16 if (g_once_init_enter (&initialization_value)) {
18 g_once_init_leave (&initialization_value, 1);
23 if __name__ == "__main__":
24 parser = argparse.ArgumentParser()
25 parser.add_argument(dest="output", help="Output file")
26 parser.add_argument(dest="plugins", help="The list of plugins")
28 options = parser.parse_args()
31 for plugin in options.plugins.split(os.pathsep):
32 filename = os.path.basename(plugin)
33 if filename.startswith('libgst') and filename.endswith('.a'):
34 names.add(filename[len('libgst'):-len('.a')])
36 registration = ['GST_PLUGIN_STATIC_REGISTER(%s);' % name for name in names]
37 declaration = ['GST_PLUGIN_STATIC_DECLARE(%s);' % name for name in names]
39 with open(options.output, "w") as f:
40 f.write(TEMPLATE.substitute({
41 'plugins_declaration': '\n'.join(declaration),
42 'plugins_registration': '\n '.join(registration),