mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
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:
parent
a1702b7646
commit
ac8289c7a9
16 changed files with 309 additions and 430 deletions
30
ChangeLog
30
ChangeLog
|
@ -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>
|
||||
|
||||
* gst/gstiterator.c: (gst_iterator_new):
|
||||
|
|
30
configure.ac
30
configure.ac
|
@ -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 <gst/gst.h>
|
||||
|
||||
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, &silent, 0,
|
||||
"do not output status information", NULL},
|
||||
{"output", 'o', POPT_ARG_STRING|POPT_ARGFLAG_STRIP, &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, &silent, 0,
|
||||
"do not output status information", NULL },
|
||||
{ "output", 'o', 0, G_OPTION_ARG_STRING, &savefile, 0,
|
||||
"save xml representation of pipeline to FILE and exit", "FILE" },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
gst_init_with_popt_table (&argc, &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, &argc, &argv, &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 =
|
||||
|
||||
|
|
329
gst/gst.c
329
gst/gst.c
|
@ -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;
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
g_option_group_add_entries (group, gst_args);
|
||||
g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
|
||||
|
||||
inited = TRUE;
|
||||
}
|
||||
|
||||
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,130 +366,18 @@ gst_init_check (int *argc, char **argv[])
|
|||
void
|
||||
gst_init (int *argc, char **argv[])
|
||||
{
|
||||
gst_init_with_popt_table (argc, argv, NULL);
|
||||
}
|
||||
GError *err = 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");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
static void
|
||||
add_path_func (gpointer data, gpointer user_data)
|
||||
|
@ -833,29 +724,21 @@ 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;
|
||||
break;
|
||||
case POPT_CALLBACK_REASON_OPTION:
|
||||
switch (option->val) {
|
||||
switch (opt) {
|
||||
case ARG_VERSION:
|
||||
g_print ("GStreamer Core Library version %s\n", GST_VERSION);
|
||||
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_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;
|
||||
|
@ -883,8 +766,7 @@ init_popt_callback (poptContext context, enum poptCallbackReason reason,
|
|||
break;
|
||||
case ARG_PLUGIN_PATH:
|
||||
#ifndef GST_DISABLE_REGISTRY
|
||||
split_and_iterate (arg, G_SEARCHPATH_SEPARATOR_S, add_path_func,
|
||||
NULL);
|
||||
split_and_iterate (arg, G_SEARCHPATH_SEPARATOR_S, add_path_func, NULL);
|
||||
#endif /* GST_DISABLE_REGISTRY */
|
||||
break;
|
||||
case ARG_PLUGIN_LOAD:
|
||||
|
@ -894,16 +776,51 @@ init_popt_callback (poptContext context, enum poptCallbackReason reason,
|
|||
_gst_disable_segtrap = TRUE;
|
||||
break;
|
||||
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;
|
||||
case POPT_CALLBACK_REASON_POST:
|
||||
if (!init_post ())
|
||||
_gst_initialization_failure = TRUE;
|
||||
gst_initialized = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
return parse_one_option (val, arg, err);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
23
gst/gst.h
23
gst/gst.h
|
@ -25,7 +25,6 @@
|
|||
#define __GST_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <popt.h>
|
||||
|
||||
#include <gst/gstenumtypes.h>
|
||||
#include <gst/gstversion.h>
|
||||
|
@ -73,30 +72,14 @@
|
|||
|
||||
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
|
||||
GST_EXPORT gboolean _gst_registry_auto_load;
|
||||
#endif
|
||||
|
||||
/* initialize GST */
|
||||
void gst_init (int *argc, char **argv[]);
|
||||
gboolean gst_init_check (int *argc, char **argv[]);
|
||||
void gst_init_with_popt_table (int *argc, char **argv[],
|
||||
const GstPoptOption
|
||||
*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);
|
||||
gboolean gst_init_check (int *argc, char **argv[],
|
||||
GError ** err);
|
||||
GOptionGroup * gst_init_get_option_group (void);
|
||||
void gst_deinit (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -8,7 +8,7 @@ LAT = lat
|
|||
|
||||
endif
|
||||
|
||||
noinst_PROGRAMS = $(LAT) mass_elements complexity
|
||||
noinst_PROGRAMS = $(LAT) mass_elements complexity init
|
||||
|
||||
AM_CFLAGS = $(GST_OBJ_CFLAGS)
|
||||
LIBS = $(GST_OBJ_LIBS) \
|
||||
|
|
|
@ -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 =
|
||||
|
||||
|
|
|
@ -77,10 +77,10 @@ gst_typefind_SOURCES = gst-run.c
|
|||
gst_xmlinspect_SOURCES = gst-run.c
|
||||
|
||||
# CFLAGS and libs for nonversioned frontend binaries
|
||||
AM_CFLAGS = $(GLIB_ONLY_CFLAGS) $(POPT_CFLAGS)
|
||||
LDADD = $(GLIB_ONLY_LIBS) $(POPT_LIBS)
|
||||
AM_CFLAGS = $(GLIB_ONLY_CFLAGS)
|
||||
LDADD = $(GLIB_ONLY_LIBS)
|
||||
# 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
|
||||
if GST_DISABLE_LOADSAVE
|
||||
|
|
|
@ -1096,11 +1096,13 @@ int
|
|||
main (int argc, char *argv[])
|
||||
{
|
||||
gboolean print_all = FALSE;
|
||||
struct poptOption options[] = {
|
||||
{"print-all", 'a', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &print_all, 0,
|
||||
GOptionEntry options[] = {
|
||||
{"print-all", 'a', 0, G_OPTION_ARG_NONE, &print_all,
|
||||
N_("Print all elements"), NULL},
|
||||
POPT_TABLEEND
|
||||
{NULL}
|
||||
};
|
||||
GOptionContext *ctx;
|
||||
GError *err = NULL;
|
||||
|
||||
#ifdef GETTEXT_PACKAGE
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
|
@ -1108,7 +1110,13 @@ main (int argc, char *argv[])
|
|||
textdomain (GETTEXT_PACKAGE);
|
||||
#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) {
|
||||
g_print ("-a requires no extra arguments\n");
|
||||
|
|
|
@ -489,28 +489,29 @@ main (int argc, char *argv[])
|
|||
gboolean trace = FALSE;
|
||||
gchar *savefile = NULL;
|
||||
gchar *exclude_args = NULL;
|
||||
struct poptOption options[] = {
|
||||
{"tags", 't', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &tags, 0,
|
||||
GOptionEntry options[] = {
|
||||
{"tags", 't', 0, G_OPTION_ARG_NONE, &tags,
|
||||
N_("Output tags (also known as metadata)"), NULL},
|
||||
{"messages", 'm', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &messages, 0,
|
||||
N_("Output messages"), NULL},
|
||||
{"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0,
|
||||
{"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
|
||||
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,...")},
|
||||
#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")},
|
||||
#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},
|
||||
{"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},
|
||||
{"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},
|
||||
POPT_TABLEEND
|
||||
{NULL}
|
||||
};
|
||||
|
||||
GOptionContext *ctx;
|
||||
GError *err = NULL;
|
||||
gchar **argvn;
|
||||
GError *error = NULL;
|
||||
gint res = 0;
|
||||
|
@ -525,7 +526,13 @@ main (int argc, char *argv[])
|
|||
|
||||
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 */
|
||||
j = 1;
|
||||
|
|
|
@ -27,86 +27,24 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <popt.h>
|
||||
#include <glib.h>
|
||||
|
||||
enum
|
||||
{
|
||||
ARG_MM = 1,
|
||||
ARG_LIST_MM,
|
||||
ARG_PRINT,
|
||||
ARG_HELP
|
||||
};
|
||||
|
||||
/* global statics for option parsing */
|
||||
static gboolean _print = FALSE;
|
||||
static gchar *_arg_mm = NULL;
|
||||
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 */
|
||||
static struct poptOption wrapper_options[] = {
|
||||
{NULL, '\0',
|
||||
POPT_ARG_CALLBACK,
|
||||
(void *) &popt_callback, 0, NULL, NULL},
|
||||
{"help", '\0',
|
||||
POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN,
|
||||
NULL, ARG_HELP, ("Show help"), NULL},
|
||||
{"?", '\0',
|
||||
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
|
||||
static GOptionEntry wrapper_options[] = {
|
||||
{"print", 'p', 0, G_OPTION_ARG_NONE, &_print,
|
||||
"print wrapped command line options", NULL},
|
||||
{"gst-mm", 0, 0, G_OPTION_ARG_STRING, &_arg_mm,
|
||||
"Force major/minor version", "VERSION"},
|
||||
{"gst-list-mm", 0, 0, G_OPTION_ARG_NONE, &_arg_list_mm,
|
||||
"List found major/minor versions", NULL},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
/* 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 */
|
||||
static void
|
||||
hash_print_key (gchar * key, gchar * value)
|
||||
|
@ -294,18 +232,18 @@ main (int argc, char **argv)
|
|||
gchar *highest = NULL;
|
||||
gchar *binary; /* actual binary we're going to run */
|
||||
gchar *path = NULL; /* and its path */
|
||||
poptContext ctx;
|
||||
GOptionContext *ctx;
|
||||
GError *err = NULL;
|
||||
int nextopt;
|
||||
|
||||
/* parse command line options */
|
||||
ctx = poptGetContext ("gst-run", argc, (const char **) argv, options, 0);
|
||||
poptReadDefaultConfig (ctx, TRUE);
|
||||
while ((nextopt = poptGetNextOpt (ctx)) > 0)
|
||||
/* keep looping to parse */ ;
|
||||
|
||||
argc = poptStrippedArgv (ctx, argc, argv);
|
||||
argv[argc] = NULL;
|
||||
poptFreeContext (ctx);
|
||||
ctx = g_option_context_new ("gst-run");
|
||||
g_option_context_set_ignore_unknown_options (ctx, TRUE);
|
||||
g_option_context_add_main_entries (ctx, wrapper_options, GETTEXT_PACKAGE);
|
||||
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
|
||||
g_print ("Error initializing: %s\n", err->message);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* detect stuff */
|
||||
dir = get_dir_of_binary (argv[0]);
|
||||
|
|
|
@ -761,15 +761,25 @@ main (int argc, char *argv[])
|
|||
GstElementFactory *factory;
|
||||
GstPlugin *plugin;
|
||||
gchar *so;
|
||||
struct poptOption options[] = {
|
||||
{"gst-inspect-plugin", 'p', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL, 0,
|
||||
GOptionEntry options[] = {
|
||||
{"gst-inspect-plugin", 'p', 0, G_OPTION_ARG_STRING,
|
||||
"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, "");
|
||||
|
||||
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\"?>");
|
||||
|
||||
|
|
Loading…
Reference in a new issue