diff options
author | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2010-03-07 07:21:24 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-29 23:36:24 +0800 |
commit | 92be33483073c5475567d60b442c8c130dd1babb (patch) | |
tree | ea8e94ddf6ddc0af9a86263fc4dc97bb593a7d8b /src/empathy-call-window.c | |
parent | 49542a8ff607d5b1b60d14d3d34ebef943362778 (diff) | |
download | gsoc2013-empathy-92be33483073c5475567d60b442c8c130dd1babb.tar gsoc2013-empathy-92be33483073c5475567d60b442c8c130dd1babb.tar.gz gsoc2013-empathy-92be33483073c5475567d60b442c8c130dd1babb.tar.bz2 gsoc2013-empathy-92be33483073c5475567d60b442c8c130dd1babb.tar.lz gsoc2013-empathy-92be33483073c5475567d60b442c8c130dd1babb.tar.xz gsoc2013-empathy-92be33483073c5475567d60b442c8c130dd1babb.tar.zst gsoc2013-empathy-92be33483073c5475567d60b442c8c130dd1babb.zip |
Add audio conversion filter to receive pipeline
Diffstat (limited to 'src/empathy-call-window.c')
-rw-r--r-- | src/empathy-call-window.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 0c9c9e3c4..2bf569be2 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -1662,6 +1662,8 @@ empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); GstPad *pad; + GstElement *filter; + GError *gerror = NULL; if (priv->liveadder == NULL) { @@ -1698,10 +1700,50 @@ empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self) } } - pad = gst_element_get_request_pad (priv->liveadder, "sink%d"); + filter = gst_parse_bin_from_description ( + "audioconvert ! audioresample ! audioconvert", TRUE, &gerror); + if (!filter) + { + g_warning ("Could not make audio conversion filter: %s", gerror->message); + g_clear_error (&gerror); + goto error; + } + + if (!gst_bin_add (GST_BIN (priv->pipeline), filter)) + { + g_warning ("Could not add audio conversion filter to pipeline"); + gst_object_unref (filter); + goto error; + } + + if (gst_element_set_state (filter, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) + { + g_warning ("Could not start audio conversion filter"); + goto error_filter; + } + + if (!gst_element_link (filter, priv->liveadder)) + { + g_warning ("Could not link audio conversion filter to liveadder"); + goto error_filter; + } + + pad = gst_element_get_static_pad (filter, "sink"); + + if (!pad) + { + g_warning ("Could not get sink pad from filter"); + goto error_filter; + } return pad; + error_filter: + + gst_element_set_locked_state (filter, TRUE); + gst_element_set_state (filter, GST_STATE_NULL); + gst_bin_remove (GST_BIN (priv->pipeline), filter); + error: gst_element_set_locked_state (priv->liveadder, TRUE); |