From c944633078a0769de5e50082e1d8b9e91565f940 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Fri, 11 Mar 2011 19:02:43 +0000 Subject: Remove live-adder --- src/empathy-call-window.c | 116 ++++++---------------------------------------- 1 file changed, 15 insertions(+), 101 deletions(-) (limited to 'src/empathy-call-window.c') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index ad4e5bcec..9ed66d4b4 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -178,7 +178,6 @@ struct _EmpathyCallWindowPriv GstElement *video_tee; GstElement *funnel; - GstElement *liveadder; GList *notifiers; @@ -623,17 +622,6 @@ create_video_output_widget (EmpathyCallWindow *self) g_object_unref (bus); } -static void -create_audio_output (EmpathyCallWindow *self) -{ - EmpathyCallWindowPriv *priv = GET_PRIV (self); - - g_assert (priv->audio_output == NULL); - priv->audio_output = empathy_audio_sink_new (); - gst_object_ref (priv->audio_output); - gst_object_sink (priv->audio_output); -} - static void create_video_input (EmpathyCallWindow *self) { @@ -1116,7 +1104,6 @@ empathy_call_window_init (EmpathyCallWindow *self) create_pipeline (self); create_video_output_widget (self); create_audio_input (self); - create_audio_output (self); create_video_input (self); /* The call will be started as soon the pipeline is playing */ @@ -1660,17 +1647,12 @@ empathy_call_window_dispose (GObject *object) tp_clear_object (&priv->pipeline); tp_clear_object (&priv->video_input); tp_clear_object (&priv->audio_input); - tp_clear_object (&priv->audio_output); tp_clear_object (&priv->video_tee); tp_clear_object (&priv->ui_manager); tp_clear_object (&priv->fullscreen); g_list_free_full (priv->notifiers, g_object_unref); - if (priv->liveadder != NULL) - gst_object_unref (priv->liveadder); - priv->liveadder = NULL; - if (priv->timer_id != 0) g_source_remove (priv->timer_id); priv->timer_id = 0; @@ -1797,7 +1779,6 @@ empathy_call_window_reset_pipeline (EmpathyCallWindow *self) gtk_widget_destroy (priv->video_preview); priv->video_preview = NULL; - priv->liveadder = NULL; priv->funnel = NULL; create_pipeline (self); @@ -1962,14 +1943,12 @@ empathy_call_window_sink_removed_cb (EmpathyCallHandler *handler, } else if (media_type == FS_MEDIA_TYPE_AUDIO) { - if (priv->liveadder != NULL) + if (priv->audio_output != NULL) { gst_element_set_state (priv->audio_output, GST_STATE_NULL); - gst_element_set_state (priv->liveadder, GST_STATE_NULL); gst_bin_remove (GST_BIN (priv->pipeline), priv->audio_output); - gst_bin_remove (GST_BIN (priv->pipeline), priv->liveadder); - priv->liveadder = NULL; + priv->audio_output = NULL; return TRUE; } } @@ -2064,112 +2043,47 @@ empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); GstPad *pad; - GstElement *filter; - GError *gerror = NULL; + GstPadTemplate *template; - if (priv->liveadder == NULL) + if (priv->audio_output == NULL) { - priv->liveadder = gst_element_factory_make ("liveadder", NULL); + priv->audio_output = empathy_audio_sink_new (); - if (!gst_bin_add (GST_BIN (priv->pipeline), priv->liveadder)) - { - g_warning ("Could not add liveadder to the pipeline"); - goto error_add_liveadder; - } if (!gst_bin_add (GST_BIN (priv->pipeline), priv->audio_output)) { g_warning ("Could not add audio sink to pipeline"); + g_object_unref (priv->audio_output); goto error_add_output; } - if (gst_element_set_state (priv->liveadder, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) - { - g_warning ("Could not start liveadder"); - goto error; - } - if (gst_element_set_state (priv->audio_output, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { g_warning ("Could not start audio sink"); goto error; } - - if (GST_PAD_LINK_FAILED ( - gst_element_link (priv->liveadder, priv->audio_output))) - { - g_warning ("Could not link liveadder to audio output"); - goto error; - } } - filter = gst_parse_bin_from_description ( - "audioconvert ! audioresample ! audioconvert", TRUE, &gerror); - if (filter == NULL) - { - g_warning ("Could not make audio conversion filter: %s", gerror->message); - g_clear_error (&gerror); - goto error; - } + template = gst_element_class_get_pad_template ( + GST_ELEMENT_GET_CLASS (priv->audio_output), "sink%d"); - 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"); + pad = gst_element_request_pad (priv->audio_output, + template, NULL, NULL); if (pad == NULL) { - g_warning ("Could not get sink pad from filter"); - goto error_filter; + g_warning ("Could not get sink pad from sink"); + return NULL; } 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); +error: gst_element_set_locked_state (priv->audio_output, TRUE); - - gst_element_set_state (priv->liveadder, GST_STATE_NULL); gst_element_set_state (priv->audio_output, GST_STATE_NULL); - gst_bin_remove (GST_BIN (priv->pipeline), priv->audio_output); + priv->audio_output = NULL; - error_add_output: - - gst_bin_remove (GST_BIN (priv->pipeline), priv->liveadder); - - gst_element_set_locked_state (priv->liveadder, FALSE); - gst_element_set_locked_state (priv->audio_output, FALSE); - - error_add_liveadder: - - if (priv->liveadder != NULL) - { - gst_object_unref (priv->liveadder); - priv->liveadder = NULL; - } +error_add_output: return NULL; } -- cgit v1.2.3