summaryrefslogtreecommitdiff
path: root/recipes/gst-android.recipe
blob: e543186710d01940e7f31c241e5141f418d1d1b2 (plain)
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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import os
import shutil
from cerbero.utils import shell
from custom import list_gstreamer_plugins_by_category

class Recipe(recipe.Recipe):
    name = 'gst-android'
    version = '0.1'
    licenses = [License.LGPLv2_1]
    stype = SourceType.CUSTOM
    btype = BuildType.CUSTOM

    files_devel = [
            'share/gst-android/ndk-build/gstreamer_android.c.in',
            'share/gst-android/ndk-build/gstreamer.mk',
            'share/gst-android/ndk-build/gstreamer_prebuilt.mk',
            'share/gst-android/ndk-build/tools.mk',
            'share/gst-android/ndk-build/plugins.mk',
            'share/gst-android/ndk-build/GStreamer.java',
            'share/gst-android/ndk-build/tools',
            'share/gst-android/ndk-build/fontconfig',
            ]

    def install(self):
        ndk_build_dir_dst = os.path.join(self.config.prefix, 'share', 'gst-android', 'ndk-build')
        if not os.path.exists(ndk_build_dir_dst):
            os.makedirs(ndk_build_dir_dst)
        ndk_build_dir_src = os.path.join(self.config.data_dir, 'ndk-build')
        for f in self.files_devel:
            fname = os.path.basename(f)
            s = os.path.join(ndk_build_dir_src, fname)
            d = os.path.join(ndk_build_dir_dst, fname)
            if os.path.isfile(s):
                shutil.copy(s, d)
            else:
                shell.copy_dir(s, d)

        plugins, replacements = list_gstreamer_plugins_by_category(self.config)
        f = open(os.path.join(ndk_build_dir_dst, 'plugins.mk'), 'w')
        for c, p in plugins.iteritems():
            p = ' '.join(p)
            for k,v in replacements.iteritems():
                p = p.replace(k, v)
            f.write('GSTREAMER_PLUGINS_%s := %s\n' % (c.upper(), p))
        f.close()