diff --git a/ChangeLog b/ChangeLog index 5eacbdf938..b3243433db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2005-07-24 Benjamin Otte + + * po/POTFILES.in: + * tools/Makefile.am: + * tools/tools.h: + add tools.h for common stuff of all our tools. Currently does what's + necessary for the --version command line switch. + * tools/gst-compprep.c: (main): + * tools/gst-inspect.c: (main): + * tools/gst-launch.1.in: + * tools/gst-launch.c: (main): + * tools/gst-md5sum.1.in: + * tools/gst-md5sum.c: (main): + * tools/gst-register.1.in: + * tools/gst-register.c: (main): + * tools/gst-typefind.1.in: + * tools/gst-typefind.c: (main): + * tools/gst-xmlinspect.1.in: + * tools/gst-xmlinspect.c: (main): + * tools/gst-xmllaunch.1.in: + add and document --version switch to all tools. + 2005-07-02 Tim-Philipp Müller * gst/gstelement.c: diff --git a/common b/common index 4ca96aedcf..694de4dbf4 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 4ca96aedcf2be0b3dcf31fce732aed1da21b8850 +Subproject commit 694de4dbf4827f372321f0634643a254d7edd986 diff --git a/po/POTFILES.in b/po/POTFILES.in index 53c46ba92d..47ab477f00 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -16,3 +16,4 @@ gst/parse/grammar.y tools/gst-inspect.c tools/gst-launch.c tools/gst-register.c +tools/tools.h diff --git a/tools/Makefile.am b/tools/Makefile.am index f4f09573cb..c841b90b8d 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -39,6 +39,8 @@ bin_PROGRAMS = \ $(GST_OTHER_SRC) $(GST_OTHER_SRC_V) bin_SCRIPTS = gst-feedback-@GST_MAJORMINOR@ +noinst_HEADERS = tools.h + # make sure each versioned tool has the right source file and flags if !GST_DISABLE_REGISTRY gst_register_@GST_MAJORMINOR@_SOURCES = gst-register.c diff --git a/tools/gst-compprep.c b/tools/gst-compprep.c index d7088e38e2..94c27ae951 100644 --- a/tools/gst-compprep.c +++ b/tools/gst-compprep.c @@ -1,11 +1,6 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - +#include "tools.h" #include -#include - GST_DEBUG_CATEGORY_STATIC (debug_compprep); #define GST_CAT_DEFAULT debug_compprep #define GST_COMPREG_FILE (GST_CACHE_DIR "/compreg.xml") @@ -33,10 +28,15 @@ main (int argc, char *argv[]) GstPadTemplate *padtemplate; GParamSpec **property_specs; guint num_properties, i; + struct poptOption options[] = { + GST_TOOLS_POPT_VERSION, + POPT_TABLEEND + }; setlocale (LC_ALL, ""); - gst_init (&argc, &argv); + gst_init_with_popt_table (&argc, &argv, options); + gst_tools_print_version ("gst-compprep-0.8"); GST_DEBUG_CATEGORY_INIT (debug_compprep, "compprep", GST_DEBUG_BOLD, "gst-compprep application"); diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 382412c0bc..33478a5d60 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -21,15 +21,9 @@ * Boston, MA 02111-1307, USA. */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include +#include "tools.h" #include -#include "gst/gst-i18n-app.h" - #include #include #include @@ -1164,6 +1158,7 @@ main (int argc, char *argv[]) { gboolean print_all = FALSE; struct poptOption options[] = { + GST_TOOLS_POPT_VERSION, {"print-all", 'a', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &print_all, 0, N_("Print all elements"), NULL}, POPT_TABLEEND @@ -1176,6 +1171,7 @@ main (int argc, char *argv[]) #endif gst_init_with_popt_table (&argc, &argv, options); + gst_tools_print_version ("gst-inspect-0.8"); gst_control_init (&argc, &argv); if (print_all && argc > 2) { diff --git a/tools/gst-launch.1.in b/tools/gst-launch.1.in index 90c241d16e..6a38bd8a76 100644 --- a/tools/gst-launch.1.in +++ b/tools/gst-launch.1.in @@ -23,6 +23,9 @@ For a complete description of possible PIPELINE-DESCRIPTIONS see above under .B \-\-help Print help synopsis and available FLAGS .TP 8 +.B \-i, \-\-iterations=N +Stop processing after N iterations. +.TP 8 .B \-v, \-\-silent Output status information .TP 8 @@ -42,8 +45,8 @@ work. .B \-t, \-\-tags Print tags found in the streams, if any. .TP 8 -.B \-i, \-\-iterations=N -Stop processing after N iterations. +.B \-\-version +Show version information and exit. . .SH "GSTREAMER OPTIONS" diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 17393aad18..c369accf08 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -21,15 +21,14 @@ * Boston, MA 02111-1307, USA. */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif /* FIXME: hack alert */ #ifdef _MSC_VER #define DISABLE_FAULT_HANDLER #endif +#include "tools.h" + #include #include #include @@ -40,9 +39,6 @@ #include #endif #include /* for LC_ALL */ -#include "gst/gst-i18n-app.h" - -#include /* FIXME: This is just a temporary hack. We should have a better * check for siginfo handling. */ @@ -408,6 +404,7 @@ main (int argc, char *argv[]) gchar *savefile = NULL; gchar *exclude_args = NULL; struct poptOption options[] = { + GST_TOOLS_POPT_VERSION, {"tags", 't', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &tags, 0, N_("Output tags (also known as metadata)"), NULL}, {"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0, @@ -442,6 +439,7 @@ main (int argc, char *argv[]) gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); gst_init_with_popt_table (&argc, &argv, options); + gst_tools_print_version ("gst-launch-0.8"); /* FIXpopt: strip short args, too. We do it ourselves for now */ j = 1; diff --git a/tools/gst-md5sum.1.in b/tools/gst-md5sum.1.in index 90fc69443f..a3ae52f587 100644 --- a/tools/gst-md5sum.1.in +++ b/tools/gst-md5sum.1.in @@ -50,31 +50,10 @@ Enable printout of errors while loading \fIGStreamer\fP plugins .TP 8 .B \-\-gst\-plugin\-path=PATH Add directories separated with ':' to the plugin search path +.TP 8 +.B \-\-version +Show version information and exit. .SH "SEE ALSO" .BR gst\-launch (1) .SH "AUTHOR" The GStreamer team at http://gstreamer.net/ -*************** -*** 16,24 **** - - md5sum music.mp3 - - The pipeline should be incomplete, that is, a final sink element -- should be omitted, so that gst\-md5sum can connect the pipeline to -- an md5sink element. - - See the man page for gst\-launch or the GStreamer docuementation for - more information on how to create a PARTIAL\-PIPELINE\-DESCRIPTION. ---- 16,27 ---- - - md5sum music.mp3 - -+ If the pipeline contains an md5sink element, gst-md5sum will query it -+ for the md5sum at the end of pipeline iteration. -+ -+ If it doesn't contain an md5sink element, gst-md5sum will automatically -+ connect an md5sink to the right hand side of the given pipeline. - The pipeline should be incomplete, that is, a final sink element - - See the man page for gst\-launch or the GStreamer docuementation for - more information on how to create a PARTIAL\-PIPELINE\-DESCRIPTION. diff --git a/tools/gst-md5sum.c b/tools/gst-md5sum.c index 3101c85679..9e1a42a02d 100644 --- a/tools/gst-md5sum.c +++ b/tools/gst-md5sum.c @@ -1,10 +1,7 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "tools.h" #include #include -#include #include static guint64 iterations = 0; @@ -53,6 +50,7 @@ main (int argc, char *argv[]) gboolean verbose = FALSE; gchar *exclude_args = NULL; struct poptOption options[] = { + GST_TOOLS_POPT_VERSION, {"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0, "do not output status information", NULL}, POPT_TABLEEND @@ -69,6 +67,7 @@ main (int argc, char *argv[]) setlocale (LC_ALL, ""); gst_init_with_popt_table (&argc, &argv, options); + gst_tools_print_version ("gst-md5sum-0.8"); /* make a parseable argvn array */ argvn = g_new0 (char *, argc); diff --git a/tools/gst-register.1.in b/tools/gst-register.1.in index bf23ffa725..06ea61e50a 100644 --- a/tools/gst-register.1.in +++ b/tools/gst-register.1.in @@ -40,6 +40,9 @@ Use SCHEDULER as the default scheduler .TP 8 .B \-\-gst\-registry=REGISTRY Use the file REGISTRY as registry instead of the default +.TP 8 +.B \-\-version +Show version information and exit. .SH FILES .TP 8 diff --git a/tools/gst-register.c b/tools/gst-register.c index 50901e42ee..b7239cf892 100644 --- a/tools/gst-register.c +++ b/tools/gst-register.c @@ -20,11 +20,7 @@ * Boston, MA 02111-1307, USA. */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include +#include "tools.h" #include #include @@ -37,8 +33,6 @@ #include #include -#include "gst/gst-i18n-app.h" - static gint num_features = 0; static gint num_plugins = 0; @@ -82,6 +76,10 @@ main (int argc, char *argv[]) { GList *registries; GList *path_spill = NULL; /* used for path spill from failing registries */ + struct poptOption options[] = { + GST_TOOLS_POPT_VERSION, + POPT_TABLEEND + }; #ifdef GETTEXT_PACKAGE bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); @@ -91,7 +89,8 @@ main (int argc, char *argv[]) /* Init gst */ _gst_registry_auto_load = FALSE; - gst_init (&argc, &argv); + gst_init_with_popt_table (&argc, &argv, options); + gst_tools_print_version ("gst-register-0.8"); registries = gst_registry_pool_list (); registries = g_list_reverse (registries); diff --git a/tools/gst-typefind.1.in b/tools/gst-typefind.1.in index 9909f71a97..05452c6698 100644 --- a/tools/gst-typefind.1.in +++ b/tools/gst-typefind.1.in @@ -31,6 +31,9 @@ Enable printout of errors while loading \fIGStreamer\fP plugins .TP 8 .B \-\-gst\-plugin\-path=PATH Add directories separated with ':' to the plugin search path +.TP 8 +.B \-\-version +Show version information and exit. .SH SEE ALSO .BR gst\-register (1), .BR gst\-launch (1) diff --git a/tools/gst-typefind.c b/tools/gst-typefind.c index 7ea6034e93..c800a5f0dc 100644 --- a/tools/gst-typefind.c +++ b/tools/gst-typefind.c @@ -1,11 +1,8 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "tools.h" #include #include #include -#include /* * find the type of a media file and display it's properties @@ -37,10 +34,15 @@ main (int argc, char *argv[]) guint i = 1; GstElement *pipeline; GstElement *source, *typefind; + struct poptOption options[] = { + GST_TOOLS_POPT_VERSION, + POPT_TABLEEND + }; setlocale (LC_ALL, ""); - gst_init (&argc, &argv); + gst_init_with_popt_table (&argc, &argv, options); + gst_tools_print_version ("gst-typefind-0.8"); if (argc < 2) { g_print ("Please give a filename to typefind\n\n"); diff --git a/tools/gst-xmlinspect.1.in b/tools/gst-xmlinspect.1.in index 429dab0cec..9793930e0f 100644 --- a/tools/gst-xmlinspect.1.in +++ b/tools/gst-xmlinspect.1.in @@ -41,6 +41,9 @@ Enable printout of errors while loading \fIGStreamer\fP plugins .TP 8 .B \-\-gst\-plugin\-path=PATH Add directories separated with ':' to the plugin search path +.TP 8 +.B \-\-version +Show version information and exit. .SH SEE ALSO .BR gst\-register (1), .BR gst\-launch (1) diff --git a/tools/gst-xmlinspect.c b/tools/gst-xmlinspect.c index 69c59e6d58..5e2639e4d9 100644 --- a/tools/gst-xmlinspect.c +++ b/tools/gst-xmlinspect.c @@ -1,8 +1,5 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "tools.h" -#include #include #include #include @@ -863,17 +860,19 @@ main (int argc, char *argv[]) GstPlugin *plugin; gchar *so; struct poptOption options[] = { + GST_TOOLS_POPT_VERSION, {"gst-inspect-plugin", 'p', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL, 0, - "Show plugin details", NULL}, + N_("Show plugin details"), NULL}, {"gst-inspect-scheduler", 's', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL, 0, - "Show scheduler details", NULL}, + N_("Show scheduler details"), NULL}, POPT_TABLEEND }; setlocale (LC_ALL, ""); gst_init_with_popt_table (&argc, &argv, options); + gst_tools_print_version ("gst-xmlinspect-0.8"); gst_control_init (&argc, &argv); PUT_STRING (0, ""); diff --git a/tools/gst-xmllaunch.1.in b/tools/gst-xmllaunch.1.in index c6a3ba36b7..39838065ba 100644 --- a/tools/gst-xmllaunch.1.in +++ b/tools/gst-xmllaunch.1.in @@ -55,6 +55,9 @@ Enable printout of errors while loading \fIGStreamer\fP plugins .TP 8 .B \-\-gst\-plugin\-path=PATH Add directories separated with ':' to the plugin search path +.TP 8 +.B \-\-version +Show version information and exit. .SH "SEE ALSO" .BR gst\-launch (1), .BR gst\-register (1), diff --git a/tools/tools.h b/tools/tools.h new file mode 100644 index 0000000000..7899561923 --- /dev/null +++ b/tools/tools.h @@ -0,0 +1,62 @@ +/* GStreamer + * Copyright (C) 2005 Benjamin Otte + * + * tools.h: header for common stuff of all GStreamer tools + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + +#ifndef __GST_TOOLS_H__ +#define __GST_TOOLS_H__ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include "gst/gst-i18n-app.h" + +/* + * This is a kind of hacky way to make all the tools use the same version code. + * If anyone knows a less hacky way to get this done, feel free to implement it. + * + * It also includes all the files that all the tools require. + */ + +static gboolean __gst_tools_version = FALSE; + +#define GST_TOOLS_POPT_VERSION {"version", '\0', POPT_ARG_NONE, \ + &__gst_tools_version, 0, N_("print version information and exit"), NULL} + +void +gst_tools_print_version (const char *program) +{ + if (__gst_tools_version) { + gint major, minor, micro; + + gst_version (&major, &minor, µ); + g_print ("GStreamer (%s) %s %s\n\n", program, GST_PACKAGE, GST_VERSION); + g_print ("provided by %s\n", GST_ORIGIN); + g_print ("release %s\n", GST_VERSION_RELEASE); + g_print ("using GStreamer Core Library version %d.%d.%d\n", major, minor, micro); + exit (0); + } + g_set_prgname (program); +} + +#endif /* __GST_TOOLS_H__ */