diff --git a/gst/Makefile.am b/gst/Makefile.am index 9d3096fa1d..fb114fc16b 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -82,7 +82,7 @@ noinst_HEADERS = \ gsti386.h \ gstppc.h -CFLAGS += -Wall +CFLAGS += -g -Wall libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS) libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE) diff --git a/gst/gst.c b/gst/gst.c index 0b22f5b151..191c26b940 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -20,6 +20,8 @@ * Boston, MA 02111-1307, USA. */ +#include + #include "gst_private.h" #include "gstcpu.h" @@ -38,6 +40,7 @@ gchar *_gst_progname; extern gint _gst_trace_on; +static gboolean gst_init_check (int *argc, gchar ***argv); /** * gst_init: @@ -60,6 +63,10 @@ gst_init (int *argc, char **argv[]) gtk_init (argc,argv); + if (!gst_init_check (argc,argv)) { + exit (0); + } + _gst_cpu_initialize (); _gst_type_initialize (); _gst_plugin_initialize (); @@ -77,6 +84,79 @@ gst_init (int *argc, char **argv[]) } } +/* returns FALSE if the program can be aborted */ +static gboolean +gst_init_check (int *argc, + gchar ***argv) +{ + gboolean ret = TRUE; + gboolean showhelp = FALSE; + + if (argc && argv) { + gint i, j, k; + + for (i=1; i< *argc; i++) { + if (!strncmp ("--gst-info-mask=", (*argv)[i], 16)) { + guint32 val; + + sscanf ((*argv)[i]+16, "%08x", &val); + + gst_info_set_categories (val); + + (*argv)[i] = NULL; + } + else if (!strncmp ("--gst-info-mask=", (*argv)[i], 16)) { + guint32 val; + + sscanf ((*argv)[i]+16, "%08x", &val); + + //FIXME + //gst_info_set_categories (val); + + (*argv)[i] = NULL; + } + else if (!strncmp ("--help", (*argv)[i], 6)) { + showhelp = TRUE; + } + } + + for (i = 1; i < *argc; i++) { + for (k = i; k < *argc; k++) + if ((*argv)[k] != NULL) + break; + + if (k > i) { + k -= i; + for (j = i + k; j < *argc; j++) + (*argv)[j-k] = (*argv)[j]; + *argc -= k; + } + } + } + + if (showhelp) { + guint i; + + 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 ("\nGStreamer info/debug FLAGS (to be ored)\n"); + + for (i = 0; i