]> git.0d.be Git - empathy.git/blob - src/empathy-audio-utils.c
Use a flat namespace for internal includes
[empathy.git] / src / empathy-audio-utils.c
1 /*
2  * Copyright (C) 2011 Collabora Ltd.
3  *
4  * The code contained in this file is free software; you can redistribute
5  * it and/or modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either version
7  * 2.1 of the License, or (at your option) any later version.
8  *
9  * This file is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this code; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  * Authors: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
19  */
20
21 #include "config.h"
22
23 #include <pulse/pulseaudio.h>
24
25 #include "empathy-audio-utils.h"
26
27 #include "empathy-gsettings.h"
28
29 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
30 #include "empathy-debug.h"
31
32 void
33 empathy_audio_set_stream_properties (GstElement *element,
34   gboolean echo_cancellation)
35 {
36   GstStructure *props;
37   GSettings *gsettings_call;
38   gboolean echo_cancellation_setting;
39
40   gsettings_call = g_settings_new (EMPATHY_PREFS_CALL_SCHEMA);
41
42   echo_cancellation_setting = g_settings_get_boolean (gsettings_call,
43       EMPATHY_PREFS_CALL_ECHO_CANCELLATION);
44
45   DEBUG ("Echo cancellation: element allowed: %s, user enabled: %s",
46     echo_cancellation ? " yes" : "no",
47     echo_cancellation_setting ? " yes" : "no");
48
49
50   props = gst_structure_new ("props",
51       PA_PROP_MEDIA_ROLE, G_TYPE_STRING, "phone",
52       NULL);
53
54   if (echo_cancellation && echo_cancellation_setting)
55     {
56       gst_structure_set (props,
57           "filter.want", G_TYPE_STRING, "echo-cancel",
58           NULL);
59     }
60
61   g_object_set (element, "stream-properties", props, NULL);
62   gst_structure_free (props);
63
64   g_object_unref (gsettings_call);
65 }