* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <gst/audio/audio.h>
+#ifdef HAVE_GST1
+#include <gst/audio/streamvolume.h>
+#else
#include <gst/interfaces/streamvolume.h>
+#endif
-#include <telepathy-glib/telepathy-glib.h>
-
-#include <libempathy-gtk/empathy-call-utils.h>
-
+#include "empathy-audio-utils.h"
#include "empathy-audio-sink.h"
#define DEBUG_FLAG EMPATHY_DEBUG_VOIP
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
G_DEFINE_TYPE(EmpathyGstAudioSink, empathy_audio_sink, GST_TYPE_BIN)
"sink%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
+#ifdef HAVE_GST1
+ GST_STATIC_CAPS ( "audio/x-raw" )
+#else
GST_STATIC_CAPS ( GST_AUDIO_INT_PAD_TEMPLATE_CAPS " ; "
GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
+#endif
);
enum {
gboolean echo_cancel;
gdouble volume;
gint volume_idle_id;
- GStaticMutex volume_mutex;
+ GMutex volume_mutex;
};
#define EMPATHY_GST_AUDIO_SINK_GET_PRIVATE(o) \
{
self->priv = EMPATHY_GST_AUDIO_SINK_GET_PRIVATE (self);
self->priv->echo_cancel = TRUE;
- g_static_mutex_init (&self->priv->volume_mutex);
+ g_mutex_init (&self->priv->volume_mutex);
}
+#ifdef HAVE_GST1
+static GstPad * empathy_audio_sink_request_new_pad (GstElement *self,
+ GstPadTemplate *templ,
+ const gchar* name,
+ const GstCaps *caps);
+#else
static GstPad * empathy_audio_sink_request_new_pad (GstElement *self,
GstPadTemplate *templ,
const gchar* name);
+#endif
static void empathy_audio_sink_release_pad (GstElement *self,
GstPad *pad);
switch (property_id)
{
case PROP_VOLUME:
- g_static_mutex_lock (&self->priv->volume_mutex);
+ g_mutex_lock (&self->priv->volume_mutex);
self->priv->volume = g_value_get_double (value);
- g_static_mutex_unlock (&self->priv->volume_mutex);
+ g_mutex_unlock (&self->priv->volume_mutex);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
g_source_remove (priv->volume_idle_id);
priv->volume_idle_id = 0;
- g_static_mutex_free (&self->priv->volume_mutex);
+ g_mutex_clear (&self->priv->volume_mutex);
/* release any references held by the object here */
if (G_OBJECT_CLASS (empathy_audio_sink_parent_class)->dispose)
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 */
- g_object_set (sink, "buffer-time", 40000, "latency-time", 10000, NULL);
+ g_object_set (sink,
+ "buffer-time", (gint64) 40000,
+ "latency-time", (gint64) 10000,
+ NULL);
return sink;
}
{
EmpathyGstAudioSink *self = EMPATHY_GST_AUDIO_SINK (user_data);
- g_static_mutex_lock (&self->priv->volume_mutex);
+ g_mutex_lock (&self->priv->volume_mutex);
self->priv->volume_idle_id = 0;
- g_static_mutex_unlock (&self->priv->volume_mutex);
+ g_mutex_unlock (&self->priv->volume_mutex);
g_object_notify (G_OBJECT (self), "volume");
EmpathyGstAudioSink *self = EMPATHY_GST_AUDIO_SINK (user_data);
gdouble volume;
- g_static_mutex_lock (&self->priv->volume_mutex);
+ g_mutex_lock (&self->priv->volume_mutex);
g_object_get (object, "volume", &volume, NULL);
if (self->priv->volume == volume)
empathy_audio_sink_volume_idle_updated, self);
out:
- g_static_mutex_unlock (&self->priv->volume_mutex);
+ g_mutex_unlock (&self->priv->volume_mutex);
}
static gboolean
EmpathyGstAudioSink *self = EMPATHY_GST_AUDIO_SINK (user_data);
gdouble volume;
- g_static_mutex_lock (&self->priv->volume_mutex);
+ g_mutex_lock (&self->priv->volume_mutex);
self->priv->volume_idle_id = 0;
- g_static_mutex_unlock (&self->priv->volume_mutex);
+ g_mutex_unlock (&self->priv->volume_mutex);
/* We can't do a bidirection bind as the ::notify comes from another
* thread, for other bits of empathy it's most simpler if it comes from
return FALSE;
}
+#ifdef HAVE_GST1
+static GstPad *
+empathy_audio_sink_request_new_pad (GstElement *element,
+ GstPadTemplate *templ,
+ const gchar* name,
+ const GstCaps *caps)
+#else
static GstPad *
empathy_audio_sink_request_new_pad (GstElement *element,
GstPadTemplate *templ,
const gchar* name)
+#endif
{
EmpathyGstAudioSink *self = EMPATHY_GST_AUDIO_SINK (element);
GstElement *bin, *resample, *audioconvert0, *audioconvert1;
if (GST_IS_STREAM_VOLUME (self->priv->sink))
{
- g_static_mutex_lock (&self->priv->volume_mutex);
+ g_mutex_lock (&self->priv->volume_mutex);
if (self->priv->volume_idle_id == 0)
self->priv->volume_idle_id = g_idle_add (
empathy_audio_sink_volume_idle_setup, self);
- g_static_mutex_unlock (&self->priv->volume_mutex);
+ g_mutex_unlock (&self->priv->volume_mutex);
}
else
{
goto error;
subpad = gst_ghost_pad_new ("sink", filterpad);
+ gst_object_unref (filterpad);
+
if (!gst_element_add_pad (GST_ELEMENT (bin), subpad))
goto error;
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);
}