emotion gstreamer1: Add support for selecting subtitle channels
authorSebastian Dröge <sebastian@centricular.com>
Sun, 12 Jan 2014 19:31:19 +0000 (20:31 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 13 Jan 2014 09:01:07 +0000 (10:01 +0100)
src/modules/emotion/gstreamer1/emotion_gstreamer.c

index cfdbacc..25a23fc 100644 (file)
@@ -828,20 +828,41 @@ em_audio_channel_volume_get(void *video)
 /* spu stuff */
 
 static int
-em_spu_channel_count(void *video EINA_UNUSED)
+em_spu_channel_count(void *video)
 {
-   return 0;
+   Emotion_Gstreamer *ev = video;
+   gint n;
+
+   if (!ev->ready) return 0;
+
+   g_object_get(ev->pipeline, "n-text", &n, NULL);
+
+   return n;
 }
 
 static void
-em_spu_channel_set(void *video EINA_UNUSED, int channel EINA_UNUSED)
+em_spu_channel_set(void *video, int channel)
 {
+   Emotion_Gstreamer *ev = video;
+
+   if (!ev->ready) return;
+
+   if (channel < 0) channel = -1;
+
+   g_object_set (ev->pipeline, "current-text", channel, NULL);
 }
 
 static int
-em_spu_channel_get(void *video EINA_UNUSED)
+em_spu_channel_get(void *video)
 {
-   return 1;
+   Emotion_Gstreamer *ev = video;
+   gint cur;
+
+   if (!ev->ready) return -1;
+
+   g_object_get(ev->pipeline, "current-text", &cur, NULL);
+
+   return cur;
 }
 
 static const char *