[snappy] engine: stream selection from if-else to switch
- From: Luis de Bethencourt <luisbg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snappy] engine: stream selection from if-else to switch
- Date: Sat, 28 Apr 2012 13:35:06 +0000 (UTC)
commit 9d5dbd675876037b3071986d87fca930191f680a
Author: Luis de Bethencourt <luis debethencourt com>
Date: Sat Apr 28 14:32:33 2012 +0100
engine: stream selection from if-else to switch
src/gst_engine.c | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/src/gst_engine.c b/src/gst_engine.c
index 20c9a93..34c86e5 100644
--- a/src/gst_engine.c
+++ b/src/gst_engine.c
@@ -534,15 +534,19 @@ cycle_streams (GstEngine * engine, guint streamid)
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";
+ switch (streamid) {
+ case STREAM_AUDIO:
+ n = "n-audio";
+ c = "current-audio";
+ break;
+ case STREAM_TEXT:
+ n = "n-text";
+ c = "current-text";
+ break;
+ case STREAM_VIDEO:
+ n = "n-video";
+ c = "current-video";
+ break;
}
g_object_get (G_OBJECT (engine->player), n, &streams, NULL);
@@ -801,13 +805,13 @@ toggle_subtitles (GstEngine * engine)
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
+ if (sub_state) { // If subtitles on, cycle streams and if last turn off
if (cycle_streams (engine, STREAM_TEXT)) {
flags &= ~(1 << 2);
g_object_set (G_OBJECT (engine->player), "flags", flags, NULL);
}
- } else { // If subtitles off, turn them on
+ } else { // If subtitles off, turn them on
flags |= (1 << 2);
g_object_set (G_OBJECT (engine->player), "flags", flags, NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]