Commit ac8289c7 authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by Andy Wingo Wingo
Browse files

Merged in popt removal + GOption addition patch from Ronald, bug #169772.

Original commit message from CVS:
2005-10-10  Andy Wingo  <wingo@pobox.com>

Merged in popt removal + GOption addition patch from Ronald, bug
#169772.

* docs/gst/gstreamer-sections.txt: Add STATE_(UN)LOCK_FULL, move
GstElement macros around, remove popt-related symbols, add goption
stuff.

* configure.ac: Remove popt checks, require GLib 2.6 for GOption.

* docs/gst/Makefile.am:
* docs/libs/Makefile.am: No POPT_CFLAGS.

* examples/manual/Makefile.am:
* docs/manual/basics-init.xml: Doc updates with an example.

* gst/gst.c: (gst_init_get_option_group), (gst_init_check),
(gst_init), (parse_one_option), (parse_goption_arg):
* gst/gst.h: Removed gst_init_with_popt_table and friends. Took a
bit of hand merging and debugging to get the GOption stuff working
tho.

* tests/Makefile.am:
* tools/Makefile.am:
* tools/gst-inspect.c: (main):
* tools/gst-launch.c: (main):
* tools/gst-run.c: (main):
* tools/gst-xmlinspect.c: (main): Thanks Ronald!
parent a1702b76
2005-10-10 Andy Wingo <wingo@pobox.com>
Merged in popt removal + GOption addition patch from Ronald, bug
#169772.
* docs/gst/gstreamer-sections.txt: Add STATE_(UN)LOCK_FULL, move
GstElement macros around, remove popt-related symbols, add goption
stuff.
* configure.ac: Remove popt checks, require GLib 2.6 for GOption.
* docs/gst/Makefile.am:
* docs/libs/Makefile.am: No POPT_CFLAGS.
* examples/manual/Makefile.am:
* docs/manual/basics-init.xml: Doc updates with an example.
* gst/gst.c: (gst_init_get_option_group), (gst_init_check),
(gst_init), (parse_one_option), (parse_goption_arg):
* gst/gst.h: Removed gst_init_with_popt_table and friends. Took a
bit of hand merging and debugging to get the GOption stuff working
tho.
* tests/Makefile.am:
* tools/Makefile.am:
* tools/gst-inspect.c: (main):
* tools/gst-launch.c: (main):
* tools/gst-run.c: (main):
* tools/gst-xmlinspect.c: (main): Thanks Ronald!
2005-10-10 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstiterator.c: (gst_iterator_new):
......
......@@ -223,7 +223,7 @@ dnl ====================================
dnl === GLib 2 ===
dnl Minimum required version of GLib2
dnl required for compilation without warnings
GLIB2_REQ="2.4"
GLIB2_REQ="2.6"
AC_SUBST(GLIB2_REQ)
dnl Check for glib2 with sugar on top
......@@ -263,34 +263,6 @@ else
GST_LIBXML2_CHECK(2.4.9)
fi
dnl popt checks
dnl FIXME: This test passes on popt 1.6.2, maybe earlier, but popt 1.6.2
dnl causes segfaults on gst_init. Write a working test if possible.
GST_CHECK_LIBHEADER(POPT, popt, poptStrippedArgv,, popt.h, POPT_LIBS="-lpopt",
AC_MSG_ERROR([popt 1.6.3 or newer is required to build gstreamer. You can
download the latest version from
ftp://ftp.rpm.org/pub/rpm/dist/])
)
AC_MSG_NOTICE(Checking for POPT_TABLEEND)
AC_COMPILE_IFELSE([
#include <popt.h>
int main ()
{
#ifndef POPT_TABLEEND
#error
#else
return 0;
#endif
}
],, [
dnl it failed
AC_MSG_ERROR([popt 1.6.3 or newer is required to build gstreamer. You can
download the latest version from
ftp://ftp.rpm.org/pub/rpm/dist/])
])
AC_SUBST(POPT_CFLAGS)
AC_SUBST(POPT_LIBS)
dnl Check for ucontext.h
AC_CHECK_HEADER(ucontext.h, AC_DEFINE(HAVE_UCONTEXT_H, 1, [defined if we have ucontext.h]))
......
......@@ -106,8 +106,8 @@ extra_files =
# CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
# contains GtkObjects/GObjects and you want to document signals and properties.
GTKDOC_CFLAGS = $(GST_OBJ_CFLAGS) $(POPT_CFLAGS) -I$(top_builddir)
GTKDOC_LIBS = $(GST_OBJ_LIBS) $(POPT_LIBS) $(SCANOBJ_DEPS)
GTKDOC_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir)
GTKDOC_LIBS = $(GST_OBJ_LIBS) $(SCANOBJ_DEPS)
GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
......
......@@ -21,9 +21,7 @@
<TITLE>Gst</TITLE>
gst_init
gst_init_check
gst_init_with_popt_table
gst_init_check_with_popt_table
gst_init_get_popt_table
gst_init_get_option_group
gst_deinit
<SUBSECTION Private>
GstPoptOption
......@@ -427,18 +425,20 @@ GstStateChangeReturn
GST_STATE
GST_STATE_PENDING
GST_STATE_CHANGE
GST_STATE_BROADCAST
GST_STATE_ERROR
GST_STATE_NO_PREROLL
GST_STATE_FINAL
GST_STATE_GET_COND
GST_STATE_GET_LOCK
GST_STATE_LOCK
GST_STATE_NO_PREROLL
GST_STATE_SIGNAL
GST_STATE_TIMED_WAIT
GST_STATE_TRYLOCK
GST_STATE_UNLOCK
GST_STATE_LOCK_FULL
GST_STATE_UNLOCK_FULL
GST_STATE_TRYLOCK
GST_STATE_BROADCAST
GST_STATE_SIGNAL
GST_STATE_WAIT
GST_STATE_TIMED_WAIT
GST_ELEMENT_NAME
GST_ELEMENT_PARENT
GST_ELEMENT_BUS
......
......@@ -81,8 +81,8 @@ extra_files =
# CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
# contains GtkObjects/GObjects and you want to document signals and properties.
GTKDOC_CFLAGS = $(GST_OBJ_CFLAGS) $(POPT_CFLAGS) -I$(top_builddir) -I$(top_builddir)/libs
GTKDOC_LIBS = $(GST_OBJ_LIBS) $(POPT_LIBS) $(SCANOBJ_DEPS)
GTKDOC_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir) -I$(top_builddir)/libs
GTKDOC_LIBS = $(GST_OBJ_LIBS) $(SCANOBJ_DEPS)
GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
......
......@@ -57,13 +57,13 @@ main (int argc,
</sect1>
<sect1>
<title>The popt interface</title>
<title>The GOption interface</title>
<para>
You can also use a popt table to initialize your own parameters as
You can also use a GOption table to initialize your own parameters as
shown in the next example:
</para>
<programlisting>
<!-- example-begin popt.c -->
<!-- example-begin goption.c -->
#include &lt;gst/gst.h&gt;
int
......@@ -72,28 +72,38 @@ main (int argc,
{
gboolean silent = FALSE;
gchar *savefile = NULL;
struct poptOption options[] = {
{"silent", 's', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &amp;silent, 0,
"do not output status information", NULL},
{"output", 'o', POPT_ARG_STRING|POPT_ARGFLAG_STRIP, &amp;savefile, 0,
"save xml representation of pipeline to FILE and exit", "FILE"},
POPT_TABLEEND
GOptionContext *ctx;
GError *err = NULL;
GOptionEntry entries[] = {
{ "silent", 's', 0, G_OPTION_ARG_NONE, &amp;silent, 0,
"do not output status information", NULL },
{ "output", 'o', 0, G_OPTION_ARG_STRING, &amp;savefile, 0,
"save xml representation of pipeline to FILE and exit", "FILE" },
{ NULL }
};
gst_init_with_popt_table (&amp;argc, &amp;argv, options);
ctx = g_option_context_new ("- Your application");
g_option_context_add_main_entries (ctx, entries, GETTEXT_PACKAGE);
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &amp;argc, &amp;argv, &amp;err)) {
g_print ("Failed to initialize: %s\n", err->message);
g_error_free (err);
return 1;
}
printf ("Run me with --help to see the Application options appended.\n");
return 0;
}
<!-- example-end popt.c -->
<!-- example-end goption.c -->
</programlisting>
<para>
As shown in this fragment, you can use a <ulink
url="http://developer.gnome.org/doc/guides/popt/"
type="http">popt</ulink> table to define your application-specific
command line options, and pass this table to the
function <function>gst_init_with_popt_table</function>. Your
url="http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html"
type="http">GOption</ulink> table to define your application-specific
command line options, and pass this table to the GLib initialization
function along with the option group returned from the
function <function>gst_init_get_option_group</function>. Your
application options will be parsed in addition to the standard
<application>GStreamer</application> options.
</para>
......
......@@ -12,6 +12,8 @@ endif
INCLUDES = $(GST_OBJ_CFLAGS)
goption_CFLAGS = -DGETTEXT_PACKAGE="\"gstreamer-0.9\""
#dynamic_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS)
#dynamic_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS)
gnome_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS)
......@@ -33,7 +35,7 @@ EXAMPLES = \
ghostpad \
helloworld \
init \
popt \
goption \
query \
typefind \
probe \
......@@ -66,7 +68,7 @@ helloworld.c: $(top_srcdir)/docs/manual/basics-helloworld.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-helloworld.xml
init.c popt.c: $(top_srcdir)/docs/manual/basics-init.xml
init.c goption.c: $(top_srcdir)/docs/manual/basics-init.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-init.xml
......@@ -94,7 +96,7 @@ xml-mp3.c: $(top_srcdir)/docs/manual/highlevel-xml.xml
# they actually run
include $(top_srcdir)/testsuite/Rules
tests_pass = elementmake elementget init popt
tests_pass = elementmake elementget init goption
tests_fail =
tests_ignore =
......
......@@ -114,8 +114,6 @@ gboolean _gst_registry_auto_load = TRUE;
static gboolean gst_initialized = FALSE;
/* this will be set in popt callbacks when a problem has been encountered */
static gboolean _gst_initialization_failure = FALSE;
extern gint _gst_trace_on;
/* set to TRUE when segfaults need to be left as is */
......@@ -123,11 +121,10 @@ gboolean _gst_disable_segtrap = FALSE;
static void load_plugin_func (gpointer data, gpointer user_data);
static void init_popt_callback (poptContext context,
enum poptCallbackReason reason,
const GstPoptOption * option, const char *arg, void *data);
static gboolean init_pre (void);
static gboolean init_post (void);
static gboolean parse_goption_arg (const gchar * s_opt,
const gchar * arg, gpointer data, GError ** err);
static GSList *preload_plugins = NULL;
......@@ -154,7 +151,6 @@ enum
ARG_DEBUG_NO_COLOR,
ARG_DEBUG_HELP,
#endif
ARG_DISABLE_CPU_OPT,
ARG_PLUGIN_SPEW,
ARG_PLUGIN_PATH,
ARG_PLUGIN_LOAD,
......@@ -242,91 +238,79 @@ parse_debug_list (const gchar * list)
}
/**
* gst_init_get_popt_table:
* gst_init_get_option_group:
*
* Returns a popt option table with GStreamer's argument specifications. The
* table is set up to use popt's callback method, so whenever the parsing is
* actually performed (via poptGetContext), the GStreamer libraries will
* be initialized.
* Returns a #GOptionGroup with GStreamer's argument specifications. The
* group is set up to use standard GOption callbacks, so when using this
* group in combination with GOption parsing methods, all argument parsing
* and initialization is automated.
*
* This function is useful if you want to integrate GStreamer with other
* libraries that use popt.
* libraries that use GOption.
*
* Returns: a pointer to the static GStreamer option table.
* No free is necessary.
* Returns: a pointer to a GStreamer option group. Should be dereferenced
* after use.
*/
const GstPoptOption *
gst_init_get_popt_table (void)
{
static GstPoptOption gstreamer_options[] = {
{NULL, NUL, POPT_ARG_CALLBACK | POPT_CBFLAG_PRE | POPT_CBFLAG_POST,
(void *) &init_popt_callback, 0, NULL, NULL},
/* make sure we use our GETTEXT_PACKAGE as the domain for popt translations */
{NULL, NUL, POPT_ARG_INTL_DOMAIN, GETTEXT_PACKAGE, 0, NULL, NULL},
{"gst-version", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL, ARG_VERSION,
N_("Print the GStreamer version"), NULL},
{"gst-fatal-warnings", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
ARG_FATAL_WARNINGS, N_("Make all warnings fatal"), NULL},
GOptionGroup *
gst_init_get_option_group (void)
{
GOptionGroup *group;
static GOptionEntry gst_args[] = {
{"gst-version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
parse_goption_arg, N_("Print the GStreamer version"), NULL},
{"gst-fatal-warnings", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
parse_goption_arg, N_("Make all warnings fatal"), NULL},
#ifndef GST_DISABLE_GST_DEBUG
{"gst-debug-help", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
ARG_DEBUG_HELP, N_("Print available debug categories and exit"), NULL},
{"gst-debug-level", NUL, POPT_ARG_INT | POPT_ARGFLAG_STRIP, NULL,
ARG_DEBUG_LEVEL,
{"gst-debug-help", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
parse_goption_arg, N_("Print available debug categories and exit"),
NULL},
{"gst-debug-level", 0, 0, G_OPTION_ARG_CALLBACK, parse_goption_arg,
N_("Default debug level from 1 (only error) to 5 (anything) or "
"0 for no output"),
N_("LEVEL")},
{"gst-debug", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL, ARG_DEBUG,
{"gst-debug", 0, 0, G_OPTION_ARG_CALLBACK, parse_goption_arg,
N_("Comma-separated list of category_name:level pairs to set "
"specific levels for the individual categories. Example: "
"GST_AUTOPLUG:5,GST_ELEMENT_*:3"),
N_("LIST")},
{"gst-debug-no-color", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
ARG_DEBUG_NO_COLOR, N_("Disable colored debugging output"), NULL},
{"gst-debug-disable", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
ARG_DEBUG_DISABLE, N_("Disable debugging")},
{"gst-debug-no-color", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
parse_goption_arg, N_("Disable colored debugging output"), NULL},
{"gst-debug-disable", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
parse_goption_arg, N_("Disable debugging"), NULL},
#endif
{"gst-plugin-spew", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
ARG_PLUGIN_SPEW, N_("Enable verbose plugin loading diagnostics"), NULL},
{"gst-plugin-path", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL,
ARG_PLUGIN_PATH, NULL, N_("PATHS")},
{"gst-plugin-load", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL,
ARG_PLUGIN_LOAD,
{"gst-plugin-spew", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
parse_goption_arg, N_("Enable verbose plugin loading diagnostics"),
NULL},
{"gst-plugin-path", 0, 0, G_OPTION_ARG_CALLBACK, parse_goption_arg,
N_("Colon-separated paths containing plugins"), N_("PATHS")},
{"gst-plugin-load", 0, 0, G_OPTION_ARG_CALLBACK, parse_goption_arg,
N_("Comma-separated list of plugins to preload in addition to the "
"list stored in environment variable GST_PLUGIN_PATH"),
N_("PLUGINS")},
{"gst-disable-segtrap", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL,
ARG_SEGTRAP_DISABLE,
{"gst-disable-segtrap", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
parse_goption_arg,
N_("Disable trapping of segmentation faults during plugin loading"),
NULL},
POPT_TABLEEND
{NULL}
};
static gboolean inited = FALSE;
if (!inited) {
int i;
for (i = 0; i < G_N_ELEMENTS (gstreamer_options); i++) {
if (gstreamer_options[i].longName == NULL) {
} else if (strcmp (gstreamer_options[i].longName, "gst-plugin-path") == 0) {
gstreamer_options[i].descrip =
g_strdup_printf (_
("path list for loading plugins (separated by '%s')"),
G_SEARCHPATH_SEPARATOR_S);
}
}
inited = TRUE;
}
group = g_option_group_new ("gst", _("GStreamer Options"),
_("Show GStreamer Options"), NULL, NULL);
g_option_group_set_parse_hooks (group, (GOptionParseFunc) init_pre,
(GOptionParseFunc) init_post);
g_option_group_add_entries (group, gst_args);
g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
return gstreamer_options;
return group;
}
/**
* gst_init_check:
* @argc: pointer to application's argc
* @argv: pointer to application's argv
* @err: pointer to a #GError to which a message will be posted on error
*
* Initializes the GStreamer library, setting up internal path lists,
* registering built-in elements, and loading standard plugins.
......@@ -338,9 +322,28 @@ gst_init_get_popt_table (void)
* Returns: %TRUE if GStreamer could be initialized.
*/
gboolean
gst_init_check (int *argc, char **argv[])
gst_init_check (int *argc, char **argv[], GError ** err)
{
return gst_init_check_with_popt_table (argc, argv, NULL);
GOptionGroup *group;
GOptionContext *ctx;
gboolean res;
if (gst_initialized) {
GST_DEBUG ("already initialized gst");
return TRUE;
}
ctx = g_option_context_new ("- GStreamer initialization");
group = gst_init_get_option_group ();
g_option_context_add_group (ctx, group);
res = g_option_context_parse (ctx, argc, argv, err);
g_option_context_free (ctx);
if (res) {
gst_initialized = TRUE;
}
return res;
}
/**
......@@ -363,128 +366,16 @@ gst_init_check (int *argc, char **argv[])
void
gst_init (int *argc, char **argv[])
{
gst_init_with_popt_table (argc, argv, NULL);
}
/**
* gst_init_with_popt_table:
* @argc: pointer to application's argc
* @argv: pointer to application's argv
* @popt_options: pointer to a popt table to append
*
* Initializes the GStreamer library, parsing the options,
* setting up internal path lists,
* registering built-in elements, and loading standard plugins.
*
* This function will terminate your program if it was unable to initialize
* GStreamer for some reason. If you want your program to fall back,
* use gst_init_check_with_popt_table() instead.
*/
void
gst_init_with_popt_table (int *argc, char **argv[],
const GstPoptOption * popt_options)
{
if (!gst_init_check_with_popt_table (argc, argv, popt_options)) {
g_print ("Could not initialize GStreamer !\n");
exit (1);
}
}
/**
* gst_init_check_with_popt_table:
* @argc: pointer to application's argc
* @argv: pointer to application's argv
* @popt_options: pointer to a popt table to append
*
* Initializes the GStreamer library, parsing the options,
* setting up internal path lists,
* registering built-in elements, and loading standard plugins.
*
* Returns: %TRUE if GStreamer could be initialized.
*/
gboolean
gst_init_check_with_popt_table (int *argc, char **argv[],
const GstPoptOption * popt_options)
{
poptContext context;
gint nextopt;
GstPoptOption *options;
const gchar *gst_debug_env = NULL;
GstPoptOption options_with[] = {
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:",
NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE,
(GstPoptOption *) gst_init_get_popt_table (), 0,
"GStreamer options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (GstPoptOption *) popt_options, 0,
"Application options:", NULL},
POPT_TABLEEND
};
GstPoptOption options_without[] = {
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:",
NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE,
(GstPoptOption *) gst_init_get_popt_table (), 0,
"GStreamer options:", NULL},
POPT_TABLEEND
};
if (gst_initialized) {
GST_DEBUG ("already initialized gst");
return TRUE;
}
if (!argc || !argv) {
if (argc || argv)
g_warning ("gst_init: Only one of argc or argv was NULL");
if (!init_pre ())
return FALSE;
if (!init_post ())
return FALSE;
gst_initialized = TRUE;
return TRUE;
}
GError *err = NULL;
if (popt_options == NULL) {
options = options_without;
} else {
options = options_with;
}
context = poptGetContext ("GStreamer", *argc, (const char **) *argv,
options, 0);
/* check for GST_DEBUG_NO_COLOR environment variable */
if (g_getenv ("GST_DEBUG_NO_COLOR") != NULL)
gst_debug_set_colored (FALSE);
/* check for GST_DEBUG environment variable */
gst_debug_env = g_getenv ("GST_DEBUG");
if (gst_debug_env)
parse_debug_list (gst_debug_env);
/* 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 (!gst_init_check (argc, argv, &err)) {
g_print ("Could not initialized GStreamer: %s\n",
err ? err->message : "unknown error occurred");
if (err) {
g_error_free (err);
}
exit (1);
}
*argc = poptStrippedArgv (context, *argc, *argv);
poptFreeContext (context);
return TRUE;
}
#ifndef GST_DISABLE_REGISTRY
......@@ -833,77 +724,103 @@ gst_debug_help (void)
}
#endif
static void
init_popt_callback (poptContext context, enum poptCallbackReason reason,
const GstPoptOption * option, const char *arg, void *data)
static gboolean
parse_one_option (gint opt, const gchar * arg, GError ** err)
{
GLogLevelFlags fatal_mask;
if (gst_initialized)
return;
switch (reason) {
case POPT_CALLBACK_REASON_PRE:
if (!init_pre ())
_gst_initialization_failure = TRUE;
switch (opt) {
case ARG_VERSION:
g_print ("GStreamer Core Library version %s\n", GST_VERSION);
exit (0);
case ARG_FATAL_WARNINGS:{
GLogLevelFlags fatal_mask;
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
g_log_set_always_fatal (fatal_mask);
break;
case POPT_CALLBACK_REASON_OPTION:
switch (option->val) {
case ARG_VERSION:
g_print ("GStreamer Core Library version %s\n", GST_VERSION);
exit (0);
case ARG_FATAL_WARNINGS:
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
g_log_set_always_fatal (fatal_mask);
break;
}
#ifndef GST_DISABLE_GST_DEBUG
case ARG_DEBUG_LEVEL:{
gint tmp = 0;
tmp = strtol (arg, NULL, 0);
if (tmp >= 0 && tmp < GST_LEVEL_COUNT) {
gst_debug_set_default_threshold (tmp);
}
break;
}
case ARG_DEBUG:
parse_debug_list (arg);
break;
case ARG_DEBUG_NO_COLOR:
gst_debug_set_colored (FALSE);
break;
case ARG_DEBUG_DISABLE:
gst_debug_set_active (FALSE);
break;
case ARG_DEBUG_HELP: