2 * Copyright (C) 2008 Rov Juvano <rovjuvano@users.sourceforge.net>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 main (int argc
, char *argv
[])
27 gchar
**filenames
= NULL
;
29 pipeline_args
*args
= &t
;
31 args
->israwfile
= FALSE
;
32 args
->filter_name
= "identity";
33 args
->param_name
= NULL
;
36 args
->num_buffers
= 0;
37 args
->noaudio
= FALSE
;
38 args
->novideo
= FALSE
;
40 const GOptionEntry entries
[] = {
41 { "silent", 's', 0, G_OPTION_ARG_NONE
, &(args
->silent
),
42 "do not output status information", NULL
},
43 { "raw", '\0', 0, G_OPTION_ARG_NONE
, &(args
->israwfile
),
44 "file is raw 32bit-PCM 2ch/LE @ 44100Hz", "FILE" },
45 { "filter", '\0', 0, G_OPTION_ARG_STRING
, &(args
->filter_name
),
47 { "param", '\0', 0, G_OPTION_ARG_STRING
, &(args
->param_name
),
48 "scale parameter name", "NAME" },
49 { "scale", 's', 0, G_OPTION_ARG_DOUBLE
, &(args
->scale
),
50 "playback rate", "FLOAT" },
51 { "temp", '\0', 0, G_OPTION_ARG_DOUBLE
, &(args
->temp
),
53 { "num_buffers", '\0', 0, G_OPTION_ARG_INT
, &(args
->num_buffers
),
54 "number of buffers to play", "INT" },
55 { G_OPTION_REMAINING
, 0, 0, G_OPTION_ARG_FILENAME_ARRAY
, &filenames
,
56 "Special option that collects any remaining arguments for us" },
62 /* Before calling any GLib or GStreamer function, we must initialise
63 * the GLib threading system */
64 if (!g_thread_supported())
67 ctx
= g_option_context_new ("[FILE1] [FILE2] ...");
68 g_option_context_add_group (ctx
, gst_init_get_option_group ());
69 g_option_context_add_main_entries (ctx
, entries
, NULL
);
71 if (!g_option_context_parse (ctx
, &argc
, &argv
, &err
)) {
72 g_print ("Error initializing: %s\n", GST_STR_NULL (err
->message
));
76 g_option_context_free (ctx
);
78 if (filenames
== NULL
|| *filenames
== NULL
) {
79 g_print ("Please specify a file to play\n\n");
83 if (args
->scale
!= 1.0 && !args
->param_name
) {
84 g_print("\n** WARNING: scale set but not param **\n\n");
88 lauch_gui(&argc
, &argv
, filenames
, args
);
90 g_strfreev (filenames
);