add tools.h for common stuff of all our tools. Currently does what's necessary for the --version command line switch.

Original commit message from CVS:
* 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.
This commit is contained in:
Benjamin Otte 2005-07-24 21:05:46 +00:00
parent 7144588926
commit cf2c17a13d
18 changed files with 144 additions and 70 deletions

View file

@ -1,3 +1,25 @@
2005-07-24 Benjamin Otte <otte@gnome.org>
* 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 <tim at centricular dot net>
* gst/gstelement.c:

2
common

@ -1 +1 @@
Subproject commit 4ca96aedcf2be0b3dcf31fce732aed1da21b8850
Subproject commit 694de4dbf4827f372321f0634643a254d7edd986

View file

@ -16,3 +16,4 @@ gst/parse/grammar.y
tools/gst-inspect.c
tools/gst-launch.c
tools/gst-register.c
tools/tools.h

View file

@ -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

View file

@ -1,11 +1,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "tools.h"
#include <locale.h>
#include <gst/gst.h>
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");

View file

@ -21,15 +21,9 @@
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gst/gst.h>
#include "tools.h"
#include <gst/control/control.h>
#include "gst/gst-i18n-app.h"
#include <string.h>
#include <locale.h>
#include <glib/gprintf.h>
@ -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) {

View file

@ -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"

View file

@ -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 <string.h>
#include <stdlib.h>
#include <signal.h>
@ -40,9 +39,6 @@
#include <sys/wait.h>
#endif
#include <locale.h> /* for LC_ALL */
#include "gst/gst-i18n-app.h"
#include <gst/gst.h>
/* 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;

View file

@ -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.

View file

@ -1,10 +1,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "tools.h"
#include <string.h>
#include <stdlib.h>
#include <gst/gst.h>
#include <locale.h>
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);

View file

@ -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

View file

@ -20,11 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gst/gst.h>
#include "tools.h"
#include <stdlib.h>
#include <stdio.h>
@ -37,8 +33,6 @@
#include <errno.h>
#include <locale.h>
#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);

View file

@ -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)

View file

@ -1,11 +1,8 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "tools.h"
#include <string.h>
#include <stdlib.h>
#include <locale.h>
#include <gst/gst.h>
/*
* 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");

View file

@ -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)

View file

@ -1,8 +1,5 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "tools.h"
#include <gst/gst.h>
#include <gst/control/control.h>
#include <string.h>
#include <locale.h>
@ -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, "<?xml version=\"1.0\"?>");

View file

@ -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),

62
tools/tools.h Normal file
View file

@ -0,0 +1,62 @@
/* GStreamer
* Copyright (C) 2005 Benjamin Otte <otte@gnome.org>
*
* 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 <stdlib.h>
#include <gst/gst.h>
#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, &micro);
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__ */