aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-audio-sink.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-08-15 17:23:35 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-08-15 20:38:12 +0800
commitbe5274444c54eb5c529e592d130e362fd1728b4d (patch)
tree3bc8d766c10532db66761b963864b2c379980fa2 /src/empathy-audio-sink.c
parent7e9166e6711d15a28bb679a1aeed3223134f2388 (diff)
downloadgsoc2013-empathy-be5274444c54eb5c529e592d130e362fd1728b4d.tar
gsoc2013-empathy-be5274444c54eb5c529e592d130e362fd1728b4d.tar.gz
gsoc2013-empathy-be5274444c54eb5c529e592d130e362fd1728b4d.tar.bz2
gsoc2013-empathy-be5274444c54eb5c529e592d130e362fd1728b4d.tar.lz
gsoc2013-empathy-be5274444c54eb5c529e592d130e362fd1728b4d.tar.xz
gsoc2013-empathy-be5274444c54eb5c529e592d130e362fd1728b4d.tar.zst
gsoc2013-empathy-be5274444c54eb5c529e592d130e362fd1728b4d.zip
Use gst_parse_bin_from_description() when EMPATHY_AUDIO_* vars are set
Also factor out empathy_call_set_stream_properties().
Diffstat (limited to 'src/empathy-audio-sink.c')
-rw-r--r--src/empathy-audio-sink.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/src/empathy-audio-sink.c b/src/empathy-audio-sink.c
index f8b5d1c39..c9d720310 100644
--- a/src/empathy-audio-sink.c
+++ b/src/empathy-audio-sink.c
@@ -25,6 +25,8 @@
#include <gst/audio/audio.h>
#include <telepathy-glib/telepathy-glib.h>
+#include <libempathy-gtk/empathy-call-utils.h>
+
#include "empathy-audio-sink.h"
#define DEBUG_FLAG EMPATHY_DEBUG_VOIP
@@ -187,6 +189,35 @@ empathy_audio_sink_get_volume (EmpathyGstAudioSink *sink)
return volume;
}
+static GstElement *
+create_sink (const gchar *description)
+{
+ GstElement *sink;
+
+ if (description != NULL)
+ {
+ GError *error = NULL;
+
+ sink = gst_parse_bin_from_description (description, TRUE, &error);
+ if (sink == NULL)
+ {
+ DEBUG ("Failed to create bin %s: %s", description, error->message);
+ g_error_free (error);
+ }
+
+ return sink;
+ }
+
+ /* Use pulsesink as default */
+ sink = gst_element_factory_make ("pulsesink", NULL);
+ if (sink == NULL)
+ return NULL;
+
+ empathy_call_set_stream_properties (sink);
+
+ return sink;
+}
+
static GstPad *
empathy_audio_sink_request_new_pad (GstElement *element,
GstPadTemplate *templ,
@@ -196,7 +227,6 @@ empathy_audio_sink_request_new_pad (GstElement *element,
GstElement *bin, *volume, *resample, *audioconvert0, *audioconvert1;
GstPad *pad = NULL;
GstPad *subpad, *filterpad;
- const gchar *sink_element;
bin = gst_bin_new (NULL);
@@ -224,23 +254,10 @@ empathy_audio_sink_request_new_pad (GstElement *element,
gst_bin_add (GST_BIN (bin), volume);
- sink_element = g_getenv ("EMPATHY_AUDIO_SINK");
- if (sink_element == NULL)
- sink_element = "pulsesink";
-
- self->priv->sink = gst_element_factory_make (sink_element, NULL);
+ self->priv->sink = create_sink (g_getenv ("EMPATHY_AUDIO_SINK"));
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,