1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from collections import defaultdict
from cerbero.utils import shell
from custom import list_gstreamer_1_0_plugins_by_category
DECLARE_PLUGIN_TPL = 'GST_PLUGIN_STATIC_DECLARE(%s);'
REGISTER_PLUGIN_TPL = ' GST_PLUGIN_STATIC_REGISTER(%s);'
DEFINE_TPL = '#define GST_IOS_PLUGINS_%s\n'
DEFINES_TPL = '''\
#if defined(GST_IOS_PLUGIN_%s) || defined(GST_IOS_PLUGINS_%s)
%s
#endif'''
class Recipe(recipe.Recipe):
name = 'gstreamer-ios-templates'
version = '0.1'
licenses = [License.LGPLv2_1]
stype = SourceType.CUSTOM
btype = BuildType.CUSTOM
files_devel = [
'share/xcode/templates/ios/',
]
def install(self):
share_dir = os.path.join(self.config.prefix, 'share', 'xcode',
'templates', 'ios')
shell.copy_dir(os.path.join(self.config.data_dir, 'xcode',
'templates', 'ios'), share_dir)
plugins, replacements = list_gstreamer_1_0_plugins_by_category(self.config)
decls = []
regs = []
categories = ''
for c, ps in plugins.iteritems():
c = c.upper()
define = DEFINE_TPL % c
# By default enable only the core plugins
if c != 'CORE':
define = '//%s' % define
categories += define
for p in ps:
if p in replacements:
p = replacements[p]
p_up = p.upper()
decls.append(DEFINES_TPL % (p_up, c, DECLARE_PLUGIN_TPL % p))
regs.append(DEFINES_TPL % (p_up, c, REGISTER_PLUGIN_TPL % p))
tpl_dir = os.path.join(share_dir, 'GStreamer Base.xctemplate')
iosinit_m = os.path.join(tpl_dir, 'gst_ios_init.m')
iosinit_h = os.path.join(tpl_dir, 'gst_ios_init.h')
shell.replace (iosinit_h, {'@GST_IOS_PLUGINS_CATEGORIES@': categories})
shell.replace (iosinit_m, {
'@GST_IOS_PLUGINS_DECLARE@': '\n'.join(decls),
'@GST_IOS_PLUGINS_REGISTER@': '\n'.join(regs)})
|