Commit f61a31fb authored by Luis de Bethencourt's avatar Luis de Bethencourt

engine: loop correctly through subtitle streams

parent c8c24b4d
......@@ -632,7 +632,7 @@ change_state (GstEngine * engine, gchar * state)
/* Cycle through streams */
void
gboolean
cycle_streams (GstEngine * engine, guint streamid)
{
gboolean last_stream = FALSE;
......@@ -665,8 +665,9 @@ cycle_streams (GstEngine * engine, guint streamid)
current = 0;
last_stream = TRUE;
}
g_object_set (G_OBJECT (engine->player), c, current, NULL);
return last_stream;
}
......@@ -944,16 +945,18 @@ gboolean
toggle_subtitles (GstEngine * engine)
{
gint flags;
gboolean last_stream;
gboolean sub_state;
g_object_get (G_OBJECT (engine->player), "flags", &flags, NULL);
sub_state = flags & (1 << 2);
if (sub_state) { // If subtitles on, cycle streams and if last turn off
cycle_streams (engine, STREAM_TEXT);
flags &= ~(1 << 2);
g_object_set (G_OBJECT (engine->player), "flags", flags, NULL);
last_stream = cycle_streams (engine, STREAM_TEXT);
if (last_stream) {
flags &= ~(1 << 2);
g_object_set (G_OBJECT (engine->player), "flags", flags, NULL);
}
} else { // If subtitles off, turn them on
flags |= (1 << 2);
g_object_set (G_OBJECT (engine->player), "flags", flags, NULL);
......
......@@ -63,7 +63,7 @@ gboolean add_uri_unfinished (GstEngine * engine);
gboolean at_the_eos (GstEngine * engine);
gboolean bus_call (GstBus * bus, GstMessage * msg, gpointer data);
gboolean change_state (GstEngine * engine, gchar * state);
void cycle_streams (GstEngine * engine, guint streamid);
gboolean cycle_streams (GstEngine * engine, guint streamid);
gboolean engine_init (GstEngine * engine, GstElement * sink);
void engine_load_uri (GstEngine * engine, gchar * uri);
void engine_open_uri (GstEngine * engine, gchar * uri);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment