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!
This commit is contained in:
Ronald 2005-10-10 15:53:59 +00:00 committed by Andy Wingo
parent a1702b7646
commit ac8289c7a9
16 changed files with 309 additions and 430 deletions

View file

@ -1,3 +1,33 @@
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> 2005-10-10 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstiterator.c: (gst_iterator_new): * gst/gstiterator.c: (gst_iterator_new):

View file

@ -223,7 +223,7 @@ dnl ====================================
dnl === GLib 2 === dnl === GLib 2 ===
dnl Minimum required version of GLib2 dnl Minimum required version of GLib2
dnl required for compilation without warnings dnl required for compilation without warnings
GLIB2_REQ="2.4" GLIB2_REQ="2.6"
AC_SUBST(GLIB2_REQ) AC_SUBST(GLIB2_REQ)
dnl Check for glib2 with sugar on top dnl Check for glib2 with sugar on top
@ -263,34 +263,6 @@ else
GST_LIBXML2_CHECK(2.4.9) GST_LIBXML2_CHECK(2.4.9)
fi 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 dnl Check for ucontext.h
AC_CHECK_HEADER(ucontext.h, AC_DEFINE(HAVE_UCONTEXT_H, 1, [defined if we have ucontext.h])) AC_CHECK_HEADER(ucontext.h, AC_DEFINE(HAVE_UCONTEXT_H, 1, [defined if we have ucontext.h]))

View file

@ -106,8 +106,8 @@ extra_files =
# CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
# contains GtkObjects/GObjects and you want to document signals and properties. # contains GtkObjects/GObjects and you want to document signals and properties.
GTKDOC_CFLAGS = $(GST_OBJ_CFLAGS) $(POPT_CFLAGS) -I$(top_builddir) GTKDOC_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir)
GTKDOC_LIBS = $(GST_OBJ_LIBS) $(POPT_LIBS) $(SCANOBJ_DEPS) GTKDOC_LIBS = $(GST_OBJ_LIBS) $(SCANOBJ_DEPS)
GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC) GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
GTKDOC_LD=$(LIBTOOL) --mode=link $(CC) GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)

View file

@ -21,9 +21,7 @@
<TITLE>Gst</TITLE> <TITLE>Gst</TITLE>
gst_init gst_init
gst_init_check gst_init_check
gst_init_with_popt_table gst_init_get_option_group
gst_init_check_with_popt_table
gst_init_get_popt_table
gst_deinit gst_deinit
<SUBSECTION Private> <SUBSECTION Private>
GstPoptOption GstPoptOption
@ -427,18 +425,20 @@ GstStateChangeReturn
GST_STATE GST_STATE
GST_STATE_PENDING GST_STATE_PENDING
GST_STATE_CHANGE GST_STATE_CHANGE
GST_STATE_BROADCAST
GST_STATE_ERROR GST_STATE_ERROR
GST_STATE_NO_PREROLL
GST_STATE_FINAL GST_STATE_FINAL
GST_STATE_GET_COND GST_STATE_GET_COND
GST_STATE_GET_LOCK GST_STATE_GET_LOCK
GST_STATE_LOCK GST_STATE_LOCK
GST_STATE_NO_PREROLL
GST_STATE_SIGNAL
GST_STATE_TIMED_WAIT
GST_STATE_TRYLOCK
GST_STATE_UNLOCK 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_WAIT
GST_STATE_TIMED_WAIT
GST_ELEMENT_NAME GST_ELEMENT_NAME
GST_ELEMENT_PARENT GST_ELEMENT_PARENT
GST_ELEMENT_BUS GST_ELEMENT_BUS

View file

@ -81,8 +81,8 @@ extra_files =
# CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
# contains GtkObjects/GObjects and you want to document signals and properties. # 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_CFLAGS = $(GST_OBJ_CFLAGS) -I$(top_builddir) -I$(top_builddir)/libs
GTKDOC_LIBS = $(GST_OBJ_LIBS) $(POPT_LIBS) $(SCANOBJ_DEPS) GTKDOC_LIBS = $(GST_OBJ_LIBS) $(SCANOBJ_DEPS)
GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC) GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
GTKDOC_LD=$(LIBTOOL) --mode=link $(CC) GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)

