aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd@luon.net>2012-08-26 22:20:56 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-08-29 16:12:31 +0800
commit6e3ea627e70266d8c3739300e900a5b7bc0763bc (patch)
tree464aebbea115de0dc148ca834c9b3f2d97d344d8 /src
parentf7ab6457995133ccd3fd32ce028c6c8cb1e68322 (diff)
downloadgsoc2013-empathy-6e3ea627e70266d8c3739300e900a5b7bc0763bc.tar
gsoc2013-empathy-6e3ea627e70266d8c3739300e900a5b7bc0763bc.tar.gz
gsoc2013-empathy-6e3ea627e70266d8c3739300e900a5b7bc0763bc.tar.bz2
gsoc2013-empathy-6e3ea627e70266d8c3739300e900a5b7bc0763bc.tar.lz
gsoc2013-empathy-6e3ea627e70266d8c3739300e900a5b7bc0763bc.tar.xz
gsoc2013-empathy-6e3ea627e70266d8c3739300e900a5b7bc0763bc.tar.zst
gsoc2013-empathy-6e3ea627e70266d8c3739300e900a5b7bc0763bc.zip
Remove libempathy-gtk dependency on gstreamer
libempathy-gtk uses gstreamer directly only for one utility function used by empathy-call. Split this one out into a call specific utility file.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/empathy-audio-sink.c6
-rw-r--r--src/empathy-audio-src.c6
-rw-r--r--src/empathy-audio-utils.c65
-rw-r--r--src/empathy-audio-utils.h33
5 files changed, 106 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 80b4d58c0..ed3d8d0db 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -101,6 +101,8 @@ empathy_call_SOURCES = \
empathy-audio-sink.h \
empathy-audio-src.c \
empathy-audio-src.h \
+ empathy-audio-utils.c \
+ empathy-audio-utils.h \
empathy-video-src.c \
empathy-video-src.h \
empathy-preferences.c \
diff --git a/src/empathy-audio-sink.c b/src/empathy-audio-sink.c
index d48e6af20..ba5cab77d 100644
--- a/src/empathy-audio-sink.c
+++ b/src/empathy-audio-sink.c
@@ -28,7 +28,7 @@
#include <telepathy-glib/telepathy-glib.h>
-#include <libempathy-gtk/empathy-call-utils.h>
+#include "empathy-audio-utils.h"
#include "empathy-audio-sink.h"
@@ -219,7 +219,7 @@ create_sink (EmpathyGstAudioSink *self)
if (sink == NULL)
return NULL;
- empathy_call_set_stream_properties (sink, self->priv->echo_cancel);
+ empathy_audio_set_stream_properties (sink, self->priv->echo_cancel);
/* Set latency (buffering on the PulseAudio side) of 40ms and transfer data
* in 10ms chunks */
@@ -402,6 +402,6 @@ empathy_audio_sink_set_echo_cancel (EmpathyGstAudioSink *sink,
DEBUG ("Sink echo cancellation setting: %s", echo_cancel ? "on" : "off");
sink->priv->echo_cancel = echo_cancel;
if (sink->priv->sink != NULL)
- empathy_call_set_stream_properties (sink->priv->sink,
+ empathy_audio_set_stream_properties (sink->priv->sink,
sink->priv->echo_cancel);
}
diff --git a/src/empathy-audio-src.c b/src/empathy-audio-src.c
index 9369c7783..a3784f13f 100644
--- a/src/empathy-audio-src.c
+++ b/src/empathy-audio-src.c
@@ -26,7 +26,7 @@
#include <gst/interfaces/streamvolume.h>
#include <libempathy/empathy-utils.h>
-#include <libempathy-gtk/empathy-call-utils.h>
+#include "empathy-audio-utils.h"
#include "empathy-audio-src.h"
@@ -267,7 +267,7 @@ create_src (void)
if (src == NULL)
return NULL;
- empathy_call_set_stream_properties (src, TRUE);
+ empathy_audio_set_stream_properties (src, TRUE);
/* Set latency (buffering on the PulseAudio side) of 20ms */
g_object_set (src, "buffer-time", (gint64) 20000, NULL);
@@ -679,7 +679,7 @@ empathy_audio_src_set_echo_cancel (EmpathyGstAudioSrc *src,
gboolean enable)
{
DEBUG ("Src echo cancellation setting: %s", enable ? "on" : "off");
- empathy_call_set_stream_properties (src->priv->src, enable);
+ empathy_audio_set_stream_properties (src->priv->src, enable);
}
void
diff --git a/src/empathy-audio-utils.c b/src/empathy-audio-utils.c
new file mode 100644
index 000000000..323ef8edf
--- /dev/null
+++ b/src/empathy-audio-utils.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * The code contained in this file is free software; you can redistribute
+ * it and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either version
+ * 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this code; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
+ */
+
+#include "config.h"
+
+#include <pulse/pulseaudio.h>
+
+#include "empathy-audio-utils.h"
+
+#include <libempathy/empathy-gsettings.h>
+
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
+
+void
+empathy_audio_set_stream_properties (GstElement *element,
+ gboolean echo_cancellation)
+{
+ GstStructure *props;
+ GSettings *gsettings_call;
+ gboolean echo_cancellation_setting;
+
+ gsettings_call = g_settings_new (EMPATHY_PREFS_CALL_SCHEMA);
+
+ echo_cancellation_setting = g_settings_get_boolean (gsettings_call,
+ EMPATHY_PREFS_CALL_ECHO_CANCELLATION);
+
+ DEBUG ("Echo cancellation: element allowed: %s, user enabled: %s",
+ echo_cancellation ? " yes" : "no",
+ echo_cancellation_setting ? " yes" : "no");
+
+
+ props = gst_structure_new ("props",
+ PA_PROP_MEDIA_ROLE, G_TYPE_STRING, "phone",
+ NULL);
+
+ if (echo_cancellation && echo_cancellation_setting)
+ {
+ gst_structure_set (props,
+ "filter.want", G_TYPE_STRING, "echo-cancel",
+ NULL);
+ }
+
+ g_object_set (element, "stream-properties", props, NULL);
+ gst_structure_free (props);
+
+ g_object_unref (gsettings_call);
+}
diff --git a/src/empathy-audio-utils.h b/src/empathy-audio-utils.h
new file mode 100644
index 000000000..f9f7cb897
--- /dev/null
+++ b/src/empathy-audio-utils.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * The code contained in this file is free software; you can redistribute
+ * it and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either version
+ * 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this code; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
+ */
+
+#ifndef __EMPATHY_AUDIO_UTILS_H__
+#define __EMPATHY_AUDIO_UTILS_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+void empathy_audio_set_stream_properties (GstElement *element,
+ gboolean echo_cancellation);
+
+G_END_DECLS
+
+#endif