aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-04 22:39:01 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-05 21:34:57 +0800
commit812c19a6c3c96b089cfe5be40d6fbd09e8b3e013 (patch)
tree8af6fc73b8acf008285a2248af87a94b72b51365 /libempathy
parent424ded372a1884c12d9dce47199be00b3de531e4 (diff)
downloadgsoc2013-empathy-812c19a6c3c96b089cfe5be40d6fbd09e8b3e013.tar.gz
gsoc2013-empathy-812c19a6c3c96b089cfe5be40d6fbd09e8b3e013.tar.zst
gsoc2013-empathy-812c19a6c3c96b089cfe5be40d6fbd09e8b3e013.zip
TpCall: add {audio,video}-stream-error signals
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tp-call.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c
index eb70c1a87..b537ccf51 100644
--- a/libempathy/empathy-tp-call.c
+++ b/libempathy/empathy-tp-call.c
@@ -29,6 +29,7 @@
#include "empathy-tp-call.h"
#include "empathy-tp-contact-factory.h"
#include "empathy-utils.h"
+#include "empathy-marshal.h"
#define DEBUG_FLAG EMPATHY_DEBUG_TP
#include "empathy-debug.h"
@@ -46,6 +47,15 @@ typedef struct
EmpathyTpCallStream *video;
} EmpathyTpCallPriv;
+/* signal enum */
+enum {
+ AUDIO_STREAM_ERROR,
+ VIDEO_STREAM_ERROR,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = {0};
+
enum
{
PROP_0,
@@ -364,6 +374,34 @@ tp_call_async_cb (TpProxy *proxy,
DEBUG ("Error %s: %s", (gchar *) user_data, error->message);
}
+static void
+tp_call_stream_error_cb (TpChannel *channel,
+ guint stream_id,
+ guint error_code,
+ const gchar *msg,
+ gpointer user_data,
+ GObject *call)
+{
+ EmpathyTpCall *self = EMPATHY_TP_CALL (call);
+ EmpathyTpCallPriv *priv = GET_PRIV (self);
+
+ DEBUG ("Stream error on stream %u: %s (code: %u)", stream_id, msg,
+ error_code);
+
+ if (priv->audio->id == stream_id)
+ {
+ g_signal_emit (call, signals[AUDIO_STREAM_ERROR], 0, error_code, msg);
+ }
+ else if (priv->video->id == stream_id)
+ {
+ g_signal_emit (call, signals[VIDEO_STREAM_ERROR], 0, error_code, msg);
+ }
+ else
+ {
+ DEBUG ("Unknown stream id: %u", stream_id);
+ }
+}
+
static GObject *
tp_call_constructor (GType type,
guint n_construct_params,
@@ -390,6 +428,8 @@ tp_call_constructor (GType type,
tp_call_stream_state_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
tp_cli_channel_type_streamed_media_connect_to_stream_direction_changed (priv->channel,
tp_call_stream_direction_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
+ tp_cli_channel_type_streamed_media_connect_to_stream_error (priv->channel,
+ tp_call_stream_error_cb, NULL, NULL, G_OBJECT (call), NULL);
tp_cli_channel_type_streamed_media_call_list_streams (priv->channel, -1,
tp_call_request_streams_cb, NULL, NULL, G_OBJECT (call));
@@ -532,6 +572,24 @@ empathy_tp_call_class_init (EmpathyTpCallClass *klass)
g_param_spec_pointer ("video-stream", "Video stream data",
"Video stream data",
G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
+ signals[AUDIO_STREAM_ERROR] =
+ g_signal_new ("audio-stream-error",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, 0,
+ NULL, NULL,
+ _empathy_marshal_VOID__UINT_STRING,
+ G_TYPE_NONE,
+ 2, G_TYPE_UINT, G_TYPE_STRING);
+
+ signals[VIDEO_STREAM_ERROR] =
+ g_signal_new ("video-stream-error",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, 0,
+ NULL, NULL,
+ _empathy_marshal_VOID__UINT_STRING,
+ G_TYPE_NONE,
+ 2, G_TYPE_UINT, G_TYPE_STRING);
}
static void