summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2013-05-11 04:37:06 (GMT)
committerAndoni Morales Alastruey <ylatuya@gmail.com>2013-05-11 04:44:45 (GMT)
commitbcb40fe1db0b31cbbc74e9279e78864ffb127718 (patch)
treef4a35ff6ac576b2ca7bc8fc47ddca14a7c237775
parente323376cdd90f067de96684f9e0e3134a336b6f7 (diff)
downloadcerbero-bcb40fe1db0b31cbbc74e9279e78864ffb127718.tar.gz
cerbero-bcb40fe1db0b31cbbc74e9279e78864ffb127718.tar.xz
xcode: simplify gstreamer initialization
-rw-r--r--data/xcode/templates/ios/GStreamer Base.xctemplate/TemplateInfo.plist28
-rw-r--r--data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_backend.c27
-rw-r--r--data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_backend.h26
-rw-r--r--data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.c11
-rw-r--r--data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.h14
-rw-r--r--data/xcode/templates/ios/GStreamer Base.xctemplate/main.m4
-rw-r--r--recipes/gstreamer-ios-templates.recipe34
7 files changed, 43 insertions, 101 deletions
diff --git a/data/xcode/templates/ios/GStreamer Base.xctemplate/TemplateInfo.plist b/data/xcode/templates/ios/GStreamer Base.xctemplate/TemplateInfo.plist
index 110ef5d..30eff85 100644
--- a/data/xcode/templates/ios/GStreamer Base.xctemplate/TemplateInfo.plist
+++ b/data/xcode/templates/ios/GStreamer Base.xctemplate/TemplateInfo.plist
@@ -9,33 +9,19 @@
<key>Definitions</key>
<dict>
- <key>gst_ios_backend.c</key>
+ <key>gst_ios_init.c</key>
<dict>
<key>Group</key>
<string>Supporting Files</string>
<key>Path</key>
- <string>gst_ios_backend.c</string>
+ <string>gst_ios_init.c</string>
</dict>
- <key>gst_ios_backend.h</key>
+ <key>gst_ios_init.h</key>
<dict>
<key>Group</key>
<string>Supporting Files</string>
<key>Path</key>
- <string>gst_ios_backend.h</string>
- </dict>
- <key>gst_ios_plugins.h</key>
- <dict>
- <key>Group</key>
- <string>Supporting Files</string>
- <key>Path</key>
- <string>gst_ios_plugins.h</string>
- </dict>
- <key>gst_ios_plugins.c</key>
- <dict>
- <key>Group</key>
- <string>Supporting Files</string>
- <key>Path</key>
- <string>gst_ios_plugins.c</string>
+ <string>gst_ios_init.h</string>
</dict>
<key>main.m</key>
<dict>
@@ -50,10 +36,8 @@
<!-- Nodes Begin -->
<key>Nodes</key>
<array>
- <string>gst_ios_backend.c</string>
- <string>gst_ios_backend.h</string>
- <string>gst_ios_plugins.c</string>
- <string>gst_ios_plugins.h</string>
+ <string>gst_ios_init.c</string>
+ <string>gst_ios_init.h</string>
<string>main.m</string>
</array>
<!-- Nodes End -->
diff --git a/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_backend.c b/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_backend.c
deleted file mode 100644
index 6e865b2..0000000
--- a/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_backend.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2013 Fluendo S.L <support@fluendo.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "gst_ios_backend.h"
-#include "gst_ios_plugins.h"
-
-void
-gst_backend_init (void)
-{
- gst_init (NULL, NULL);
- gst_backend_register_plugins ();
-}
diff --git a/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_backend.h b/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_backend.h
deleted file mode 100644
index b79134f..0000000
--- a/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_backend.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2013 Fluendo S.L <support@fluendo.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __GST_IOS_BACKEND_H__
-#define __GST_IOS_BACKEND_H__
-
-#include <gst/gst.h>
-
-void gst_backend_init ();
-
-#endif
diff --git a/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.c b/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.c
new file mode 100644
index 0000000..fd9a977
--- /dev/null
+++ b/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.c
@@ -0,0 +1,11 @@
+#include "gst_ios_init.h"
+
+@GST_IOS_PLUGINS_DECLARE@
+
+void
+gst_ios_init (void)
+{
+ gst_init (NULL, NULL);
+
+ @GST_IOS_PLUGINS_REGISTER@
+}
diff --git a/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.h b/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.h
new file mode 100644
index 0000000..4a1fa52
--- /dev/null
+++ b/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_init.h
@@ -0,0 +1,14 @@
+#ifndef __GST_IOS_INIT_H__
+#define __GST_IOS_INIT_H__
+
+#include <gst/gst.h>
+
+/* Uncomment each line to enable the plugin categories that your application needs.
+ * You can also enable individual plugins. See gst_ios_init.c to see their names
+ **/
+
+@GST_IOS_PLUGINS_CATEGORIES@
+
+void gst_ios_init ();
+
+#endif
diff --git a/data/xcode/templates/ios/GStreamer Base.xctemplate/main.m b/data/xcode/templates/ios/GStreamer Base.xctemplate/main.m
index 05c328c..3ca3507 100644
--- a/data/xcode/templates/ios/GStreamer Base.xctemplate/main.m
+++ b/data/xcode/templates/ios/GStreamer Base.xctemplate/main.m
@@ -2,12 +2,12 @@
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
-#include "gst_ios_backend.h"
+#include "gst_ios_init.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
- gst_backend_init();
+ gst_ios_init();
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
diff --git a/recipes/gstreamer-ios-templates.recipe b/recipes/gstreamer-ios-templates.recipe
index 576fa0d..8b10997 100644
--- a/recipes/gstreamer-ios-templates.recipe
+++ b/recipes/gstreamer-ios-templates.recipe
@@ -6,25 +6,10 @@ from custom import list_gstreamer_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'
-REGISTER_TPL = 'void gst_backend_register_plugins (void);'
DEFINES_TPL = '''\
#if defined(GST_IOS_PLUGIN_%s) || defined(GST_IOS_PLUGINS_%s)
%s
#endif'''
-GST_IOS_PLUGINS_C_TPL = '''
-
-#include <gst/gst.h>
-#include "gst_ios_plugins.h"
-
-%s
-
-void
-gst_backend_register_plugins (void)
-{
-%s
-}
-'''
-
class Recipe(recipe.Recipe):
name = 'gstreamer-ios-templates'
@@ -44,26 +29,27 @@ class Recipe(recipe.Recipe):
'templates', 'ios'), share_dir)
plugins, replacements = list_gstreamer_plugins_by_category(self.config)
- plugins_h = open(os.path.join(share_dir, 'GStreamer Base.xctemplate',
- 'gst_ios_plugins.h'), 'w')
+
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
- plugins_h.write(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))
- plugins_h.write(REGISTER_TPL)
- plugins_h.close()
- plugins_c = open(os.path.join(share_dir, 'GStreamer Base.xctemplate',
- 'gst_ios_plugins.c'), 'w')
- plugins_c.write(GST_IOS_PLUGINS_C_TPL % ('\n'.join(decls), '\n'.join(regs)))
- plugins_c.close()
+ tpl_dir = os.path.join(share_dir, 'GStreamer Base.xctemplate')
+ iosinit_c = os.path.join(tpl_dir, 'gst_ios_init.c')
+ iosinit_h = os.path.join(tpl_dir, 'gst_ios_init.h')
+ shell.replace (iosinit_h, {'@GST_IOS_PLUGINS_CATEGORIES@': categories})
+ shell.replace (iosinit_c, {
+ '@GST_IOS_PLUGINS_DECLARE@': '\n'.join(decls),
+ '@GST_IOS_PLUGINS_REGISTER@': '\n'.join(regs)})