[empathy] Set stream-properties on GStreamer elements to set the media role



commit 7e9166e6711d15a28bb679a1aeed3223134f2388
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Aug 15 11:04:24 2011 +0200

    Set stream-properties on GStreamer elements to set the media role

 src/empathy-audio-sink.c |   10 ++++++++++
 src/empathy-audio-src.c  |    9 +++++++++
 src/empathy-av.c         |    1 -
 src/empathy-call.c       |    1 -
 4 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/empathy-audio-sink.c b/src/empathy-audio-sink.c
index e571b24..f8b5d1c 100644
--- a/src/empathy-audio-sink.c
+++ b/src/empathy-audio-sink.c
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 
 #include <gst/audio/audio.h>
+#include <telepathy-glib/telepathy-glib.h>
 
 #include "empathy-audio-sink.h"
 
@@ -231,6 +232,15 @@ empathy_audio_sink_request_new_pad (GstElement *element,
   if (self->priv->sink == NULL)
     goto error;
 
+  if (!tp_strdiff (sink_element, "pulsesink"))
+    {
+      GstStructure *props;
+
+      props = gst_structure_from_string ("props,media.role=phone", NULL);
+      g_object_set (self->priv->sink, "stream-properties", props, NULL);
+      gst_structure_free (props);
+    }
+
   gst_bin_add (GST_BIN (bin), self->priv->sink);
 
   if (!gst_element_link_many (audioconvert0, resample, audioconvert1,
diff --git a/src/empathy-audio-src.c b/src/empathy-audio-src.c
index 642628d..98ff24e 100644
--- a/src/empathy-audio-src.c
+++ b/src/empathy-audio-src.c
@@ -394,6 +394,15 @@ empathy_audio_src_init (EmpathyGstAudioSrc *obj)
   priv->src = gst_element_factory_make (src_element, NULL);
   gst_bin_add (GST_BIN (obj), priv->src);
 
+  if (!tp_strdiff (src_element, "pulsesrc"))
+    {
+      GstStructure *props;
+
+      props = gst_structure_from_string ("props,media.role=phone", NULL);
+      g_object_set (priv->src, "stream-properties", props, NULL);
+      gst_structure_free (props);
+    }
+
   priv->volume = gst_element_factory_make ("volume", NULL);
   g_object_ref (priv->volume);
 
diff --git a/src/empathy-av.c b/src/empathy-av.c
index 6f8c5ba..70acfc4 100644
--- a/src/empathy-av.c
+++ b/src/empathy-av.c
@@ -132,7 +132,6 @@ main (int argc,
 
   empathy_gtk_init ();
   g_set_application_name (_("Empathy Audio/Video Client"));
-  g_setenv ("PULSE_PROP_media.role", "phone", TRUE);
 
   /* Make empathy and empathy-av appear as the same app in gnome-shell */
   gdk_set_program_class ("Empathy");
diff --git a/src/empathy-call.c b/src/empathy-call.c
index 1305645..1f60217 100644
--- a/src/empathy-call.c
+++ b/src/empathy-call.c
@@ -150,7 +150,6 @@ main (int argc,
 
   empathy_gtk_init ();
   g_set_application_name (_("Empathy Audio/Video Client"));
-  g_setenv ("PULSE_PROP_media.role", "phone", TRUE);
 
   /* Make empathy and empathy-call appear as the same app in gnome-shell */
   gdk_set_program_class ("Empathy");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]