gst/gst.c: Add GST_DISABLE_OPTION_PARSING, in order to disable option parsing for embedded systems.

Original commit message from CVS:
* gst/gst.c:
Add GST_DISABLE_OPTION_PARSING, in order to disable option
parsing for embedded systems.
* gst/gstelementfactory.c:
Allow gst_element_register() to be called with plugin==NULL.
Did nobody notice that static elements were broken?
This commit is contained in:
David Schleef 2007-05-12 23:53:08 +00:00
parent 75cc705a1f
commit 7f9a26d71c
3 changed files with 34 additions and 2 deletions

View file

@ -1,3 +1,12 @@
2007-05-12 David Schleef <ds@schleef.org>
* gst/gst.c:
Add GST_DISABLE_OPTION_PARSING, in order to disable option
parsing for embedded systems.
* gst/gstelementfactory.c:
Allow gst_element_register() to be called with plugin==NULL.
Did nobody notice that static elements were broken?
2007-05-12 Wim Taymans <wim@fluendo.com> 2007-05-12 Wim Taymans <wim@fluendo.com>
* tools/gst-launch.c: (event_loop): * tools/gst-launch.c: (event_loop):

View file

@ -154,8 +154,10 @@ static gboolean init_pre (GOptionContext * context, GOptionGroup * group,
gpointer data, GError ** error); gpointer data, GError ** error);
static gboolean init_post (GOptionContext * context, GOptionGroup * group, static gboolean init_post (GOptionContext * context, GOptionGroup * group,
gpointer data, GError ** error); gpointer data, GError ** error);
#ifndef GST_DISABLE_OPTION_PARSING
static gboolean parse_goption_arg (const gchar * s_opt, static gboolean parse_goption_arg (const gchar * s_opt,
const gchar * arg, gpointer data, GError ** err); const gchar * arg, gpointer data, GError ** err);
#endif
static GSList *preload_plugins = NULL; static GSList *preload_plugins = NULL;
@ -292,6 +294,7 @@ parse_debug_list (const gchar * list)
GOptionGroup * GOptionGroup *
gst_init_get_option_group (void) gst_init_get_option_group (void)
{ {
#ifndef GST_DISABLE_OPTION_PARSING
GOptionGroup *group; GOptionGroup *group;
const static GOptionEntry gst_args[] = { const static GOptionEntry gst_args[] = {
{"gst-version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, {"gst-version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
@ -368,6 +371,9 @@ gst_init_get_option_group (void)
g_option_group_set_translation_domain (group, GETTEXT_PACKAGE); g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
return group; return group;
#else
return NULL;
#endif
} }
/** /**
@ -392,8 +398,10 @@ gst_init_get_option_group (void)
gboolean gboolean
gst_init_check (int *argc, char **argv[], GError ** err) gst_init_check (int *argc, char **argv[], GError ** err)
{ {
#ifndef GST_DISABLE_OPTION_PARSING
GOptionGroup *group; GOptionGroup *group;
GOptionContext *ctx; GOptionContext *ctx;
#endif
gboolean res; gboolean res;
if (!g_thread_supported ()) if (!g_thread_supported ())
@ -405,13 +413,18 @@ gst_init_check (int *argc, char **argv[], GError ** err)
GST_DEBUG ("already initialized gst"); GST_DEBUG ("already initialized gst");
return TRUE; return TRUE;
} }
#ifndef GST_DISABLE_OPTION_PARSING
ctx = g_option_context_new ("- GStreamer initialization"); ctx = g_option_context_new ("- GStreamer initialization");
g_option_context_set_ignore_unknown_options (ctx, TRUE); g_option_context_set_ignore_unknown_options (ctx, TRUE);
group = gst_init_get_option_group (); group = gst_init_get_option_group ();
g_option_context_add_group (ctx, group); g_option_context_add_group (ctx, group);
res = g_option_context_parse (ctx, argc, argv, err); res = g_option_context_parse (ctx, argc, argv, err);
g_option_context_free (ctx); g_option_context_free (ctx);
#else
init_pre (NULL, NULL, NULL, NULL);
init_post (NULL, NULL, NULL, NULL);
res = TRUE;
#endif
gst_initialized = res; gst_initialized = res;
@ -471,11 +484,13 @@ add_path_func (gpointer data, gpointer user_data)
} }
#endif #endif
#ifndef GST_DISABLE_OPTION_PARSING
static void static void
prepare_for_load_plugin_func (gpointer data, gpointer user_data) prepare_for_load_plugin_func (gpointer data, gpointer user_data)
{ {
preload_plugins = g_slist_prepend (preload_plugins, g_strdup (data)); preload_plugins = g_slist_prepend (preload_plugins, g_strdup (data));
} }
#endif
static void static void
load_plugin_func (gpointer data, gpointer user_data) load_plugin_func (gpointer data, gpointer user_data)
@ -503,6 +518,7 @@ load_plugin_func (gpointer data, gpointer user_data)
} }
} }
#ifndef GST_DISABLE_OPTION_PARSING
static void static void
split_and_iterate (const gchar * stringlist, gchar * separator, GFunc iterator, split_and_iterate (const gchar * stringlist, gchar * separator, GFunc iterator,
gpointer user_data) gpointer user_data)
@ -527,6 +543,7 @@ split_and_iterate (const gchar * stringlist, gchar * separator, GFunc iterator,
g_strfreev (strings); g_strfreev (strings);
} }
} }
#endif
/* we have no fail cases yet, but maybe in the future */ /* we have no fail cases yet, but maybe in the future */
static gboolean static gboolean
@ -1058,6 +1075,7 @@ gst_debug_help (void)
} }
#endif #endif
#ifndef GST_DISABLE_OPTION_PARSING
static gboolean static gboolean
parse_one_option (gint opt, const gchar * arg, GError ** err) parse_one_option (gint opt, const gchar * arg, GError ** err)
{ {
@ -1160,6 +1178,7 @@ parse_goption_arg (const gchar * opt,
return parse_one_option (val, arg, err); return parse_one_option (val, arg, err);
} }
#endif
extern GstRegistry *_gst_registry_default; extern GstRegistry *_gst_registry_default;

View file

@ -313,7 +313,11 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
} }
g_free (interfaces); g_free (interfaces);
GST_PLUGIN_FEATURE (factory)->plugin_name = g_strdup (plugin->desc.name); if (plugin && plugin->desc.name) {
GST_PLUGIN_FEATURE (factory)->plugin_name = g_strdup (plugin->desc.name);
} else {
GST_PLUGIN_FEATURE (factory)->plugin_name = g_strdup ("NULL");
}
gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank); gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank);
GST_PLUGIN_FEATURE (factory)->loaded = TRUE; GST_PLUGIN_FEATURE (factory)->loaded = TRUE;