Added two options: --gst-plugin-spew will print errors when plugins fail to load...
authorErik Walthinsen <omega@temple-baptist.org>
Fri, 23 Feb 2001 19:09:18 +0000 (19:09 +0000)
committerErik Walthinsen <omega@temple-baptist.org>
Fri, 23 Feb 2001 19:09:18 +0000 (19:09 +0000)
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
gst/gstplugin.c
gst/gstplugin.h
gst/gstthread.c

index 247f9ea..6ee8091 100644 (file)
--- 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");
index 7e43fe8..d73af66 100644 (file)
@@ -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;
index 6a53dcd..c171ada 100644 (file)
@@ -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);
index 036660a..7a5e767 100644 (file)
@@ -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));