[snappy] engine: rename toggle_streams() to cycle_streams()
- From: Luis de Bethencourt <luisbg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snappy] engine: rename toggle_streams() to cycle_streams()
- Date: Sat, 28 Apr 2012 13:35:01 +0000 (UTC)
commit 0fedfcd26f563b722c4b4215490c2850ab46e3b8
Author: Luis de Bethencourt <luis debethencourt com>
Date: Sat Apr 28 10:42:25 2012 +0100
engine: rename toggle_streams() to cycle_streams()
src/gst_engine.c | 75 ++++++++++++++++++++++++++------------------------
src/gst_engine.h | 2 +-
src/user_interface.c | 6 ++--
3 files changed, 43 insertions(+), 40 deletions(-)
---
diff --git a/src/gst_engine.c b/src/gst_engine.c
index b14da55..20c9a93 100644
--- a/src/gst_engine.c
+++ b/src/gst_engine.c
@@ -524,6 +524,43 @@ change_state (GstEngine * engine, gchar * state)
}
+/* Cycle through streams */
+gboolean
+cycle_streams (GstEngine * engine, guint streamid)
+{
+ gboolean last_stream = FALSE;
+ gint current;
+ gint streams;
+ gchar *n;
+ gchar *c;
+
+ if (streamid == STREAM_AUDIO) {
+ n = "n-audio";
+ c = "current-audio";
+ } else if (streamid == STREAM_TEXT) {
+ n = "n-text";
+ c = "current-text";
+ } else if (streamid == STREAM_VIDEO) {
+ n = "n-video";
+ c = "current-video";
+ }
+
+ g_object_get (G_OBJECT (engine->player), n, &streams, NULL);
+ g_object_get (G_OBJECT (engine->player), c, ¤t, NULL);
+
+ if (current < (streams - 1)) {
+ current++;
+ } else {
+ current = 0;
+ last_stream = TRUE;
+ }
+
+ g_object_set (G_OBJECT (engine->player), c, current, NULL);
+
+ return TRUE;
+}
+
+
/* Init GstEngine variables */
gboolean
engine_init (GstEngine * engine, GstElement * sink)
@@ -753,41 +790,6 @@ set_subtitle_uri (GstEngine * engine, gchar * suburi)
g_object_set (G_OBJECT (engine->player), "suburi", suburi, NULL);
}
-/* Toggle streams */
-gboolean
-toggle_streams (GstEngine * engine, guint streamid)
-{
- gboolean last_stream = FALSE;
- gint current;
- gint streams;
- gchar *n;
- gchar *c;
-
- if (streamid == STREAM_AUDIO) {
- n = "n-audio";
- c = "current-audio";
- } else if (streamid == STREAM_TEXT) {
- n = "n-text";
- c = "current-text";
- } else if (streamid == STREAM_VIDEO) {
- n = "n-video";
- c = "current-video";
- }
-
- g_object_get (G_OBJECT (engine->player), n, &streams, NULL);
- g_object_get (G_OBJECT (engine->player), c, ¤t, NULL);
-
- if (current < (streams - 1)) {
- current++;
- } else {
- current = 0;
- last_stream = TRUE;
- }
-
- g_object_set (G_OBJECT (engine->player), c, current, NULL);
-
- return TRUE;
-}
/* Toggle subtitles */
gboolean
@@ -800,7 +802,7 @@ toggle_subtitles (GstEngine * engine)
sub_state = flags & (1 << 2);
if (sub_state) { // If subtitles on, cycle streams and if last turn off
- if (toggle_streams (engine, STREAM_TEXT)) {
+ if (cycle_streams (engine, STREAM_TEXT)) {
flags &= ~(1 << 2);
g_object_set (G_OBJECT (engine->player), "flags", flags, NULL);
}
@@ -813,6 +815,7 @@ toggle_subtitles (GstEngine * engine)
return TRUE;
}
+
/* Update duration of URI streams */
gboolean
update_media_duration (GstEngine * engine)
diff --git a/src/gst_engine.h b/src/gst_engine.h
index 11f2e63..d180913 100644
--- a/src/gst_engine.h
+++ b/src/gst_engine.h
@@ -55,6 +55,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);
+gboolean cycle_streams (GstEngine * engine, guint streamid);
gboolean engine_init (GstEngine * engine, GstElement * sink);
gboolean engine_load_uri (GstEngine * engine, gchar * uri);
gboolean engine_open_uri (GstEngine * engine, gchar * uri);
@@ -67,7 +68,6 @@ gchar **get_recently_viewed ();
GstState get_state (GstEngine * engine);
gint64 query_position (GstEngine * engine);
gboolean set_subtitle_uri (GstEngine * engine, gchar *suburi);
-gboolean toggle_streams (GstEngine * engine, guint streamid);
gboolean toggle_subtitles (GstEngine * engine);
gboolean update_media_duration (GstEngine * engine);
diff --git a/src/user_interface.c b/src/user_interface.c
index 54f280e..2d5bcec 100644
--- a/src/user_interface.c
+++ b/src/user_interface.c
@@ -266,7 +266,7 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
else if (keyval == CLUTTER_underscore)
streamid = STREAM_VIDEO;
- toggle_streams (ui->engine, streamid);
+ cycle_streams (ui->engine, streamid);
handled = TRUE;
break;
@@ -340,13 +340,13 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
}
} else if (actor == ui->audio_stream_toggle) {
- toggle_streams (ui->engine, STREAM_AUDIO);
+ cycle_streams (ui->engine, STREAM_AUDIO);
} else if (actor == ui->subtitle_toggle) {
toggle_subtitles (ui->engine);
} else if (actor == ui->video_stream_toggle) {
- toggle_streams (ui->engine, STREAM_VIDEO);
+ cycle_streams (ui->engine, STREAM_VIDEO);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]