aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-11-10 00:27:51 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-11-11 22:01:07 +0800
commitffaa3afe49651493d0dcb01eba1b6dcd1134eed1 (patch)
treea44e87a363ca450b57d69e5d0f456759949bdef8 /src
parent8f95b35828bbf37beda060ed25957599e4f50c5f (diff)
downloadgsoc2013-empathy-ffaa3afe49651493d0dcb01eba1b6dcd1134eed1.tar
gsoc2013-empathy-ffaa3afe49651493d0dcb01eba1b6dcd1134eed1.tar.gz
gsoc2013-empathy-ffaa3afe49651493d0dcb01eba1b6dcd1134eed1.tar.bz2
gsoc2013-empathy-ffaa3afe49651493d0dcb01eba1b6dcd1134eed1.tar.lz
gsoc2013-empathy-ffaa3afe49651493d0dcb01eba1b6dcd1134eed1.tar.xz
gsoc2013-empathy-ffaa3afe49651493d0dcb01eba1b6dcd1134eed1.tar.zst
gsoc2013-empathy-ffaa3afe49651493d0dcb01eba1b6dcd1134eed1.zip
Call: Signal content-{added/removed} instead of sink-{added/removed}
Tp-Farstream signals contents, not sinks (like tp-farsight did). So lets mirror that, which allows us to make better decisions about what kind of contents we are given https://bugzilla.gnome.org/show_bug.cgi?id=663842
Diffstat (limited to 'src')
-rw-r--r--src/empathy-call-handler.c37
-rw-r--r--src/empathy-call-window.c35
2 files changed, 36 insertions, 36 deletions
diff --git a/src/empathy-call-handler.c b/src/empathy-call-handler.c
index ef07c503a..0477cd7c0 100644
--- a/src/empathy-call-handler.c
+++ b/src/empathy-call-handler.c
@@ -47,8 +47,8 @@ enum {
CONFERENCE_ADDED,
CONFERENCE_REMOVED,
SRC_PAD_ADDED,
- SINK_PAD_ADDED,
- SINK_PAD_REMOVED,
+ CONTENT_ADDED,
+ CONTENT_REMOVED,
CLOSED,
CANDIDATES_CHANGED,
STATE_CHANGED,
@@ -481,19 +481,19 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass)
G_TYPE_BOOLEAN,
2, GST_TYPE_PAD, G_TYPE_UINT);
- signals[SINK_PAD_ADDED] =
- g_signal_new ("sink-pad-added", G_TYPE_FROM_CLASS (klass),
+ signals[CONTENT_ADDED] =
+ g_signal_new ("content-added", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_BOOLEAN,
- 2, GST_TYPE_PAD, G_TYPE_UINT);
+ 1, TF_TYPE_CONTENT);
- signals[SINK_PAD_REMOVED] =
- g_signal_new ("sink-pad-removed", G_TYPE_FROM_CLASS (klass),
+ signals[CONTENT_REMOVED] =
+ g_signal_new ("content-removed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_BOOLEAN,
- 2, GST_TYPE_PAD, G_TYPE_UINT);
+ 1, TF_TYPE_CONTENT);
signals[CLOSED] =
g_signal_new ("closed", G_TYPE_FROM_CLASS (klass),
@@ -806,7 +806,6 @@ on_tf_channel_content_added_cb (TfChannel *tfchannel,
EmpathyCallHandler *handler)
{
FsMediaType mtype;
- GstPad *spad;
FsSession *session;
// FsStream *fs_stream;
FsCodec *codec;
@@ -822,11 +821,8 @@ on_tf_channel_content_added_cb (TfChannel *tfchannel,
G_CALLBACK (on_tf_content_stop_sending_cb), handler);
#endif
- g_object_get (content, "media-type", &mtype,
- "sink-pad", &spad, NULL);
-
- g_signal_emit (G_OBJECT (handler), signals[SINK_PAD_ADDED], 0,
- spad, mtype, &retval);
+ g_signal_emit (G_OBJECT (handler), signals[CONTENT_ADDED], 0,
+ content, &retval);
if (!retval)
tf_content_error (content, 0 /* FIXME */,
@@ -852,6 +848,8 @@ on_tf_channel_content_added_cb (TfChannel *tfchannel,
tp_clear_object (&fs_stream);
*/
+ g_object_get (content, "media-type", &mtype, NULL);
+
if (mtype == FS_MEDIA_TYPE_VIDEO)
{
guint framerate, width, height;
@@ -878,8 +876,6 @@ on_tf_channel_content_added_cb (TfChannel *tfchannel,
g_signal_emit (G_OBJECT (handler), signals[RESOLUTION_CHANGED], 0,
width, height);
}
-
- gst_object_unref (spad);
}
static void
@@ -887,17 +883,12 @@ on_tf_channel_content_removed_cb (TfChannel *tfchannel,
TfContent *content,
EmpathyCallHandler *handler)
{
- FsMediaType mtype;
- GstPad *spad;
gboolean retval;
DEBUG ("removing content");
- g_object_get (content, "media-type", &mtype,
- "sink-pad", &spad, NULL);
-
- g_signal_emit (G_OBJECT (handler), signals[SINK_PAD_REMOVED], 0,
- spad, mtype, &retval);
+ g_signal_emit (G_OBJECT (handler), signals[CONTENT_REMOVED], 0,
+ content, &retval);
if (!retval)
{
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index ab7dbeef8..8a4a3aa29 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -2691,15 +2691,17 @@ empathy_call_window_channel_closed_cb (EmpathyCallHandler *handler,
}
static gboolean
-empathy_call_window_sink_removed_cb (EmpathyCallHandler *handler,
- GstPad *sink,
- FsMediaType media_type,
+empathy_call_window_content_removed_cb (EmpathyCallHandler *handler,
+ TfContent *content,
EmpathyCallWindow *self)
{
EmpathyCallWindowPriv *priv = GET_PRIV (self);
+ FsMediaType media_type;
DEBUG ("removing content");
+ g_object_get (content, "media-type", &media_type, NULL);
+
/*
* This assumes that there is only one video stream per channel...
*/
@@ -2718,7 +2720,6 @@ empathy_call_window_sink_removed_cb (EmpathyCallHandler *handler,
gst_bin_remove (GST_BIN (priv->pipeline), output);
gst_bin_remove (GST_BIN (priv->pipeline), priv->funnel);
priv->funnel = NULL;
- return TRUE;
}
}
else if (media_type == FS_MEDIA_TYPE_AUDIO)
@@ -2729,11 +2730,14 @@ empathy_call_window_sink_removed_cb (EmpathyCallHandler *handler,
gst_bin_remove (GST_BIN (priv->pipeline), priv->audio_output);
priv->audio_output = NULL;
- return TRUE;
}
}
+ else
+ {
+ g_assert_not_reached ();
+ }
- return FALSE;
+ return TRUE;
}
static void
@@ -3401,14 +3405,18 @@ empathy_call_window_src_added_cb (EmpathyCallHandler *handler,
}
static gboolean
-empathy_call_window_sink_added_cb (EmpathyCallHandler *handler,
- GstPad *sink, FsMediaType media_type, gpointer user_data)
+empathy_call_window_content_added_cb (EmpathyCallHandler *handler,
+ TfContent *content, gpointer user_data)
{
EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data);
EmpathyCallWindowPriv *priv = GET_PRIV (self);
- GstPad *pad;
+ GstPad *sink, *pad;
+ FsMediaType media_type;
gboolean retval = FALSE;
+ g_object_get (content, "media-type", &media_type, "sink-pad", &sink, NULL);
+ g_assert (sink != NULL);
+
switch (media_type)
{
case FS_MEDIA_TYPE_AUDIO:
@@ -3461,6 +3469,7 @@ empathy_call_window_sink_added_cb (EmpathyCallHandler *handler,
g_assert_not_reached ();
}
+ gst_object_unref (sink);
return retval;
}
@@ -3705,10 +3714,10 @@ empathy_call_window_connect_handler (EmpathyCallWindow *self)
G_CALLBACK (empathy_call_window_channel_closed_cb), self);
g_signal_connect (priv->handler, "src-pad-added",
G_CALLBACK (empathy_call_window_src_added_cb), self);
- g_signal_connect (priv->handler, "sink-pad-added",
- G_CALLBACK (empathy_call_window_sink_added_cb), self);
- g_signal_connect (priv->handler, "sink-pad-removed",
- G_CALLBACK (empathy_call_window_sink_removed_cb), self);
+ g_signal_connect (priv->handler, "content-added",
+ G_CALLBACK (empathy_call_window_content_added_cb), self);
+ g_signal_connect (priv->handler, "content-removed",
+ G_CALLBACK (empathy_call_window_content_removed_cb), self);
/* We connect to ::call-channel unconditionally since we'll
* get new channels if we hangup and redial or if we reuse the