From d6ae3e54267168d33d8ecbb863af1bf6b400ed2a Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Tue, 15 Jun 2004 14:17:55 +0000 Subject: [PATCH] tools/gst-inspect.c (main): Fallback to plugin if no element is found. This matches the old behavior better. Thanks t... Original commit message from CVS: * tools/gst-inspect.c (main): Fallback to plugin if no element is found. This matches the old behavior better. Thanks to Thomas for pointing out. --- ChangeLog | 6 ++++++ tools/gst-inspect.c | 50 ++++++++++++++++++-------------------------------- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index d137702..95d2468 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-06-15 Johan Dahlin + + * tools/gst-inspect.c (main): Fallback to plugin if no element is + found. This matches the old behavior better. Thanks to Thomas for + pointing out. + 2004-06-14 David Schleef * gst/gstcpu.c: (gst_cpuid_i386): Fix problem when using diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 3ac773f..e2134b0 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -1109,9 +1109,6 @@ print_element_info (GstElementFactory * factory, gboolean print_names) int main (int argc, char *argv[]) { - GstElementFactory *factory; - GstPlugin *plugin; - gchar *so; gboolean print_all = FALSE; struct poptOption options[] = { {"print-all", 'a', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &print_all, 0, @@ -1138,41 +1135,30 @@ main (int argc, char *argv[]) print_element_list (print_all); /* else we try to get a factory */ } else { + GstElementFactory *factory; + GstPlugin *plugin; const char *arg = argv[argc - 1]; + int retval; - /* only search for a factory if there's not a '.so' */ - if (!strstr (argv[1], ".so")) { - int retval; - - factory = gst_element_factory_find (arg); - /* if there's a factory, print out the info */ - if (factory) { - retval = print_element_info (factory, print_all); - } else { - retval = print_element_features (arg); - } - - if (retval) - g_print ("No such element: '%s'\n", arg); - - return retval; + factory = gst_element_factory_find (arg); + /* if there's a factory, print out the info */ + if (factory) { + retval = print_element_info (factory, print_all); } else { - /* strip the .so */ - so = strstr (argv[argc - 1], ".so"); - so[0] = '\0'; + retval = print_element_features (arg); } - /* otherwise assume it's a plugin */ - plugin = gst_registry_pool_find_plugin (arg); + /* otherwise check if it's a plugin */ + if (retval) { + plugin = gst_registry_pool_find_plugin (arg); - /* if there is such a plugin, print out info */ - - if (plugin) { - print_plugin_info (plugin); - - } else { - g_print ("No such plugin '%s'\n", arg); - return -1; + /* if there is such a plugin, print out info */ + if (plugin) { + print_plugin_info (plugin); + } else { + g_print ("No such element or plugin '%s'\n", arg); + return -1; + } } } -- 2.7.4