diff options
author | Andoni Morales Alastruey <ylatuya@gmail.com> | 2013-03-18 12:38:55 +0100 |
---|---|---|
committer | Andoni Morales Alastruey <ylatuya@gmail.com> | 2013-03-25 11:28:01 +0100 |
commit | fdf2198753209c66b4cbeaea87a02f373639e7c6 (patch) | |
tree | d8b46010c13874d8c7b4c62c35c8c3bdc026659c | |
parent | e9435f5333ce3c4089b6bc350194e50ebb99add3 (diff) |
gst-ios: generate the XCode templates for iOS
10 files changed, 349 insertions, 0 deletions
diff --git a/data/xcode/templates/ios/GStreamer Base.xctemplate/TemplateInfo.plist b/data/xcode/templates/ios/GStreamer Base.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..2917c0d --- /dev/null +++ b/data/xcode/templates/ios/GStreamer Base.xctemplate/TemplateInfo.plist @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Identifier</key> + <string>com.gstreamersdk.ios.templates.base</string> + <key>Kind</key> + <string>Xcode.Xcode3.ProjectTemplateUnitKind</string> + +<key>Definitions</key> + <dict> + <key>gst_ios_backend.c</key> + <dict> + <key>Group</key> + <string>Supporting Files</string> + <key>Path</key> + <string>gst_ios_backend.c</string> + </dict> + <key>gst_ios_backend.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> + </dict> + </dict> +<!-- Definitions End --> + +<!-- 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> + </array> +<!-- Nodes End --> + +<key>Targets</key> + <array> + <dict> + <key>Frameworks</key> + <array> + <string>GStreamer</string> + <string>CoreAudio</string> + </array> + <key>SharedSettings</key> + <dict> + <key>FRAMEWORK_SEARCH_PATHS</key> + <string>"~/Library/Developer/GStreamer/iPhone.sdk"</string> + <key>HEADER_SEARCH_PATHS</key> + <string>"~/Library/Developer/GStreamer/iPhone.sdk/GStreamer.framework/Headers"</string> + </dict> + </dict> + </array> +</dict> +</plist> 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 new file mode 100644 index 0000000..6e865b2 --- /dev/null +++ b/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_backend.c @@ -0,0 +1,27 @@ +/* + * 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 new file mode 100644 index 0000000..b79134f --- /dev/null +++ b/data/xcode/templates/ios/GStreamer Base.xctemplate/gst_ios_backend.h @@ -0,0 +1,26 @@ +/* + * 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 Empty Application.xctemplate/TemplateInfo.plist b/data/xcode/templates/ios/GStreamer Empty Application.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..bc10a1d --- /dev/null +++ b/data/xcode/templates/ios/GStreamer Empty Application.xctemplate/TemplateInfo.plist @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Ancestors</key> + <array> + <string>com.apple.dt.unit.emptyApplication</string> + <string>com.gstreamersdk.ios.templates.base</string> + </array> + + <key>Concrete</key> + <true/> + <key>Description</key> + <string>This template provides a starting point for any application. It provides just an application delegate and a window.</string> + <key>Identifier</key> + <string>com.gstreamersdk.io.templates.emptyApplication</string> + <key>Kind</key> + <string>Xcode.Xcode3.ProjectTemplateUnitKind</string> + <key>SortOrder</key> + <integer>1</integer> +</dict> + +</plist> diff --git a/data/xcode/templates/ios/GStreamer Master-Detail Application.xctemplate/TemplateInfo.plist b/data/xcode/templates/ios/GStreamer Master-Detail Application.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..7d31b3f --- /dev/null +++ b/data/xcode/templates/ios/GStreamer Master-Detail Application.xctemplate/TemplateInfo.plist @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Ancestors</key> + <array> + <string>com.apple.dt.unit.masterDetailApplication</string> + <string>com.gstreamersdk.ios.templates.base</string> + </array> + + <key>Concrete</key> + <true/> + <key>Description</key> + <string>This template provides a starting point for a master-detail application. It provides a user interface configured with a navigation controller to display a list of items and also a split view on iPad.</string> + <key>Identifier</key> + <string>com.gstreamersdk.io.templates.masterDetailApplication</string> + <key>Kind</key> + <string>Xcode.Xcode3.ProjectTemplateUnitKind</string> + <key>SortOrder</key> + <integer>1</integer> +</dict> + +</plist> diff --git a/data/xcode/templates/ios/GStreamer Page-Based Application.xctemplate/TemplateInfo.plist b/data/xcode/templates/ios/GStreamer Page-Based Application.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..ef3cfaa --- /dev/null +++ b/data/xcode/templates/ios/GStreamer Page-Based Application.xctemplate/TemplateInfo.plist @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Ancestors</key> + <array> + <string>com.apple.dt.unit.pageBasedApplication</string> + <string>com.gstreamersdk.ios.templates.base</string> + </array> + + <key>Concrete</key> + <true/> + <key>Description</key> + <string>This template provides a starting point for a page-based application that uses a page view controller. </string> + <key>Identifier</key> + <string>com.gstreamersdk.io.templates.pageBasedApplication</string> + <key>Kind</key> + <string>Xcode.Xcode3.ProjectTemplateUnitKind</string> + <key>SortOrder</key> + <integer>1</integer> +</dict> + +</plist> diff --git a/data/xcode/templates/ios/GStreamer Single View Application.xctemplate/TemplateInfo.plist b/data/xcode/templates/ios/GStreamer Single View Application.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..64f2f4a --- /dev/null +++ b/data/xcode/templates/ios/GStreamer Single View Application.xctemplate/TemplateInfo.plist @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Ancestors</key> + <array> + <string>com.apple.dt.unit.singleViewApplication</string> + <string>com.gstreamersdk.ios.templates.base</string> + </array> + + <key>Concrete</key> + <true/> + <key>Description</key> + <string>This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view, and a storyboard or nib file that contains the view.</string> + <key>Identifier</key> + <string>com.gstreamersdk.io.templates.singleViewApplication</string> + <key>Kind</key> + <string>Xcode.Xcode3.ProjectTemplateUnitKind</string> + <key>SortOrder</key> + <integer>1</integer> +</dict> + +</plist> diff --git a/data/xcode/templates/ios/GStreamer Tabbed Application.xctemplate/TemplateInfo.plist b/data/xcode/templates/ios/GStreamer Tabbed Application.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..bb770a9 --- /dev/null +++ b/data/xcode/templates/ios/GStreamer Tabbed Application.xctemplate/TemplateInfo.plist @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Ancestors</key> + <array> + <string>com.apple.dt.unit.tabbedApplication</string> + <string>com.gstreamersdk.ios.templates.base</string> + </array> + + <key>Concrete</key> + <true/> + <key>Description</key> + <string>This template provides a starting point for an application that uses a tab bar. It provides a user interface configured with a tab bar controller, and view controllers for the tab bar items.</string> + <key>Identifier</key> + <string>com.gstreamersdk.io.templates.tabbedApplication</string> + <key>Kind</key> + <string>Xcode.Xcode3.ProjectTemplateUnitKind</string> + <key>SortOrder</key> + <integer>1</integer> +</dict> + +</plist> diff --git a/data/xcode/templates/ios/GStreamer Utility Application.xctemplate/TemplateInfo.plist b/data/xcode/templates/ios/GStreamer Utility Application.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..afe7d14 --- /dev/null +++ b/data/xcode/templates/ios/GStreamer Utility Application.xctemplate/TemplateInfo.plist @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Ancestors</key> + <array> + <string>com.apple.dt.unit.utilityApplication</string> + <string>com.gstreamersdk.ios.templates.base</string> + </array> + + <key>Concrete</key> + <true/> + <key>Description</key> + <string>This template provides a starting point for a utility application that has a main view and an alternate view. For iPhone, it sets up an Info button to flip the main view to the alternate view. For iPad, it sets up an Info bar button that shows the alternate view in a popover.</string> + <key>Identifier</key> + <string>com.gstreamersdk.io.templates.utilityApplication</string> + <key>Kind</key> + <string>Xcode.Xcode3.ProjectTemplateUnitKind</string> + <key>SortOrder</key> + <integer>1</integer> +</dict> + +</plist> diff --git a/recipes/gst-ios.recipe b/recipes/gst-ios.recipe new file mode 100644 index 0000000..4beee64 --- /dev/null +++ b/recipes/gst-ios.recipe @@ -0,0 +1,87 @@ +# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python +from collections import defaultdict +from cerbero.build.cookbook import CookBook +from cerbero.utils import shell + +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 = ''' + +%s + +void +gst_backend_register_plugins (void) +{ +%s +} +''' + + +class Recipe(recipe.Recipe): + name = 'gst-ios' + 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) + + # Create a plugins.mk file with lists of plugins grouped by categories + cookbook = CookBook(self.config) + # For plugins named differently + replacements = {'decodebin2': 'uridecodebin', 'playbin': 'playback', + 'encodebin': 'encoding', 'souphttpsrc': 'soup', + 'siren': 'gstsiren', 'sdpelem': 'sdp', + 'rtpmanager': 'gstrtpmanager', 'scaletempoplugin' : 'scaletempo', + 'mpegdemux': 'mpegdemux2', 'rmdemux': 'realmedia'} + plugins = defaultdict(list) + for r in ['gstreamer', 'gst-plugins-base', 'gst-plugins-good', + 'gst-plugins-bad', 'gst-plugins-ugly', 'gst-ffmpeg']: + r = cookbook.get_recipe(r) + for attr_name in dir(r): + if attr_name.startswith('files_plugins_'): + cat_name = attr_name[len('files_plugins_'):] + plugins_list = getattr(r, attr_name) + elif attr_name.startswith('platform_files_plugins_'): + cat_name = attr_name[len('platform_files_plugins_'):] + plugins_dict = getattr(r, attr_name) + plugins_list = plugins_dict.get(self.config.target_platform, []) + else: + continue + for e in plugins_list: + if not e.startswith('lib/gstreamer-'): + continue + plugins[cat_name].append(e[25:-8]) + plugins_h = open(os.path.join(share_dir, 'GStreamer Base.xctemplate', + 'gst_ios_plugins.h'), 'w') + decls = [] + regs = [] + for c, ps in plugins.iteritems(): + c = c.upper() + plugins_h.write(DEFINE_TPL % c) + for p in ps: + if p in replacements: + p = replacements[p] + p = p.upper() + decls.append(DEFINES_TPL % (p, c, DECLARE_PLUGIN_TPL % p)) + regs.append(DEFINES_TPL % (p, 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() |