aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-03-12 03:02:43 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-03-12 03:02:43 +0800
commite8a99ac3fc77e2746078b688c208963df5ae19aa (patch)
treed3efd997c8caa8241cfda4e1b9190f228a1c4cd3
parent952d1607e5be84369843eaaee6f1b668330bd9ff (diff)
downloadgsoc2013-empathy-e8a99ac3fc77e2746078b688c208963df5ae19aa.tar
gsoc2013-empathy-e8a99ac3fc77e2746078b688c208963df5ae19aa.tar.gz
gsoc2013-empathy-e8a99ac3fc77e2746078b688c208963df5ae19aa.tar.bz2
gsoc2013-empathy-e8a99ac3fc77e2746078b688c208963df5ae19aa.tar.lz
gsoc2013-empathy-e8a99ac3fc77e2746078b688c208963df5ae19aa.tar.xz
gsoc2013-empathy-e8a99ac3fc77e2746078b688c208963df5ae19aa.tar.zst
gsoc2013-empathy-e8a99ac3fc77e2746078b688c208963df5ae19aa.zip
Remove live-adder
-rw-r--r--src/empathy-call-window.c116
-rw-r--r--src/empathy-streamed-media-window.c119
2 files changed, 30 insertions, 205 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index ef6222344..108befa90 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)
}
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)
{
EmpathyCallWindowPriv *priv = GET_PRIV (self);
@@ -1115,7 +1103,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 */
@@ -1657,17 +1644,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;
@@ -1792,7 +1774,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);
@@ -1957,14 +1938,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;
}
}
@@ -2059,112 +2038,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;
}
diff --git a/src/empathy-streamed-media-window.c b/src/empathy-streamed-media-window.c
index e203bdc5f..1566da40a 100644
--- a/src/empathy-streamed-media-window.c
+++ b/src/empathy-streamed-media-window.c
@@ -189,7 +189,6 @@ struct _EmpathyStreamedMediaWindowPriv
GstElement *video_tee;
GstElement *funnel;
- GstElement *liveadder;
FsElementAddedNotifier *fsnotifier;
@@ -639,17 +638,6 @@ create_video_output_widget (EmpathyStreamedMediaWindow *self)
}
static void
-create_audio_output (EmpathyStreamedMediaWindow *self)
-{
- EmpathyStreamedMediaWindowPriv *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 (EmpathyStreamedMediaWindow *self)
{
EmpathyStreamedMediaWindowPriv *priv = GET_PRIV (self);
@@ -1131,7 +1119,6 @@ empathy_streamed_media_window_init (EmpathyStreamedMediaWindow *self)
create_pipeline (self);
create_video_output_widget (self);
create_audio_input (self);
- create_audio_output (self);
create_video_input (self);
priv->fsnotifier = fs_element_added_notifier_new ();
@@ -1725,18 +1712,10 @@ empathy_streamed_media_window_dispose (GObject *object)
g_object_unref (priv->audio_input);
priv->audio_input = NULL;
- if (priv->audio_output != NULL)
- g_object_unref (priv->audio_output);
- priv->audio_output = NULL;
-
if (priv->video_tee != NULL)
g_object_unref (priv->video_tee);
priv->video_tee = NULL;
- if (priv->liveadder != NULL)
- gst_object_unref (priv->liveadder);
- priv->liveadder = NULL;
-
if (priv->fsnotifier != NULL)
g_object_unref (priv->fsnotifier);
priv->fsnotifier = NULL;
@@ -1867,7 +1846,6 @@ empathy_streamed_media_window_reset_pipeline (EmpathyStreamedMediaWindow *self)
gtk_widget_destroy (priv->video_preview);
priv->video_preview = NULL;
- priv->liveadder = NULL;
priv->funnel = NULL;
create_pipeline (self);
@@ -2031,14 +2009,12 @@ empathy_streamed_media_window_channel_stream_closed_cb (EmpathyStreamedMediaHand
}
else if (media_type == TP_MEDIA_STREAM_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;
}
}
}
@@ -2130,112 +2106,47 @@ empathy_streamed_media_window_get_audio_sink_pad (EmpathyStreamedMediaWindow *se
{
EmpathyStreamedMediaWindowPriv *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;
}
- 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;
- }
+ template = gst_element_class_get_pad_template (
+ GST_ELEMENT_GET_CLASS (priv->audio_output), "sink%d");
- 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;
}