static GstPlay *
play_new (gchar ** uris, const gchar * audio_sink, const gchar * video_sink,
- gboolean gapless, gdouble initial_volume, gboolean verbose, int flags)
+ gboolean gapless, gdouble initial_volume, gboolean verbose,
+ const gchar * flags_string)
{
GstElement *sink, *playbin;
GstPlay *play;
g_warning ("Couldn't create specified video sink '%s'", video_sink);
}
- if (flags)
- g_object_set (play->playbin, "flags", flags, NULL);
+ if (flags_string != NULL) {
+ GParamSpec *pspec;
+ GValue val = { 0, };
+
+ pspec =
+ g_object_class_find_property (G_OBJECT_GET_CLASS (playbin), "flags");
+ g_value_init (&val, pspec->value_type);
+ if (gst_value_deserialize (&val, flags_string))
+ g_object_set_property (G_OBJECT (play->playbin), "flags", &val);
+ else
+ g_printerr ("Couldn't convert '%s' to playbin flags!\n", flags_string);
+ g_value_unset (&val);
+ }
if (verbose) {
play->deep_notify_id = g_signal_connect (play->playbin, "deep-notify",
g_object_set (play->playbin, "uri", next_uri, NULL);
play->cur_idx = next_idx;
-
- g_object_set (play->playbin, "-v", NULL);
}
static void
{
N_("space"), N_("pause/unpause")}, {
N_("q or ESC"), N_("quit")}, {
- ">", N_("play next")}, {
- "<", N_("play previous")}, {
+ N_("> or n"), N_("play next")}, {
+ N_("< or b"), N_("play previous")}, {
"\342\206\222", N_("seek forward")}, {
"\342\206\220", N_("seek backward")}, {
"\342\206\221", N_("volume up")}, {
case 'Q':
g_main_loop_quit (play->loop);
break;
+ case 'n':
case '>':
if (!play_next (play)) {
g_print ("\n%s\n", _("Reached end of play list."));
g_main_loop_quit (play->loop);
}
break;
+ case 'b':
case '<':
play_prev (play);
break;
GstPlay *play;
GPtrArray *playlist;
gboolean verbose = FALSE;
- int flags = 0;
gboolean print_version = FALSE;
gboolean interactive = TRUE;
gboolean gapless = FALSE;
gchar *audio_sink = NULL;
gchar *video_sink = NULL;
gchar **uris;
+ gchar *flags = NULL;
guint num, i;
GError *err = NULL;
GOptionContext *ctx;
GOptionEntry options[] = {
{"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
N_("Output status information and property notifications"), NULL},
- {"flags", 0, 0, G_OPTION_ARG_INT, &flags,
+ {"flags", 0, 0, G_OPTION_ARG_STRING, &flags,
N_("Control playback behaviour setting playbin 'flags' property"),
NULL},
{"version", 0, 0, G_OPTION_ARG_NONE, &print_version,
g_free (video_sink);
g_print ("\n");
+ gst_deinit ();
return 0;
}