allow gst_init(NULL, NULL) to work this fix was prompted by testsuite/test_gst_init.c, which thomasvs was running on ...

Original commit message from CVS:
allow gst_init(NULL, NULL) to work
this fix was prompted by testsuite/test_gst_init.c, which thomasvs was running
on the autobuilder. they are good after all :)
This commit is contained in:
Andy Wingo 2002-02-16 18:27:04 +00:00
parent 991e42bc4b
commit 4ef87d3c5d

View file

@ -44,6 +44,9 @@ extern gboolean _gst_plugin_spew;
static void load_plugin_func (gpointer data, gpointer user_data);
static void init_popt_callback (poptContext context, enum poptCallbackReason reason,
const struct poptOption *option, const char *arg, void *data);
static void init_pre (void);
static void init_post (void);
static GSList *preload_plugins = NULL;
@ -116,9 +119,19 @@ gst_init (int *argc, char **argv[])
{
poptContext context;
gint nextopt, i, j, nstrip;
const struct poptOption *options = gst_init_get_popt_table ();
const struct poptOption *options;
gchar **temp;
if (!argc || !argv) {
if (argc || argv)
g_warning ("gst_init: Only one of arg or argv was NULL");
init_pre();
init_post();
return;
}
options = gst_init_get_popt_table ();
context = poptGetContext ("GStreamer", *argc, (const char**)*argv, options, 0);
while ((nextopt = poptGetNextOpt (context)) > 0); /* do nothing, it's all callbacks */
@ -210,6 +223,15 @@ split_and_iterate (const gchar *stringlist, gchar *separator, GFunc iterator)
}
}
static void
init_pre (void)
{
if (!g_thread_supported ())
g_thread_init (NULL);
g_type_init();
}
static void
init_post (void)
{
@ -324,10 +346,7 @@ init_popt_callback (poptContext context, enum poptCallbackReason reason,
switch (reason) {
case POPT_CALLBACK_REASON_PRE:
if (!g_thread_supported ())
g_thread_init (NULL);
g_type_init();
init_pre();
break;
case POPT_CALLBACK_REASON_OPTION:
switch (option->val) {