aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-call-utils.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-03-02 18:34:47 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-03-02 18:34:47 +0800
commit2ba0e02b8c7a180b1785ef85baab66b0f16db964 (patch)
tree9f9e7043bb1f4ee3ec8fd701a72bff6981edd104 /libempathy-gtk/empathy-call-utils.c
parentfe6c1d00ad01701353fd1f5a85ade27ace898b53 (diff)
parentc144943be6f1e0255a6309d6559183a9101e10cd (diff)
downloadgsoc2013-empathy-2ba0e02b8c7a180b1785ef85baab66b0f16db964.tar
gsoc2013-empathy-2ba0e02b8c7a180b1785ef85baab66b0f16db964.tar.gz
gsoc2013-empathy-2ba0e02b8c7a180b1785ef85baab66b0f16db964.tar.bz2
gsoc2013-empathy-2ba0e02b8c7a180b1785ef85baab66b0f16db964.tar.lz
gsoc2013-empathy-2ba0e02b8c7a180b1785ef85baab66b0f16db964.tar.xz
gsoc2013-empathy-2ba0e02b8c7a180b1785ef85baab66b0f16db964.tar.zst
gsoc2013-empathy-2ba0e02b8c7a180b1785ef85baab66b0f16db964.zip
Merge branch 'empathy-av-ocrete'
Diffstat (limited to 'libempathy-gtk/empathy-call-utils.c')
-rw-r--r--libempathy-gtk/empathy-call-utils.c73
1 files changed, 70 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-call-utils.c b/libempathy-gtk/empathy-call-utils.c
index 77fdb565a..545ec7ce8 100644
--- a/libempathy-gtk/empathy-call-utils.c
+++ b/libempathy-gtk/empathy-call-utils.c
@@ -95,19 +95,71 @@ empathy_call_create_call_request (const gchar *contact,
NULL);
}
+GHashTable *
+empathy_call_create_streamed_media_request (const gchar *contact,
+ gboolean initial_audio,
+ gboolean initial_video)
+{
+ return tp_asv_new (
+ TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
+ TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT,
+ TP_HANDLE_TYPE_CONTACT,
+ TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING,
+ contact,
+ TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_AUDIO, G_TYPE_BOOLEAN,
+ initial_audio,
+ TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_VIDEO, G_TYPE_BOOLEAN,
+ initial_video,
+ NULL);
+}
+
+static void
+create_streamed_media_channel_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GError *error = NULL;
+
+ if (!tp_account_channel_request_create_channel_finish (
+ TP_ACCOUNT_CHANNEL_REQUEST (source),
+ result,
+ &error))
+ {
+ DEBUG ("Failed to create StreamedMedia channel: %s", error->message);
+ show_call_error (error);
+ g_error_free (error);
+ }
+}
+
static void
create_call_channel_cb (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
+ TpAccountChannelRequest *streamed_media_req = user_data;
GError *error = NULL;
if (tp_account_channel_request_create_channel_finish (
TP_ACCOUNT_CHANNEL_REQUEST (source), result, &error))
- return;
+ {
+ g_clear_object (&streamed_media_req);
+ return;
+ }
DEBUG ("Failed to create Call channel: %s", error->message);
+ if (streamed_media_req != NULL)
+ {
+ DEBUG ("Let's try with an StreamedMedia channel");
+ g_error_free (error);
+ tp_account_channel_request_create_channel_async (streamed_media_req,
+ EMPATHY_AV_BUS_NAME, NULL,
+ create_streamed_media_channel_cb,
+ NULL);
+ return;
+ }
+
show_call_error (error);
}
@@ -120,7 +172,10 @@ call_new_with_streams (const gchar *contact,
gint64 timestamp)
{
GHashTable *call_request;
- TpAccountChannelRequest *call_req;
+ TpAccountChannelRequest *call_req, *streamed_media_req = NULL;
+#ifdef HAVE_EMPATHY_AV
+ GHashTable *streamed_media_request;
+#endif
/* Call */
call_request = empathy_call_create_call_request (contact,
@@ -131,8 +186,20 @@ call_new_with_streams (const gchar *contact,
g_hash_table_unref (call_request);
+#ifdef HAVE_EMPATHY_AV
+ /* StreamedMedia */
+ streamed_media_request = empathy_call_create_streamed_media_request (
+ contact, initial_audio, initial_video);
+
+ streamed_media_req = tp_account_channel_request_new (account,
+ streamed_media_request,
+ timestamp);
+
+ g_hash_table_unref (streamed_media_request);
+#endif
+
tp_account_channel_request_create_channel_async (call_req,
- EMPATHY_CALL_BUS_NAME, NULL, create_call_channel_cb, NULL);
+ EMPATHY_CALL_BUS_NAME, NULL, create_call_channel_cb, streamed_media_req);
g_object_unref (call_req);
}