]> git.0d.be Git - empathy.git/commitdiff
Remove libempathy-gtk dependency on gstreamer
authorSjoerd Simons <sjoerd@luon.net>
Sun, 26 Aug 2012 14:20:56 +0000 (16:20 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 29 Aug 2012 08:12:31 +0000 (10:12 +0200)
libempathy-gtk uses gstreamer directly only for one utility function
used by empathy-call. Split this one out into a call specific utility
file.

libempathy-gtk/empathy-call-utils.c
libempathy-gtk/empathy-call-utils.h
src/Makefile.am
src/empathy-audio-sink.c
src/empathy-audio-src.c
src/empathy-audio-utils.c [new file with mode: 0644]
src/empathy-audio-utils.h [new file with mode: 0644]

index e4e666be55ddb8deb7569fa505fa9ff7197cbc81..bbbda511cec796f3f38b8a227c46de8f93e42df4 100644 (file)
@@ -148,41 +148,6 @@ empathy_call_new_with_streams (const gchar *contact,
       timestamp);
 }
 
-void
-empathy_call_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);
-}
-
 /* Copied from telepathy-yell call-channel.c */
 void
 empathy_call_channel_send_video (TpCallChannel *self,
index 6d78908b8cc1c2066aa999b55bb31dbb997ec783..12fca684e132323e1f31d7e63814b1626fdd9d34 100644 (file)
@@ -21,8 +21,6 @@
 #ifndef __EMPATHY_CALL_UTILS_H__
 #define __EMPATHY_CALL_UTILS_H__
 
-#include <gst/gst.h>
-
 G_BEGIN_DECLS
 
 /* Calls */
@@ -36,9 +34,6 @@ GHashTable * empathy_call_create_call_request (const gchar *contact,
     gboolean initial_audio,
     gboolean initial_video);
 
-void empathy_call_set_stream_properties (GstElement *element,
-    gboolean echo_cancellation);
-
 TpSendingState empathy_call_channel_get_video_state (TpCallChannel *self);
 void empathy_call_channel_send_video (TpCallChannel *self,
     gboolean send);
index 80b4d58c0c8f1260ca94d610cbf1309aacf8528b..ed3d8d0db6d63c40b0aeda62bfa09f116c077221 100644 (file)
@@ -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 \
index d48e6af20df8aba2cf6101e28908287291e4430b..ba5cab77d32cdc03520bebcf2766b6c64fad0986 100644 (file)
@@ -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);
 }
index 9369c778340820e66cf1671a63d12e5d0a68aeb5..a3784f13f7300eeb6214150803d736d43871b73d 100644 (file)
@@ -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 (file)
index 0000000..323ef8e
--- /dev/null
@@ -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 (file)
index 0000000..f9f7cb8
--- /dev/null
@@ -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