View file

@ -57,13 +57,13 @@ main (int argc,
</sect1> </sect1>
<sect1> <sect1>
<title>The popt interface</title> <title>The GOption interface</title>
<para> <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: shown in the next example:
</para> </para>
<programlisting> <programlisting>
<!-- example-begin popt.c --> <!-- example-begin goption.c -->
#include &lt;gst/gst.h&gt; #include &lt;gst/gst.h&gt;
int int
@ -72,28 +72,38 @@ main (int argc,
{ {
gboolean silent = FALSE; gboolean silent = FALSE;
gchar *savefile = NULL; gchar *savefile = NULL;
struct poptOption options[] = { GOptionContext *ctx;
{"silent", 's', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &amp;silent, 0, GError *err = NULL;
GOptionEntry entries[] = {
{ "silent", 's', 0, G_OPTION_ARG_NONE, &amp;silent, 0,
"do not output status information", NULL }, "do not output status information", NULL },
{"output", 'o', POPT_ARG_STRING|POPT_ARGFLAG_STRIP, &amp;savefile, 0, { "output", 'o', 0, G_OPTION_ARG_STRING, &amp;savefile, 0,
"save xml representation of pipeline to FILE and exit", "FILE" }, "save xml representation of pipeline to FILE and exit", "FILE" },
POPT_TABLEEND { 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"); printf ("Run me with --help to see the Application options appended.\n");
return 0; return 0;
} }
<!-- example-end popt.c --> <!-- example-end goption.c -->
</programlisting> </programlisting>
<para> <para>
As shown in this fragment, you can use a <ulink As shown in this fragment, you can use a <ulink
url="http://developer.gnome.org/doc/guides/popt/" url="http://developer.gnome.org/doc/API/2.0/glib/glib-Commandline-option-parser.html"
type="http">popt</ulink> table to define your application-specific type="http">GOption</ulink> table to define your application-specific
command line options, and pass this table to the command line options, and pass this table to the GLib initialization
function <function>gst_init_with_popt_table</function>. Your 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 options will be parsed in addition to the standard
<application>GStreamer</application> options. <application>GStreamer</application> options.
</para> </para>

View file

@ -12,6 +12,8 @@ endif
INCLUDES = $(GST_OBJ_CFLAGS) INCLUDES = $(GST_OBJ_CFLAGS)
goption_CFLAGS = -DGETTEXT_PACKAGE="\"gstreamer-0.9\""
#dynamic_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS) #dynamic_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS)
#dynamic_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS) #dynamic_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS)
gnome_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS) gnome_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS)
@ -33,7 +35,7 @@ EXAMPLES = \
ghostpad \ ghostpad \
helloworld \ helloworld \
init \ init \
popt \ goption \
query \ query \
typefind \ typefind \
probe \ probe \
@ -66,7 +68,7 @@ helloworld.c: $(top_srcdir)/docs/manual/basics-helloworld.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \ $(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-helloworld.xml $(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 $@ \ $(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-init.xml $(top_srcdir)/docs/manual/basics-init.xml
@ -94,7 +96,7 @@ xml-mp3.c: $(top_srcdir)/docs/manual/highlevel-xml.xml
# they actually run # they actually run
include $(top_srcdir)/testsuite/Rules include $(top_srcdir)/testsuite/Rules
tests_pass = elementmake elementget init popt tests_pass = elementmake elementget init goption
tests_fail = tests_fail =
tests_ignore = tests_ignore =

329
gst/gst.c
View file

@ -114,8 +114,6 @@ gboolean _gst_registry_auto_load = TRUE;
static gboolean gst_initialized = FALSE; 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; extern gint _gst_trace_on;
/* set to TRUE when segfaults need to be left as is */ /* 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 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_pre (void);
static gboolean init_post (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; static GSList *preload_plugins = NULL;
@ -154,7 +151,6 @@ enum
ARG_DEBUG_NO_COLOR, ARG_DEBUG_NO_COLOR,
ARG_DEBUG_HELP, ARG_DEBUG_HELP,
#endif #endif
ARG_DISABLE_CPU_OPT,
ARG_PLUGIN_SPEW, ARG_PLUGIN_SPEW,
ARG_PLUGIN_PATH, ARG_PLUGIN_PATH,
ARG_PLUGIN_LOAD, 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 * Returns a #GOptionGroup with GStreamer's argument specifications. The
* table is set up to use popt's callback method, so whenever the parsing is * group is set up to use standard GOption callbacks, so when using this
* actually performed (via poptGetContext), the GStreamer libraries will * group in combination with GOption parsing methods, all argument parsing
* be initialized. * and initialization is automated.
* *
* This function is useful if you want to integrate GStreamer with other * 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. * Returns: a pointer to a GStreamer option group. Should be dereferenced
* No free is necessary. * 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 #ifndef GST_DISABLE_GST_DEBUG
{"gst-debug-help", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL, {"gst-debug-help", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
ARG_DEBUG_HELP, N_("Print available debug categories and exit"), NULL}, parse_goption_arg, N_("Print available debug categories and exit"),
{"gst-debug-level", NUL, POPT_ARG_INT | POPT_ARGFLAG_STRIP, NULL, NULL},
ARG_DEBUG_LEVEL, {"gst-debug-level", 0, 0, G_OPTION_ARG_CALLBACK, parse_goption_arg,
N_("Default debug level from 1 (only error) to 5 (anything) or " N_("Default debug level from 1 (only error) to 5 (anything) or "
"0 for no output"), "0 for no output"),
N_("LEVEL")}, 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 " N_("Comma-separated list of category_name:level pairs to set "
"specific levels for the individual categories. Example: " "specific levels for the individual categories. Example: "
"GST_AUTOPLUG:5,GST_ELEMENT_*:3"), "GST_AUTOPLUG:5,GST_ELEMENT_*:3"),
N_("LIST")}, N_("LIST")},
{"gst-debug-no-color", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL, {"gst-debug-no-color", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
ARG_DEBUG_NO_COLOR, N_("Disable colored debugging output"), NULL}, parse_goption_arg, N_("Disable colored debugging output"), NULL},
{"gst-debug-disable", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL, {"gst-debug-disable", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
ARG_DEBUG_DISABLE, N_("Disable debugging")}, parse_goption_arg, N_("Disable debugging"), NULL},
#endif #endif
{"gst-plugin-spew", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
{"gst-plugin-spew", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL, parse_goption_arg, N_("Enable verbose plugin loading diagnostics"),
ARG_PLUGIN_SPEW, N_("Enable verbose plugin loading diagnostics"), NULL}, NULL},
{"gst-plugin-path", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL, {"gst-plugin-path", 0, 0, G_OPTION_ARG_CALLBACK, parse_goption_arg,
ARG_PLUGIN_PATH, NULL, N_("PATHS")}, N_("Colon-separated paths containing plugins"), N_("PATHS")},
{"gst-plugin-load", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL, {"gst-plugin-load", 0, 0, G_OPTION_ARG_CALLBACK, parse_goption_arg,
ARG_PLUGIN_LOAD,
N_("Comma-separated list of plugins to preload in addition to the " N_("Comma-separated list of plugins to preload in addition to the "
"list stored in environment variable GST_PLUGIN_PATH"), "list stored in environment variable GST_PLUGIN_PATH"),
N_("PLUGINS")}, N_("PLUGINS")},
{"gst-disable-segtrap", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL, {"gst-disable-segtrap", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
ARG_SEGTRAP_DISABLE, parse_goption_arg,
N_("Disable trapping of segmentation faults during plugin loading"), N_("Disable trapping of segmentation faults during plugin loading"),
NULL}, NULL},
POPT_TABLEEND {NULL}
}; };
static gboolean inited = FALSE;
if (!inited) { group = g_option_group_new ("gst", _("GStreamer Options"),
int i; _("Show GStreamer Options"), NULL, NULL);
g_option_group_set_parse_hooks (group, (GOptionParseFunc) init_pre,
(GOptionParseFunc) init_post);
for (i = 0; i < G_N_ELEMENTS (gstreamer_options); i++) { g_option_group_add_entries (group, gst_args);
if (gstreamer_options[i].longName == NULL) { g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
} 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; return group;
}
return gstreamer_options;
} }
/** /**
* gst_init_check: * gst_init_check:
* @argc: pointer to application's argc * @argc: pointer to application's argc
* @argv: pointer to application's argv * @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, * Initializes the GStreamer library, setting up internal path lists,
* registering built-in elements, and loading standard plugins. * 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. * Returns: %TRUE if GStreamer could be initialized.
*/ */
gboolean 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,130 +366,18 @@ gst_init_check (int *argc, char **argv[])
void void
gst_init (int *argc, char **argv[]) gst_init (int *argc, char **argv[])
{ {
gst_init_with_popt_table (argc, argv, NULL); GError *err = NULL;
}
/** if (!gst_init_check (argc, argv, &err)) {
* gst_init_with_popt_table: g_print ("Could not initialized GStreamer: %s\n",
* @argc: pointer to application's argc err ? err->message : "unknown error occurred");
* @argv: pointer to application's argv if (err) {
* @popt_options: pointer to a popt table to append g_error_free (err);
* }
* 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); 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;
}
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;
}
}
*argc = poptStrippedArgv (context, *argc, *argv);
poptFreeContext (context);
return TRUE;
}
#ifndef GST_DISABLE_REGISTRY #ifndef GST_DISABLE_REGISTRY
static void static void
add_path_func (gpointer data, gpointer user_data) add_path_func (gpointer data, gpointer user_data)
@ -833,29 +724,21 @@ gst_debug_help (void)
} }
#endif #endif
static void static gboolean
init_popt_callback (poptContext context, enum poptCallbackReason reason, parse_one_option (gint opt, const gchar * arg, GError ** err)
const GstPoptOption * option, const char *arg, void *data)
{ {
GLogLevelFlags fatal_mask; switch (opt) {
if (gst_initialized)
return;
switch (reason) {
case POPT_CALLBACK_REASON_PRE:
if (!init_pre ())
_gst_initialization_failure = TRUE;
break;
case POPT_CALLBACK_REASON_OPTION:
switch (option->val) {
case ARG_VERSION: case ARG_VERSION:
g_print ("GStreamer Core Library version %s\n", GST_VERSION); g_print ("GStreamer Core Library version %s\n", GST_VERSION);
exit (0); exit (0);
case ARG_FATAL_WARNINGS: case ARG_FATAL_WARNINGS:{
GLogLevelFlags fatal_mask;
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK); fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL; fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
g_log_set_always_fatal (fatal_mask); g_log_set_always_fatal (fatal_mask);
break; break;
}
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
case ARG_DEBUG_LEVEL:{ case ARG_DEBUG_LEVEL:{
gint tmp = 0; gint tmp = 0;
@ -883,8 +766,7 @@ init_popt_callback (poptContext context, enum poptCallbackReason reason,
break; break;
case ARG_PLUGIN_PATH: case ARG_PLUGIN_PATH:
#ifndef GST_DISABLE_REGISTRY #ifndef GST_DISABLE_REGISTRY
split_and_iterate (arg, G_SEARCHPATH_SEPARATOR_S, add_path_func, split_and_iterate (arg, G_SEARCHPATH_SEPARATOR_S, add_path_func, NULL);
NULL);
#endif /* GST_DISABLE_REGISTRY */ #endif /* GST_DISABLE_REGISTRY */
break; break;
case ARG_PLUGIN_LOAD: case ARG_PLUGIN_LOAD:
@ -894,16 +776,51 @@ init_popt_callback (poptContext context, enum poptCallbackReason reason,
_gst_disable_segtrap = TRUE; _gst_disable_segtrap = TRUE;
break; break;
default: default:
g_warning ("option %d not recognized", option->val); g_set_error (err, G_OPTION_ERROR, G_OPTION_ERROR_UNKNOWN_OPTION,
_("Unknown option"));
return FALSE;
}
return TRUE;
}
static gboolean
parse_goption_arg (const gchar * opt,
const gchar * arg, gpointer data, GError ** err)
{
const struct
{
gchar *opt;
int val;
} options[] = {
{
"--gst-version", ARG_VERSION}, {
"--gst-fatal-warnings", ARG_FATAL_WARNINGS},
#ifndef GST_DISABLE_GST_DEBUG
{
"--gst-debug-level", ARG_DEBUG_LEVEL}, {
"--gst-debug", ARG_DEBUG}, {
"--gst-debug-disable", ARG_DEBUG_DISABLE}, {
"--gst-debug-no-color", ARG_DEBUG_NO_COLOR}, {
"--gst-debug-help", ARG_DEBUG_HELP},
#endif
{
"--gst-plugin-spew", ARG_PLUGIN_SPEW}, {
"--gst-plugin-path", ARG_PLUGIN_PATH}, {
"--gst-plugin-load", ARG_PLUGIN_LOAD}, {
"--gst-disable-segtrap", ARG_SEGTRAP_DISABLE}, {
NULL}
};
gint val = 0, n;
for (n = 0; options[n].opt; n++) {
if (!strcmp (opt, options[n].opt)) {
val = options[n].val;
break; break;
} }
break;
case POPT_CALLBACK_REASON_POST:
if (!init_post ())
_gst_initialization_failure = TRUE;
gst_initialized = TRUE;
break;
} }
return parse_one_option (val, arg, err);
} }
/** /**

View file

@ -25,7 +25,6 @@
#define __GST_H__ #define __GST_H__
#include <glib.h> #include <glib.h>
#include <popt.h>
#include <gst/gstenumtypes.h> #include <gst/gstenumtypes.h>
#include <gst/gstversion.h> #include <gst/gstversion.h>
@ -73,30 +72,14 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/* make our own type for poptOption because gtkdoc-1.2 can not handle functions
* with return types like 'struct abc'
* Filed as http://bugzilla.gnome.org/show_bug.cgi?id=148507
*
* Btw. popt provides a typedef, but it is:
* typedef struct poptOption *poptOption
*/
typedef struct poptOption GstPoptOption;
#ifndef GST_DISABLE_REGISTRY #ifndef GST_DISABLE_REGISTRY
GST_EXPORT gboolean _gst_registry_auto_load; GST_EXPORT gboolean _gst_registry_auto_load;
#endif #endif
/* initialize GST */
void gst_init (int *argc, char **argv[]); void gst_init (int *argc, char **argv[]);
gboolean gst_init_check (int *argc, char **argv[]); gboolean gst_init_check (int *argc, char **argv[],
void gst_init_with_popt_table (int *argc, char **argv[], GError ** err);
const GstPoptOption GOptionGroup * gst_init_get_option_group (void);
*popt_options);
gboolean gst_init_check_with_popt_table (int *argc, char **argv[],
const GstPoptOption
*popt_options);
const GstPoptOption * gst_init_get_popt_table (void);
void gst_deinit (void); void gst_deinit (void);
G_END_DECLS G_END_DECLS

View file

@ -8,7 +8,7 @@ LAT = lat
endif endif
noinst_PROGRAMS = $(LAT) mass_elements complexity noinst_PROGRAMS = $(LAT) mass_elements complexity init
AM_CFLAGS = $(GST_OBJ_CFLAGS) AM_CFLAGS = $(GST_OBJ_CFLAGS)
LIBS = $(GST_OBJ_LIBS) \ LIBS = $(GST_OBJ_LIBS) \

View file

@ -12,6 +12,8 @@ endif
INCLUDES = $(GST_OBJ_CFLAGS) INCLUDES = $(GST_OBJ_CFLAGS)
goption_CFLAGS = -DGETTEXT_PACKAGE="\"gstreamer-0.9\""
#dynamic_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS) #dynamic_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS)
#dynamic_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS) #dynamic_CFLAGS = $(GST_OBJ_CFLAGS) $(LIBGNOMEUI_CFLAGS)
gnome_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS) gnome_LDADD = $(GST_OBJ_LIBS) $(LIBGNOMEUI_LIBS)
@ -33,7 +35,7 @@ EXAMPLES = \
ghostpad \ ghostpad \
helloworld \ helloworld \
init \ init \
popt \ goption \
query \ query \
typefind \ typefind \
probe \ probe \
@ -66,7 +68,7 @@ helloworld.c: $(top_srcdir)/docs/manual/basics-helloworld.xml
$(PERL_PATH) $(srcdir)/extract.pl $@ \ $(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-helloworld.xml $(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 $@ \ $(PERL_PATH) $(srcdir)/extract.pl $@ \
$(top_srcdir)/docs/manual/basics-init.xml $(top_srcdir)/docs/manual/basics-init.xml
@ -94,7 +96,7 @@ xml-mp3.c: $(top_srcdir)/docs/manual/highlevel-xml.xml
# they actually run # they actually run
include $(top_srcdir)/testsuite/Rules include $(top_srcdir)/testsuite/Rules
tests_pass = elementmake elementget init popt tests_pass = elementmake elementget init goption
tests_fail = tests_fail =
tests_ignore = tests_ignore =

View file

@ -77,10 +77,10 @@ gst_typefind_SOURCES = gst-run.c
gst_xmlinspect_SOURCES = gst-run.c gst_xmlinspect_SOURCES = gst-run.c
# CFLAGS and libs for nonversioned frontend binaries # CFLAGS and libs for nonversioned frontend binaries
AM_CFLAGS = $(GLIB_ONLY_CFLAGS) $(POPT_CFLAGS) AM_CFLAGS = $(GLIB_ONLY_CFLAGS)
LDADD = $(GLIB_ONLY_LIBS) $(POPT_LIBS) LDADD = $(GLIB_ONLY_LIBS)
# due to depcomp not using AM_CFLAGS for rh9/yd3, we also set AM_CPPFLAGS # due to depcomp not using AM_CFLAGS for rh9/yd3, we also set AM_CPPFLAGS
AM_CPPFLAGS = $(GLIB_ONLY_CFLAGS) $(POPT_CFLAGS) AM_CPPFLAGS = $(GLIB_ONLY_CFLAGS)
### man pages we want to install ### man pages we want to install
if GST_DISABLE_LOADSAVE if GST_DISABLE_LOADSAVE

View file

@ -1096,11 +1096,13 @@ int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
gboolean print_all = FALSE; gboolean print_all = FALSE;
struct poptOption options[] = { GOptionEntry options[] = {
{"print-all", 'a', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &print_all, 0, {"print-all", 'a', 0, G_OPTION_ARG_NONE, &print_all,
N_("Print all elements"), NULL}, N_("Print all elements"), NULL},
POPT_TABLEEND {NULL}
}; };
GOptionContext *ctx;
GError *err = NULL;
#ifdef GETTEXT_PACKAGE #ifdef GETTEXT_PACKAGE
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
@ -1108,7 +1110,13 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE); textdomain (GETTEXT_PACKAGE);
#endif #endif
gst_init_with_popt_table (&argc, &argv, options); ctx = g_option_context_new ("gst-inspect");
g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
g_print ("Error initializing: %s\n", err->message);
exit (1);
}
if (print_all && argc > 2) { if (print_all && argc > 2) {
g_print ("-a requires no extra arguments\n"); g_print ("-a requires no extra arguments\n");

View file

@ -489,28 +489,29 @@ main (int argc, char *argv[])
gboolean trace = FALSE; gboolean trace = FALSE;
gchar *savefile = NULL; gchar *savefile = NULL;
gchar *exclude_args = NULL; gchar *exclude_args = NULL;
struct poptOption options[] = { GOptionEntry options[] = {
{"tags", 't', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &tags, 0, {"tags", 't', 0, G_OPTION_ARG_NONE, &tags,
N_("Output tags (also known as metadata)"), NULL}, N_("Output tags (also known as metadata)"), NULL},
{"messages", 'm', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &messages, 0, {"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
N_("Output messages"), NULL},
{"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0,
N_("Output status information and property notifications"), NULL}, N_("Output status information and property notifications"), NULL},
{"exclude", 'X', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, &exclude_args, 0, {"messages", 'm', 0, G_OPTION_ARG_NONE, &messages,
N_("Output messages"), NULL},
{"exclude", 'X', 0, G_OPTION_ARG_NONE, &exclude_args,
N_("Do not output status information of TYPE"), N_("TYPE1,TYPE2,...")}, N_("Do not output status information of TYPE"), N_("TYPE1,TYPE2,...")},
#ifndef GST_DISABLE_LOADSAVE #ifndef GST_DISABLE_LOADSAVE
{"output", 'o', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, &savefile, 0, {"output", 'o', 0, G_OPTION_ARG_STRING, &savefile,
N_("Save xml representation of pipeline to FILE and exit"), N_("FILE")}, N_("Save xml representation of pipeline to FILE and exit"), N_("FILE")},
#endif #endif
{"no-fault", 'f', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &no_fault, 0, {"no-fault", 'f', 0, G_OPTION_ARG_NONE, &no_fault,
N_("Do not install a fault handler"), NULL}, N_("Do not install a fault handler"), NULL},
{"trace", 'T', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &trace, 0, {"trace", 'T', 0, G_OPTION_ARG_NONE, &trace,
N_("Print alloc trace (if enabled at compile time)"), NULL}, N_("Print alloc trace (if enabled at compile time)"), NULL},
{"iterations", 'i', POPT_ARG_INT | POPT_ARGFLAG_STRIP, &max_iterations, 0, {"iterations", 'i', 0, G_OPTION_ARG_INT, &max_iterations,
N_("Number of times to iterate pipeline"), NULL}, N_("Number of times to iterate pipeline"), NULL},
POPT_TABLEEND {NULL}
}; };
GOptionContext *ctx;
GError *err = NULL;
gchar **argvn; gchar **argvn;
GError *error = NULL; GError *error = NULL;
gint res = 0; gint res = 0;
@ -525,7 +526,13 @@ main (int argc, char *argv[])
gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE);
gst_init_with_popt_table (&argc, &argv, options); ctx = g_option_context_new ("gst-launch");
g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
g_print ("Error initializing: %s\n", err->message);
exit (1);
}
/* FIXpopt: strip short args, too. We do it ourselves for now */ /* FIXpopt: strip short args, too. We do it ourselves for now */
j = 1; j = 1;

View file

@ -27,86 +27,24 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <popt.h>
#include <glib.h> #include <glib.h>
enum
{
ARG_MM = 1,
ARG_LIST_MM,
ARG_PRINT,
ARG_HELP
};
/* global statics for option parsing */ /* global statics for option parsing */
static gboolean _print = FALSE; static gboolean _print = FALSE;
static gchar *_arg_mm = NULL; static gchar *_arg_mm = NULL;
static gboolean _arg_list_mm = FALSE; static gboolean _arg_list_mm = FALSE;
/* callback to parse arguments */
static void
popt_callback (poptContext context, enum poptCallbackReason reason,
const struct poptOption *option, const char *arg, void *data)
{
if (reason == POPT_CALLBACK_REASON_OPTION) {
switch (option->val) {
case ARG_MM:
_arg_mm = g_strdup (arg);
break;
case ARG_LIST_MM:
_arg_list_mm = TRUE;
break;
case ARG_PRINT:
_print = TRUE;
break;
case ARG_HELP:
poptPrintHelp (context, stdout, 0);
g_print ("\n");
break;
}
} else {
g_print ("Unknown reason for callback\n");
}
}
/* popt options table for the wrapper */ /* popt options table for the wrapper */
static struct poptOption wrapper_options[] = { static GOptionEntry wrapper_options[] = {
{NULL, '\0', {"print", 'p', 0, G_OPTION_ARG_NONE, &_print,
POPT_ARG_CALLBACK, "print wrapped command line options", NULL},
(void *) &popt_callback, 0, NULL, NULL}, {"gst-mm", 0, 0, G_OPTION_ARG_STRING, &_arg_mm,
{"help", '\0', "Force major/minor version", "VERSION"},
POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN, {"gst-list-mm", 0, 0, G_OPTION_ARG_NONE, &_arg_list_mm,
NULL, ARG_HELP, ("Show help"), NULL}, "List found major/minor versions", NULL},
{"?", '\0', {NULL}
POPT_ARG_NONE | POPT_ARGFLAG_STRIP | POPT_ARGFLAG_ONEDASH
| POPT_ARGFLAG_DOC_HIDDEN,
NULL, ARG_HELP, NULL, NULL},
/* We cheat by specifying -p as long "p" with onedash, so that it
also gets stripped properly from our arg flags */
{"p", '\0',
POPT_ARG_NONE | POPT_ARGFLAG_STRIP | POPT_ARGFLAG_ONEDASH
| POPT_ARGFLAG_DOC_HIDDEN,
NULL, ARG_PRINT, NULL, NULL},
{"print", '\0',
POPT_ARG_NONE | POPT_ARGFLAG_STRIP,
NULL, ARG_PRINT, ("Print wrapped command line"), NULL},
{"gst-mm", '\0',
POPT_ARG_STRING | POPT_ARGFLAG_STRIP,
NULL, ARG_MM, ("Force major/minor version"), NULL},
{"gst-list-mm", '\0',
POPT_ARG_NONE | POPT_ARGFLAG_STRIP,
NULL, ARG_LIST_MM, ("List found major/minor versions"), NULL},
POPT_TABLEEND
}; };
/* helper table including our wrapper options */
static struct poptOption options[] = {
{NULL, '\0', POPT_ARG_INCLUDE_TABLE, wrapper_options, 0,
"Wrapper options:", NULL},
POPT_TABLEEND
};
/* print out the major/minor, which is the hash key */ /* print out the major/minor, which is the hash key */
static void static void
hash_print_key (gchar * key, gchar * value) hash_print_key (gchar * key, gchar * value)
@ -294,18 +232,18 @@ main (int argc, char **argv)
gchar *highest = NULL; gchar *highest = NULL;
gchar *binary; /* actual binary we're going to run */ gchar *binary; /* actual binary we're going to run */
gchar *path = NULL; /* and its path */ gchar *path = NULL; /* and its path */
poptContext ctx; GOptionContext *ctx;
GError *err = NULL;
int nextopt; int nextopt;
/* parse command line options */ /* parse command line options */
ctx = poptGetContext ("gst-run", argc, (const char **) argv, options, 0); ctx = g_option_context_new ("gst-run");
poptReadDefaultConfig (ctx, TRUE); g_option_context_set_ignore_unknown_options (ctx, TRUE);
while ((nextopt = poptGetNextOpt (ctx)) > 0) g_option_context_add_main_entries (ctx, wrapper_options, GETTEXT_PACKAGE);
/* keep looping to parse */ ; if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
g_print ("Error initializing: %s\n", err->message);
argc = poptStrippedArgv (ctx, argc, argv); exit (1);
argv[argc] = NULL; }
poptFreeContext (ctx);
/* detect stuff */ /* detect stuff */
dir = get_dir_of_binary (argv[0]); dir = get_dir_of_binary (argv[0]);

View file

@ -761,15 +761,25 @@ main (int argc, char *argv[])
GstElementFactory *factory; GstElementFactory *factory;
GstPlugin *plugin; GstPlugin *plugin;
gchar *so; gchar *so;
struct poptOption options[] = { GOptionEntry options[] = {
{"gst-inspect-plugin", 'p', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL, 0, {"gst-inspect-plugin", 'p', 0, G_OPTION_ARG_STRING,
"Show plugin details", NULL}, "Show plugin details", NULL},
POPT_TABLEEND {"gst-inspect-scheduler", 's', 0, G_OPTION_ARG_STRING,
"Show scheduler details", NULL},
{NULL}
}; };
GOptionContext *ctx;
GError *err = NULL;
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
gst_init_with_popt_table (&argc, &argv, options); ctx = g_option_context_new ("gst-xmlinspect");
g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
g_print ("Error initializing: %s\n", err->message);
exit (1);
}
PUT_STRING (0, "<?xml version=\"1.0\"?>"); PUT_STRING (0, "<?xml version=\"1.0\"?>");