From 4bd417f3398d2647b9a7598631e21065685e9463 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Mon, 13 May 2013 10:36:29 +0200 Subject: [PATCH] Adapt tutorial code to new xcode ios templates --- .../xcode iOS/Tutorial 1/gst_ios_init.c | 15 ++++++++++++++- .../xcode iOS/Tutorial 1/gst_ios_init.h | 5 +++++ .../xcode iOS/Tutorial 2/gst_ios_init.c | 17 ++++++++++++++--- .../xcode iOS/Tutorial 2/gst_ios_init.h | 5 +++++ .../xcode iOS/Tutorial 3/gst_ios_init.c | 17 ++++++++++++++--- .../xcode iOS/Tutorial 3/gst_ios_init.h | 5 +++++ .../xcode iOS/Tutorial 4/gst_ios_init.c | 17 ++++++++++++++--- .../xcode iOS/Tutorial 4/gst_ios_init.h | 5 +++++ 8 files changed, 76 insertions(+), 10 deletions(-) diff --git a/gst-sdk/tutorials/xcode iOS/Tutorial 1/gst_ios_init.c b/gst-sdk/tutorials/xcode iOS/Tutorial 1/gst_ios_init.c index 9ece9ab027..e60564a570 100644 --- a/gst-sdk/tutorials/xcode iOS/Tutorial 1/gst_ios_init.c +++ b/gst-sdk/tutorials/xcode iOS/Tutorial 1/gst_ios_init.c @@ -496,7 +496,10 @@ GST_PLUGIN_STATIC_DECLARE(sdp); void gst_ios_init (void) { - gst_init (NULL, NULL); + GstPluginFeature *plugin; + GstRegistry *reg; + + gst_init (NULL, NULL); #if defined(GST_IOS_PLUGIN_COREELEMENTS) || defined(GST_IOS_PLUGINS_CORE) GST_PLUGIN_STATIC_REGISTER(coreelements); @@ -990,4 +993,14 @@ gst_ios_init (void) #if defined(GST_IOS_PLUGIN_SDP) || defined(GST_IOS_PLUGINS_NET) GST_PLUGIN_STATIC_REGISTER(sdp); #endif + + /* Lower the ranks of filesrc and giosrc so iosavassetsrc is + * tried first in gst_element_make_from_uri() for file:// */ + reg = gst_registry_get_default(); + plugin = gst_registry_lookup_feature(reg, "filesrc"); + if (plugin) + gst_plugin_feature_set_rank(plugin, GST_RANK_SECONDARY); + plugin = gst_registry_lookup_feature(reg, "giosrc"); + if (plugin) + gst_plugin_feature_set_rank(plugin, GST_RANK_SECONDARY-1); } diff --git a/gst-sdk/tutorials/xcode iOS/Tutorial 1/gst_ios_init.h b/gst-sdk/tutorials/xcode iOS/Tutorial 1/gst_ios_init.h index ce2fef0265..b47fa662b4 100644 --- a/gst-sdk/tutorials/xcode iOS/Tutorial 1/gst_ios_init.h +++ b/gst-sdk/tutorials/xcode iOS/Tutorial 1/gst_ios_init.h @@ -3,9 +3,12 @@ #include +G_BEGIN_DECLS + /* 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 */ + #define GST_IOS_PLUGINS_CORE //#define GST_IOS_PLUGINS_CAPTURE //#define GST_IOS_PLUGINS_CODECS_RESTRICTED @@ -22,4 +25,6 @@ void gst_ios_init (); +G_END_DECLS + #endif diff --git a/gst-sdk/tutorials/xcode iOS/Tutorial 2/gst_ios_init.c b/gst-sdk/tutorials/xcode iOS/Tutorial 2/gst_ios_init.c index cffa57e65c..e60564a570 100644 --- a/gst-sdk/tutorials/xcode iOS/Tutorial 2/gst_ios_init.c +++ b/gst-sdk/tutorials/xcode iOS/Tutorial 2/gst_ios_init.c @@ -496,9 +496,10 @@ GST_PLUGIN_STATIC_DECLARE(sdp); void gst_ios_init (void) { - gst_init (NULL, NULL); - gst_debug_set_colored(FALSE); - gst_debug_set_default_threshold(GST_LEVEL_WARNING); + GstPluginFeature *plugin; + GstRegistry *reg; + + gst_init (NULL, NULL); #if defined(GST_IOS_PLUGIN_COREELEMENTS) || defined(GST_IOS_PLUGINS_CORE) GST_PLUGIN_STATIC_REGISTER(coreelements); @@ -992,4 +993,14 @@ gst_ios_init (void) #if defined(GST_IOS_PLUGIN_SDP) || defined(GST_IOS_PLUGINS_NET) GST_PLUGIN_STATIC_REGISTER(sdp); #endif + + /* Lower the ranks of filesrc and giosrc so iosavassetsrc is + * tried first in gst_element_make_from_uri() for file:// */ + reg = gst_registry_get_default(); + plugin = gst_registry_lookup_feature(reg, "filesrc"); + if (plugin) + gst_plugin_feature_set_rank(plugin, GST_RANK_SECONDARY); + plugin = gst_registry_lookup_feature(reg, "giosrc"); + if (plugin) + gst_plugin_feature_set_rank(plugin, GST_RANK_SECONDARY-1); } diff --git a/gst-sdk/tutorials/xcode iOS/Tutorial 2/gst_ios_init.h b/gst-sdk/tutorials/xcode iOS/Tutorial 2/gst_ios_init.h index 7b8e0133d7..eefb1947f2 100644 --- a/gst-sdk/tutorials/xcode iOS/Tutorial 2/gst_ios_init.h +++ b/gst-sdk/tutorials/xcode iOS/Tutorial 2/gst_ios_init.h @@ -3,9 +3,12 @@ #include +G_BEGIN_DECLS + /* 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 */ + #define GST_IOS_PLUGINS_CORE //#define GST_IOS_PLUGINS_CAPTURE //#define GST_IOS_PLUGINS_CODECS_RESTRICTED @@ -22,4 +25,6 @@ void gst_ios_init (); +G_END_DECLS + #endif diff --git a/gst-sdk/tutorials/xcode iOS/Tutorial 3/gst_ios_init.c b/gst-sdk/tutorials/xcode iOS/Tutorial 3/gst_ios_init.c index cffa57e65c..e60564a570 100644 --- a/gst-sdk/tutorials/xcode iOS/Tutorial 3/gst_ios_init.c +++ b/gst-sdk/tutorials/xcode iOS/Tutorial 3/gst_ios_init.c @@ -496,9 +496,10 @@ GST_PLUGIN_STATIC_DECLARE(sdp); void gst_ios_init (void) { - gst_init (NULL, NULL); - gst_debug_set_colored(FALSE); - gst_debug_set_default_threshold(GST_LEVEL_WARNING); + GstPluginFeature *plugin; + GstRegistry *reg; + + gst_init (NULL, NULL); #if defined(GST_IOS_PLUGIN_COREELEMENTS) || defined(GST_IOS_PLUGINS_CORE) GST_PLUGIN_STATIC_REGISTER(coreelements); @@ -992,4 +993,14 @@ gst_ios_init (void) #if defined(GST_IOS_PLUGIN_SDP) || defined(GST_IOS_PLUGINS_NET) GST_PLUGIN_STATIC_REGISTER(sdp); #endif + + /* Lower the ranks of filesrc and giosrc so iosavassetsrc is + * tried first in gst_element_make_from_uri() for file:// */ + reg = gst_registry_get_default(); + plugin = gst_registry_lookup_feature(reg, "filesrc"); + if (plugin) + gst_plugin_feature_set_rank(plugin, GST_RANK_SECONDARY); + plugin = gst_registry_lookup_feature(reg, "giosrc"); + if (plugin) + gst_plugin_feature_set_rank(plugin, GST_RANK_SECONDARY-1); } diff --git a/gst-sdk/tutorials/xcode iOS/Tutorial 3/gst_ios_init.h b/gst-sdk/tutorials/xcode iOS/Tutorial 3/gst_ios_init.h index d60c3377bc..3e3406ef56 100644 --- a/gst-sdk/tutorials/xcode iOS/Tutorial 3/gst_ios_init.h +++ b/gst-sdk/tutorials/xcode iOS/Tutorial 3/gst_ios_init.h @@ -3,9 +3,12 @@ #include +G_BEGIN_DECLS + /* 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 */ + #define GST_IOS_PLUGINS_CORE //#define GST_IOS_PLUGINS_CAPTURE //#define GST_IOS_PLUGINS_CODECS_RESTRICTED @@ -22,4 +25,6 @@ void gst_ios_init (); +G_END_DECLS + #endif diff --git a/gst-sdk/tutorials/xcode iOS/Tutorial 4/gst_ios_init.c b/gst-sdk/tutorials/xcode iOS/Tutorial 4/gst_ios_init.c index cffa57e65c..e60564a570 100644 --- a/gst-sdk/tutorials/xcode iOS/Tutorial 4/gst_ios_init.c +++ b/gst-sdk/tutorials/xcode iOS/Tutorial 4/gst_ios_init.c @@ -496,9 +496,10 @@ GST_PLUGIN_STATIC_DECLARE(sdp); void gst_ios_init (void) { - gst_init (NULL, NULL); - gst_debug_set_colored(FALSE); - gst_debug_set_default_threshold(GST_LEVEL_WARNING); + GstPluginFeature *plugin; + GstRegistry *reg; + + gst_init (NULL, NULL); #if defined(GST_IOS_PLUGIN_COREELEMENTS) || defined(GST_IOS_PLUGINS_CORE) GST_PLUGIN_STATIC_REGISTER(coreelements); @@ -992,4 +993,14 @@ gst_ios_init (void) #if defined(GST_IOS_PLUGIN_SDP) || defined(GST_IOS_PLUGINS_NET) GST_PLUGIN_STATIC_REGISTER(sdp); #endif + + /* Lower the ranks of filesrc and giosrc so iosavassetsrc is + * tried first in gst_element_make_from_uri() for file:// */ + reg = gst_registry_get_default(); + plugin = gst_registry_lookup_feature(reg, "filesrc"); + if (plugin) + gst_plugin_feature_set_rank(plugin, GST_RANK_SECONDARY); + plugin = gst_registry_lookup_feature(reg, "giosrc"); + if (plugin) + gst_plugin_feature_set_rank(plugin, GST_RANK_SECONDARY-1); } diff --git a/gst-sdk/tutorials/xcode iOS/Tutorial 4/gst_ios_init.h b/gst-sdk/tutorials/xcode iOS/Tutorial 4/gst_ios_init.h index d60c3377bc..3e3406ef56 100644 --- a/gst-sdk/tutorials/xcode iOS/Tutorial 4/gst_ios_init.h +++ b/gst-sdk/tutorials/xcode iOS/Tutorial 4/gst_ios_init.h @@ -3,9 +3,12 @@ #include +G_BEGIN_DECLS + /* 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 */ + #define GST_IOS_PLUGINS_CORE //#define GST_IOS_PLUGINS_CAPTURE //#define GST_IOS_PLUGINS_CODECS_RESTRICTED @@ -22,4 +25,6 @@ void gst_ios_init (); +G_END_DECLS + #endif