From 35f4d52d7be77081995827fd66416ef9f9118355 Mon Sep 17 00:00:00 2001 From: Erik Walthinsen Date: Fri, 23 Feb 2001 19:09:18 +0000 Subject: [PATCH] Added two options: --gst-plugin-spew will print errors when plugins fail to load. --gst-plugin-path= will add a dire... Original commit message from CVS: Added two options: --gst-plugin-spew will print errors when plugins fail to load. --gst-plugin-path= will add a directory to the path searched for plugins. --- gst/gst.c | 17 +++++++++++++++-- gst/gstplugin.c | 11 +++++++++-- gst/gstplugin.h | 2 ++ gst/gstthread.c | 4 +++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/gst/gst.c b/gst/gst.c index 247f9ea0f5..6ee80918f8 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -40,6 +40,7 @@ gchar *_gst_progname; extern gint _gst_trace_on; +extern gboolean _gst_plugin_spew; static gboolean gst_init_check (int *argc, gchar ***argv); @@ -128,6 +129,16 @@ gst_init_check (int *argc, (*argv)[i] = NULL; } + else if (!strncmp ("--gst-plugin-spew", (*argv)[i], 17)) { + _gst_plugin_spew = TRUE; + + (*argv)[i] = NULL; + } + else if (!strncmp ("--gst-plugin-path=", (*argv)[i], 17)) { + gst_plugin_add_path ((*argv)[i]+18); + + (*argv)[i] = NULL; + } else if (!strncmp ("--help", (*argv)[i], 6)) { showhelp = TRUE; } @@ -153,8 +164,10 @@ gst_init_check (int *argc, g_print ("usage %s [OPTION...]\n", (*argv)[0]); g_print ("\nGStreamer options\n"); - g_print (" --gst-info-mask=FLAGS Gst info flags to set (current %08x)\n", gst_info_get_categories()); - g_print (" --gst-debug-mask=FLAGS Gst debugging flags to set\n"); + g_print (" --gst-info-mask=FLAGS GST info flags to set (current %08x)\n", gst_info_get_categories()); + g_print (" --gst-debug-mask=FLAGS GST debugging flags to set\n"); + g_print (" --gst-plugin-spew Enable printout of errors while loading GST plugins\n"); + g_print (" --gst-plugin-path=PATH Add a directory to the plugin search path\n"); g_print ("\n Mask (to be OR'ed) info/debug FLAGS \n"); g_print ("--------------------------------------------------------\n"); diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 7e43fe8124..d73af66386 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -99,6 +99,12 @@ _gst_plugin_initialize (void) xmlFreeDoc (doc); } +void +gst_plugin_add_path (const gchar *path) +{ + _gst_plugin_paths = g_list_prepend (_gst_plugin_paths,g_strdup(path)); +} + static time_t get_time(const char * path) { @@ -214,7 +220,7 @@ gst_plugin_load_all(void) path = _gst_plugin_paths; while (path != NULL) { - GST_DEBUG (GST_CAT_PLUGIN_LOADING,"loading plugins from %s\n",(gchar *)path->data); + GST_INFO (GST_CAT_PLUGIN_LOADING,"loading plugins from %s\n",(gchar *)path->data); gst_plugin_load_recurse(path->data,NULL); path = g_list_next(path); } @@ -364,7 +370,8 @@ gst_plugin_load_absolute (const gchar *name) } return TRUE; } else if (_gst_plugin_spew) { - gst_info("error loading plugin: %s, reason: %s\n", name, g_module_error()); + // FIXME this should be some standard gst mechanism!!! + g_printerr ("error loading plugin %s, reason: %s\n", name, g_module_error()); } return FALSE; diff --git a/gst/gstplugin.h b/gst/gstplugin.h index 6a53dcd686..c171ada41b 100644 --- a/gst/gstplugin.h +++ b/gst/gstplugin.h @@ -61,6 +61,8 @@ void _gst_plugin_initialize (void); GstPlugin* gst_plugin_new (const gchar *name); +void gst_plugin_add_path (const gchar *path); + const gchar* gst_plugin_get_name (GstPlugin *plugin); void gst_plugin_set_name (GstPlugin *plugin, const gchar *name); const gchar* gst_plugin_get_longname (GstPlugin *plugin); diff --git a/gst/gstthread.c b/gst/gstthread.c index 036660aada..7a5e767f87 100644 --- a/gst/gstthread.c +++ b/gst/gstthread.c @@ -282,6 +282,7 @@ gst_thread_change_state (GstElement *element) GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING); gst_thread_signal_thread (thread); + pthread_join(thread->thread_id,NULL); break; default: break; @@ -324,7 +325,8 @@ gst_thread_main_loop (void *arg) } GST_FLAG_UNSET (thread, GST_THREAD_STATE_REAPING); - //pthread_join (thread->thread_id, 0); +// FIXME this should be removed (why's it here???) +// //pthread_join (thread->thread_id, 0); GST_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped", GST_ELEMENT_NAME (thread));