|
1 /* GStreamer |
|
2 * Copyright (C) 2005 Benjamin Otte <otte@gnome.org> |
|
3 * |
|
4 * tools.h: header for common stuff of all GStreamer tools |
|
5 * |
|
6 * This library is free software; you can redistribute it and/or |
|
7 * modify it under the terms of the GNU Library General Public |
|
8 * License as published by the Free Software Foundation; either |
|
9 * version 2 of the License, or (at your option) any later version. |
|
10 * |
|
11 * This library is distributed in the hope that it will be useful, |
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 * Library General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU Library General Public |
|
17 * License along with this library; if not, write to the |
|
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
19 * Boston, MA 02111-1307, USA. |
|
20 */ |
|
21 |
|
22 |
|
23 #ifndef __GST_TOOLS_H__ |
|
24 #define __GST_TOOLS_H__ |
|
25 |
|
26 #include <stdlib.h> |
|
27 |
|
28 #include <gst/gst.h> |
|
29 #include "gst/gst-i18n-app.h" |
|
30 |
|
31 /* |
|
32 * This is a kind of hacky way to make all the tools use the same version code. |
|
33 * If anyone knows a less hacky way to get this done, feel free to implement it. |
|
34 * |
|
35 * It also includes all the files that all the tools require. |
|
36 */ |
|
37 |
|
38 static gboolean __gst_tools_version = FALSE; |
|
39 |
|
40 #define GST_TOOLS_GOPTION_VERSION \ |
|
41 { "version", 0, 0, G_OPTION_ARG_NONE, &__gst_tools_version, \ |
|
42 N_("Print version information and exit"), NULL } |
|
43 |
|
44 static void |
|
45 gst_tools_print_version (const gchar * tool) |
|
46 { |
|
47 gchar *s; |
|
48 |
|
49 s = g_strdup_printf ("%s-%u.%u", tool, GST_VERSION_MAJOR, GST_VERSION_MINOR); |
|
50 g_set_prgname (s); |
|
51 g_free (s); |
|
52 |
|
53 if (__gst_tools_version) { |
|
54 gchar *version_str; |
|
55 |
|
56 version_str = gst_version_string (); |
|
57 g_print ("%s version %u.%u.%u\n", g_get_prgname (), |
|
58 GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO); |
|
59 g_print ("%s\n", version_str); |
|
60 g_print ("%s\n", GST_PACKAGE_ORIGIN); |
|
61 g_free (version_str); |
|
62 exit (0); |
|
63 } |
|
64 } |
|
65 |
|
66 #endif /* __GST_TOOLS_H__ */ |