[empathy] Remove libempathy-gtk dependency on gstreamer



commit 6e3ea627e70266d8c3739300e900a5b7bc0763bc
Author: Sjoerd Simons <sjoerd luon net>
Date:   Sun Aug 26 16:20:56 2012 +0200

    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.

 libempathy-gtk/empathy-call-utils.c |   35 -------------------
 libempathy-gtk/empathy-call-utils.h |    5 ---
 src/Makefile.am                     |    2 +
 src/empathy-audio-sink.c            |    6 ++--
 src/empathy-audio-src.c             |    6 ++--
 src/empathy-audio-utils.c           |   65 +++++++++++++++++++++++++++++++++++
 src/empathy-audio-utils.h           |   33 ++++++++++++++++++
 7 files changed, 106 insertions(+), 46 deletions(-)
---
diff --git a/libempathy-gtk/empathy-call-utils.c b/libempathy-gtk/empathy-call-utils.c
index e4e666b..bbbda51 100644
--- a/libempathy-gtk/empathy-call-utils.c
+++ b/libempathy-gtk/empathy-call-utils.c
@@ -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,
diff --git a/libempathy-gtk/empathy-call-utils.h b/libempathy-gtk/empathy-call-utils.h
index 6d78908..12fca68 100644
--- a/libempathy-gtk/empathy-call-utils.h
+++ b/libempathy-gtk/empathy-call-utils.h
@@ -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);
diff --git a/src/Makefile.am b/src/Makefile.am
index 80b4d58..ed3d8d0 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 d48e6af..ba5cab7 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 9369c77..a3784f1 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 0000000..323ef8e
--- /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 0000000..f9f7cb8
--- /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



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