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
[])
28 gboolean no_gui
= FALSE
;
29 gchar
*filter_name
= "identity";
31 const GOptionEntry entries
[] = {
32 { "filter", '\0', 0, G_OPTION_ARG_STRING
, &filter_name
,
34 { "no-gui", '\0', 0, G_OPTION_ARG_NONE
, &no_gui
,
35 "do not lauch GUI", NULL
},
36 { G_OPTION_REMAINING
, 0, 0, G_OPTION_ARG_FILENAME_ARRAY
, &uris
,
37 "Special option that collects any remaining arguments for us" },
43 /* Before calling any GLib or GStreamer function, we must initialise
44 * the GLib threading system */
45 if (!g_thread_supported())
48 ctx
= g_option_context_new ("[ --filter=<plugin> ] uri ...");
49 g_option_context_add_group (ctx
, gst_init_get_option_group ());
50 g_option_context_add_main_entries (ctx
, entries
, NULL
);
52 if (!g_option_context_parse (ctx
, &argc
, &argv
, &err
)) {
53 g_print ("Error initializing: %s\n", GST_STR_NULL (err
->message
));
57 g_option_context_free (ctx
);
59 if (uris
== NULL
|| *uris
== NULL
) {
60 g_print ("Please specify a URI to play\n\n");
64 gint i
, num
= g_strv_length (uris
);
65 gpointer
*window_ref
= NULL
;
67 for (i
= 0; i
< num
; i
++) {
69 tui_play_uri(uris
[i
], filter_name
);
71 if (!window_ref
|| !*window_ref
)
72 gui_build(argc
, argv
, &window_ref
);
73 gui_play_uri(uris
[i
], filter_name
);