mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
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:
parent
991e42bc4b
commit
4ef87d3c5d
1 changed files with 24 additions and 5 deletions
29
gst/gst.c
29
gst/gst.c
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue