From b748b61e9fb4feaff12c2404d43d4364efcd1df1 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Thu, 10 Jun 2004 11:23:42 +0000 Subject: [PATCH] gst/gst.c (gst_init_check_with_popt_table): Do not fail on errors, like gtk. It makes it more useful in bindings. Original commit message from CVS: * gst/gst.c (gst_init_check_with_popt_table): Do not fail on errors, like gtk. It makes it more useful in bindings. --- ChangeLog | 5 +++++ gst/gst.c | 27 +++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5ecdbc692..7f624d23a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-06-10 Johan Dahlin + + * gst/gst.c (gst_init_check_with_popt_table): Do not fail on + errors, like gtk. It makes it more useful in bindings. + 2004-06-09 Thomas Vander Stichele * docs/random/gdp: diff --git a/gst/gst.c b/gst/gst.c index 20f308983c..16e99ae7d9 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -363,19 +363,21 @@ gst_init_check_with_popt_table (int *argc, char **argv[], if (gst_debug_env) parse_debug_list (gst_debug_env); - while ((nextopt = poptGetNextOpt (context)) > 0) { - /* we only check for failures here, actual work is done in callbacks */ - if (_gst_initialization_failure) + /* Scan until we reach the end (-1), ignoring errors */ + while ((nextopt = poptGetNextOpt (context)) != -1) { + + /* If an error occurred and it's not an missing options, throw an error + * We don't want to show the "unknown option" message, since it'll + * might interfere with the applications own command line parsing + */ + if (nextopt < 0 && nextopt != POPT_ERROR_BADOPT) { + g_print ("Error on option %s: %s.\nRun '%s --help' " + "to see a full list of available command line options.\n", + poptBadOption (context, 0), poptStrerror (nextopt), (*argv)[0]); + + poptFreeContext (context); return FALSE; - } - - if (nextopt != -1) { - g_print ("Error on option %s: %s.\nRun '%s --help' " - "to see a full list of available command line options.\n", - poptBadOption (context, 0), poptStrerror (nextopt), (*argv)[0]); - - poptFreeContext (context); - return FALSE; + } } *argc = poptStrippedArgv (context, *argc, *argv); @@ -621,6 +623,7 @@ init_post (void) gst_registry_pool_add (_global_registry, 100); gst_registry_pool_add (_user_registry, 50); } else { + gst_registry_pool_add (_global_registry, 100); }