summaryrefslogtreecommitdiff
path: root/telepathy-farstream
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2011-11-08 20:11:10 -0500
committerXavier Claessens <xclaesse@gmail.com>2011-11-28 16:08:13 +0100
commit5531a87729b078538fc2da2c619e44fc76f479da (patch)
tree494eb9a6601945f52f67952c27dc0f7f2f0100a3 /telepathy-farstream
parent03f8e008f0e72fe1fc3d5e2b4d1f17b77ba93f71 (diff)
downloadtelepathy-farstream-5531a87729b078538fc2da2c619e44fc76f479da.tar.gz
Port to xclaessen's tp-glib branch
Diffstat (limited to 'telepathy-farstream')
-rw-r--r--telepathy-farstream/call-channel.c201
-rw-r--r--telepathy-farstream/call-channel.h2
-rw-r--r--telepathy-farstream/call-content.c308
-rw-r--r--telepathy-farstream/call-content.h7
-rw-r--r--telepathy-farstream/call-stream.c192
-rw-r--r--telepathy-farstream/call-stream.h25
-rw-r--r--telepathy-farstream/channel.c27
-rw-r--r--telepathy-farstream/content.h1
8 files changed, 288 insertions, 475 deletions
diff --git a/telepathy-farstream/call-channel.c b/telepathy-farstream/call-channel.c
index 446ee17..a6ffda8 100644
--- a/telepathy-farstream/call-channel.c
+++ b/telepathy-farstream/call-channel.c
@@ -92,8 +92,13 @@ static gboolean tf_call_channel_init_finish (GAsyncInitable *initable,
GAsyncResult *res,
GError **error);
-static void got_hardware_streaming (TpProxy *proxy, const GValue *out_value,
- const GError *error, gpointer user_data, GObject *weak_object);
+static void content_added (TpCallChannel *proxy,
+ TpCallContent *context_proxy, TfCallChannel *self);
+static void content_removed (TpCallChannel *proxy,
+ TpCallContent *content_proxy, TfCallChannel *self);
+static void channel_prepared (GObject *proxy, GAsyncResult *prepare_res,
+ gpointer user_data);
+
static void
@@ -198,10 +203,12 @@ tf_call_channel_init_async (GAsyncInitable *initable,
res = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
tf_call_channel_init_async);
- tp_cli_dbus_properties_call_get (self->proxy, -1,
- TP_IFACE_CHANNEL_TYPE_CALL,
- "HardwareStreaming",
- got_hardware_streaming, res, NULL, G_OBJECT (self));
+ tp_g_signal_connect_object (self->proxy, "content-added",
+ G_CALLBACK (content_added), self, 0);
+ tp_g_signal_connect_object (self->proxy, "content-removed",
+ G_CALLBACK (content_removed), self, 0);
+
+ tp_proxy_prepare_async (self->proxy, NULL, channel_prepared, res);
}
static gboolean
@@ -242,17 +249,8 @@ tf_call_channel_dispose (GObject *object)
already been disposed of. */
if (self->contents)
{
- GHashTableIter iter;
- gpointer key, value;
-
- g_hash_table_iter_init (&iter, self->contents);
- while (g_hash_table_iter_next (&iter, &key, &value))
- {
- g_object_run_dispose (G_OBJECT (value));
- }
-
- g_hash_table_destroy (self->contents);
- self->contents = NULL;
+ g_ptr_array_foreach (self->contents, (GFunc) g_object_run_dispose, NULL);
+ g_ptr_array_free (self->contents, TRUE);
}
if (self->participants)
@@ -319,34 +317,31 @@ content_ready (GObject *object, GAsyncResult *res, gpointer user_data)
}
else
{
- GHashTableIter iter;
- gpointer key, value;
-
- g_hash_table_iter_init (&iter, self->contents);
- while (g_hash_table_iter_next (&iter, &key, &value))
- {
- if (value == object)
- {
- g_hash_table_iter_remove (&iter);
- break;
- }
- }
+ g_ptr_array_remove_fast (self->contents, content);
}
g_object_unref (self);
}
static gboolean
-add_content (TfCallChannel *self, const gchar *content_path)
+add_content (TfCallChannel *self, TpCallContent *content_proxy)
{
GError *error = NULL;
TfCallContent *content;
+ guint i;
/* Check if content already added */
- if (g_hash_table_lookup (self->contents, content_path))
- return TRUE;
+ if (!self->contents)
+ return FALSE;
- content = tf_call_content_new_async (self, content_path,
+ for (i = 0; i < self->contents->len; i++)
+ {
+ if (tf_call_content_get_proxy (g_ptr_array_index (self->contents, i)) ==
+ content_proxy)
+ return TRUE;
+ }
+
+ content = tf_call_content_new_async (self, content_proxy,
&error, content_ready, g_object_ref (self));
if (error)
@@ -357,52 +352,16 @@ add_content (TfCallChannel *self, const gchar *content_path)
return FALSE;
}
- g_hash_table_insert (self->contents, g_strdup (content_path), content);
+ g_ptr_array_add (self->contents, content);
return TRUE;
}
static void
-got_contents (TpProxy *proxy, const GValue *out_value,
- const GError *error, gpointer user_data, GObject *weak_object)
+content_added (TpCallChannel *proxy,
+ TpCallContent *content_proxy,
+ TfCallChannel *self)
{
- TfCallChannel *self = TF_CALL_CHANNEL (weak_object);
- GSimpleAsyncResult *res = user_data;
- GPtrArray *contents;
- guint i;
-
- if (error)
- {
- g_warning ("Error getting the Contents property: %s",
- error->message);
- g_simple_async_result_set_from_error (res, error);
- goto out;
- }
-
- contents = g_value_get_boxed (out_value);
-
- self->contents = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, g_object_unref);
-
- for (i = 0; i < contents->len; i++)
- if (!add_content (self, g_ptr_array_index (contents, i)))
- break;
-
- g_simple_async_result_set_op_res_gboolean (res, TRUE);
-
-out:
- g_simple_async_result_complete (res);
- g_object_unref (res);
-}
-
-static void
-content_added (TpChannel *proxy,
- const gchar *arg_Content,
- gpointer user_data,
- GObject *weak_object)
-{
- TfCallChannel *self = TF_CALL_CHANNEL (weak_object);
-
/* Ignore signals before we got the "Contents" property to avoid races that
* could cause the same content to be added twice
*/
@@ -410,52 +369,54 @@ content_added (TpChannel *proxy,
if (!self->contents)
return;
- add_content (self, arg_Content);
+ add_content (self, content_proxy);
}
static void
-content_removed (TpChannel *proxy,
- const gchar *arg_Content,
- const GValueArray *arg_Reason,
- gpointer user_data,
- GObject *weak_object)
+content_removed (TpCallChannel *proxy,
+ TpCallContent *content_proxy,
+ TfCallChannel *self)
{
- TfCallChannel *self = TF_CALL_CHANNEL (weak_object);
- TfCallContent *content;
-
+ guint i;
if (!self->contents)
return;
- content = g_hash_table_lookup (self->contents, arg_Content);
-
- if (content)
+ for (i = 0; i < self->contents->len; i++)
{
- g_object_ref (content);
- g_hash_table_remove (self->contents, arg_Content);
- g_signal_emit (self, signals[SIGNAL_CONTENT_REMOVED], 0, content);
- g_object_unref (content);
+ if (tf_call_content_get_proxy (g_ptr_array_index (self->contents, i)) ==
+ content_proxy)
+ {
+ TfCallContent *content = g_ptr_array_index (self->contents, i);
+
+ g_object_ref (content);
+ g_ptr_array_remove_index_fast (self->contents, i);
+ g_signal_emit (self, signals[SIGNAL_CONTENT_REMOVED], 0, content);
+ g_object_unref (content);
+ return;
+ }
}
}
-
static void
-got_hardware_streaming (TpProxy *proxy, const GValue *out_value,
- const GError *error, gpointer user_data, GObject *weak_object)
+channel_prepared (GObject *proxy, GAsyncResult *prepare_res, gpointer user_data)
{
- TfCallChannel *self = TF_CALL_CHANNEL (weak_object);
GSimpleAsyncResult *res = user_data;
- GError *myerror = NULL;
+ TfCallChannel *self =
+ TF_CALL_CHANNEL (g_async_result_get_source_object (G_ASYNC_RESULT (res)));
+ GError *error = NULL;
+ GPtrArray *contents;
+ guint i;
- if (error)
+ if (!tp_proxy_prepare_finish (proxy, prepare_res, &error))
{
- g_warning ("Error getting the hardware streaming property: %s",
+ g_warning ("Preparing the channel: %s",
error->message);
- g_simple_async_result_set_from_error (res, error);
+ g_simple_async_result_take_error (res, error);
goto error;
}
- if (g_value_get_boolean (out_value))
+ if (!tp_call_channel_has_hardware_streaming (TP_CALL_CHANNEL (proxy)))
{
g_warning ("Hardware streaming property is TRUE, ignoring");
@@ -464,38 +425,24 @@ got_hardware_streaming (TpProxy *proxy, const GValue *out_value,
goto error;
}
- tp_cli_channel_type_call_connect_to_content_added (TP_CHANNEL (proxy),
- content_added, NULL, NULL, G_OBJECT (self), &myerror);
- if (myerror)
- {
- g_warning ("Error connectiong to ContentAdded signal: %s",
- myerror->message);
- g_simple_async_result_set_from_error (res, myerror);
- g_clear_error (&myerror);
- goto error;
- }
+ contents = tp_call_channel_get_contents (TP_CALL_CHANNEL (proxy));
- tp_cli_channel_type_call_connect_to_content_removed (
- TP_CHANNEL (proxy), content_removed, NULL, NULL, G_OBJECT (self),
- &myerror);
- if (myerror)
- {
- g_warning ("Error connectiong to ContentRemoved signal: %s",
- myerror->message);
- g_simple_async_result_set_from_error (res, myerror);
- g_clear_error (&myerror);
- goto error;
- }
+ self->contents = g_ptr_array_new_with_free_func (g_object_unref);
- tp_cli_dbus_properties_call_get (proxy, -1,
- TP_IFACE_CHANNEL_TYPE_CALL, "Contents",
- got_contents, res, NULL, G_OBJECT (self));
+ for (i = 0; i < contents->len; i++)
+ if (!add_content (self, g_ptr_array_index (contents, i)))
+ break;
+
+ g_simple_async_result_set_op_res_gboolean (res, TRUE);
+
+ g_object_unref (self);
return;
error:
g_simple_async_result_complete (res);
g_object_unref (res);
+ g_object_unref (self);
}
void
@@ -540,9 +487,8 @@ tf_call_channel_bus_message (TfCallChannel *channel,
{
GError *error = NULL;
gchar *debug;
- GHashTableIter iter;
- gpointer key, value;
struct CallConference *cc;
+ guint i;
cc = find_call_conference_by_conference (channel, GST_MESSAGE_SRC (message));
if (!cc)
@@ -572,9 +518,9 @@ tf_call_channel_bus_message (TfCallChannel *channel,
break;
}
- g_hash_table_iter_init (&iter, channel->contents);
- while (g_hash_table_iter_next (&iter, &key, &value))
- if (tf_call_content_bus_message (value, message))
+ for (i = 0; i < channel->contents->len; i++)
+ if (tf_call_content_bus_message (g_ptr_array_index (channel->contents, i),
+ message))
return TRUE;
return FALSE;
@@ -718,5 +664,4 @@ _tf_call_channel_put_participant (TfCallChannel *channel,
return;
}
}
-
}
diff --git a/telepathy-farstream/call-channel.h b/telepathy-farstream/call-channel.h
index 3848818..8c268d2 100644
--- a/telepathy-farstream/call-channel.h
+++ b/telepathy-farstream/call-channel.h
@@ -76,7 +76,7 @@ struct _TfCallChannel {
GHashTable *fsconferences;
- GHashTable *contents; /* NULL before getting the first contents */
+ GPtrArray *contents; /* NULL before getting the first contents */
GPtrArray *participants;
};
diff --git a/telepathy-farstream/call-content.c b/telepathy-farstream/call-content.c
index ea8c60c..4ae725a 100644
--- a/telepathy-farstream/call-content.c
+++ b/telepathy-farstream/call-content.c
@@ -67,7 +67,6 @@ struct _TfCallContent {
TpCallContent *proxy;
FsSession *fssession;
- TpMediaStreamType media_type;
TpProxy *current_media_description;
guint current_md_contact_handle;
@@ -81,7 +80,7 @@ struct _TfCallContent {
GList *last_sent_codecs;
- GHashTable *streams; /* NULL before getting the first streams */
+ GPtrArray *streams; /* NULL before getting the first streams */
/* Streams for which we don't have a session yet*/
GList *outstanding_streams;
@@ -298,7 +297,7 @@ tf_call_content_dispose (GObject *object)
g_debug (G_STRFUNC);
if (self->streams)
- g_hash_table_destroy (self->streams);
+ g_ptr_array_free (self->streams, TRUE);
self->streams = NULL;
if (self->fssession)
@@ -402,35 +401,22 @@ tf_call_content_get_property (GObject *object,
}
static void
-create_stream (TfCallContent *self, gchar *stream_path)
+create_stream (TfCallContent *self, TpCallStream *stream_proxy)
{
- GError *error = NULL;
- TfCallStream *stream = tf_call_stream_new (self->call_channel, self,
- stream_path, &error);
-
- if (error)
- {
- /* TODO: Use per-stream errors */
- tf_call_content_error (self,
- TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
- TP_ERROR_STR_MEDIA_STREAMING_ERROR,
- "Error creating the stream object: %s", error->message);
- return;
- }
-
- g_hash_table_insert (self->streams, stream_path, stream);
+ g_ptr_array_add (self->streams,
+ tf_call_stream_new (self, stream_proxy));
}
static void
-add_stream (TfCallContent *self, const gchar *stream_path)
+add_stream (TfCallContent *self, TpCallStream *stream_proxy)
{
if (!self->fsconference)
{
self->outstanding_streams = g_list_prepend (self->outstanding_streams,
- g_strdup (stream_path));
+ stream_proxy);
} else {
- create_stream (self, g_strdup (stream_path));
+ create_stream (self, stream_proxy);
}
}
@@ -565,7 +551,7 @@ object_has_property (GObject *object, const gchar *property)
}
static void
-on_content_dtmf_change_requested (TpProxy *proxy,
+on_content_dtmf_change_requested (TpCallContent *proxy,
guchar arg_Event,
guint arg_State,
gpointer user_data,
@@ -782,7 +768,7 @@ process_media_description (TfCallContent *self,
g_debug ("Got MediaDescription");
- fscodecs = tpcodecs_to_fscodecs (tp_media_type_to_fs (self->media_type),
+ fscodecs = tpcodecs_to_fscodecs (tf_call_content_get_fs_media_type (self),
codecs, does_avpf, rtcp_fb);
fsrtp_hdrext = tprtphdrext_to_fsrtphdrext (rtp_hdrext);
@@ -805,7 +791,7 @@ process_media_description (TfCallContent *self,
}
static void
-on_content_video_keyframe_requested (TpProxy *proxy,
+on_content_video_keyframe_requested (TpCallContent *proxy,
gpointer user_data,
GObject *weak_object)
{
@@ -840,7 +826,7 @@ on_content_video_keyframe_requested (TpProxy *proxy,
}
static void
-on_content_video_resolution_changed (TpProxy *proxy,
+on_content_video_resolution_changed (TpCallContent *proxy,
const GValueArray *resolution,
gpointer user_data,
GObject *weak_object)
@@ -869,7 +855,7 @@ on_content_video_resolution_changed (TpProxy *proxy,
}
static void
-on_content_video_bitrate_changed (TpProxy *proxy,
+on_content_video_bitrate_changed (TpCallContent *proxy,
guint bitrate,
gpointer user_data,
GObject *weak_object)
@@ -888,7 +874,7 @@ on_content_video_bitrate_changed (TpProxy *proxy,
}
static void
-on_content_video_framerate_changed (TpProxy *proxy,
+on_content_video_framerate_changed (TpCallContent *proxy,
guint framerate,
gpointer user_data,
GObject *weak_object)
@@ -907,7 +893,7 @@ on_content_video_framerate_changed (TpProxy *proxy,
}
static void
-on_content_video_mtu_changed (TpProxy *proxy,
+on_content_video_mtu_changed (TpCallContent *proxy,
guint mtu,
gpointer user_data,
GObject *weak_object)
@@ -1016,7 +1002,7 @@ got_content_media_properties (TpProxy *proxy, GHashTable *properties,
}
self->fssession = fs_conference_new_session (self->fsconference,
- tp_media_type_to_fs (self->media_type), &myerror);
+ tf_call_content_get_fs_media_type (self), &myerror);
if (!self->fssession)
{
@@ -1105,20 +1091,17 @@ got_content_media_properties (TpProxy *proxy, GHashTable *properties,
}
static void
-setup_content_media_properties (TfCallContent *self,
- TpProxy *proxy,
- GSimpleAsyncResult *res)
+setup_content_media_properties (TfCallContent *self, GSimpleAsyncResult *res)
{
GError *error = NULL;
if (tp_cli_call_content_interface_media_connect_to_dtmf_change_requested (
- TP_CALL_CONTENT (proxy),
- on_content_dtmf_change_requested,
+ self->proxy, on_content_dtmf_change_requested,
NULL, NULL, G_OBJECT (self), &error) == NULL)
goto connect_failed;
- tp_cli_dbus_properties_call_get_all (proxy, -1,
+ tp_cli_dbus_properties_call_get_all (TP_PROXY (self->proxy), -1,
TP_IFACE_CALL_CONTENT_INTERFACE_MEDIA,
got_content_media_properties, res, NULL, G_OBJECT (self));
@@ -1230,14 +1213,14 @@ got_content_video_control_properties (TpProxy *proxy, GHashTable *properties,
array = tp_asv_get_boxed (properties, "VideoResolution",
TP_STRUCT_TYPE_VIDEO_RESOLUTION);
if (array)
- on_content_video_resolution_changed (proxy, array,
+ on_content_video_resolution_changed (TP_CALL_CONTENT (proxy), array,
NULL, G_OBJECT (self));
self->notifier = fs_element_added_notifier_new ();
g_signal_connect (self->notifier, "element-added",
G_CALLBACK (content_video_element_added), self);
- setup_content_media_properties (self, proxy, res);
+ setup_content_media_properties (self, res);
return;
error:
@@ -1248,46 +1231,36 @@ error:
static void
-setup_content_video_control (TfCallContent *self,
- TpProxy *proxy,
- GSimpleAsyncResult *res)
+setup_content_video_control (TfCallContent *self, GSimpleAsyncResult *res)
{
GError *error = NULL;
- tp_proxy_add_interface_by_id (proxy,
- TP_IFACE_QUARK_CALL_CONTENT_INTERFACE_VIDEO_CONTROL);
-
if (tp_cli_call_content_interface_video_control_connect_to_key_frame_requested (
- TP_CALL_CONTENT (proxy),
- on_content_video_keyframe_requested,
+ self->proxy, on_content_video_keyframe_requested,
NULL, NULL, G_OBJECT (self), &error) == NULL)
goto connect_failed;
if (tp_cli_call_content_interface_video_control_connect_to_video_resolution_changed (
- TP_CALL_CONTENT (proxy),
- on_content_video_resolution_changed,
+ self->proxy, on_content_video_resolution_changed,
NULL, NULL, G_OBJECT (self), &error) == NULL)
goto connect_failed;
if (tp_cli_call_content_interface_video_control_connect_to_bitrate_changed (
- TP_CALL_CONTENT (proxy),
- on_content_video_bitrate_changed,
+ self->proxy, on_content_video_bitrate_changed,
NULL, NULL, G_OBJECT (self), NULL) == NULL)
goto connect_failed;
if (tp_cli_call_content_interface_video_control_connect_to_framerate_changed (
- TP_CALL_CONTENT (proxy),
- on_content_video_framerate_changed,
+ self->proxy, on_content_video_framerate_changed,
NULL, NULL, G_OBJECT (self), NULL) == NULL)
goto connect_failed;
if (tp_cli_call_content_interface_video_control_connect_to_mtu_changed (
- TP_CALL_CONTENT (proxy),
- on_content_video_mtu_changed,
+ self->proxy, on_content_video_mtu_changed,
NULL, NULL, G_OBJECT (self), NULL) == NULL)
goto connect_failed;
- tp_cli_dbus_properties_call_get_all (proxy, -1,
+ tp_cli_dbus_properties_call_get_all (TP_PROXY (self->proxy), -1,
TP_IFACE_CALL_CONTENT_INTERFACE_VIDEO_CONTROL,
got_content_video_control_properties, res, NULL, G_OBJECT (self));
@@ -1305,7 +1278,7 @@ connect_failed:
}
static void
-new_media_description_offer (TpProxy *proxy,
+new_media_description_offer (TpCallContent *proxy,
const gchar *arg_Media_Description,
guint arg_Contact,
GHashTable *arg_Properties,
@@ -1336,26 +1309,24 @@ new_media_description_offer (TpProxy *proxy,
static void
-got_content_properties (TpProxy *proxy, GHashTable *out_Properties,
- const GError *error, gpointer user_data, GObject *weak_object)
+content_prepared (GObject *src, GAsyncResult *prepare_res,
+ gpointer user_data)
{
- TfCallContent *self = TF_CALL_CONTENT (weak_object);
+ TpCallContent *proxy = TP_CALL_CONTENT (src);
GSimpleAsyncResult *res = user_data;
- gboolean valid;
+ TfCallContent *self =
+ TF_CALL_CONTENT (g_async_result_get_source_object (G_ASYNC_RESULT (res)));
GPtrArray *streams;
- GError *myerror = NULL;
+ GError *error = NULL;
guint i;
- const gchar * const *interfaces;
- gboolean got_media_interface = FALSE;
- gboolean got_video_control_interface = FALSE;
- if (error)
+ if (!tp_proxy_prepare_finish (proxy, prepare_res, &error))
{
tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Error getting the Content's properties: %s", error->message);
- g_simple_async_result_set_from_error (res, error);
+ g_simple_async_result_take_error (res, error);
g_simple_async_result_complete (res);
g_object_unref (res);
return;
@@ -1371,48 +1342,8 @@ got_content_properties (TpProxy *proxy, GHashTable *out_Properties,
return;
}
- if (!out_Properties)
- {
- tf_call_content_error_literal (self,
- TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
- TP_ERROR_STR_CONFUSED,
- "Error getting the Content's properties: there are none");
- g_simple_async_result_set_error (res, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
- "Error getting the Content's properties: there are none");
- g_simple_async_result_complete (res);
- g_object_unref (res);
- return;
- }
-
- interfaces = tp_asv_get_strv (out_Properties, "Interfaces");
-
- if (interfaces == NULL)
- {
- tf_call_content_error_literal (self,
- TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
- TP_ERROR_STR_CONFUSED,
- "Content does not have the Interfaces property, "
- "but HardwareStreaming was NOT true");
- g_simple_async_result_set_error (res, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
- "Content does not have the Interfaces property, "
- "but HardwareStreaming was NOT true");
- g_simple_async_result_complete (res);
- g_object_unref (res);
- return;
- }
-
- for (i = 0; interfaces[i]; i++)
- {
- if (!strcmp (interfaces[i],
- TP_IFACE_CALL_CONTENT_INTERFACE_MEDIA))
- got_media_interface = TRUE;
-
- if (!strcmp (interfaces[i],
- TP_IFACE_CALL_CONTENT_INTERFACE_VIDEO_CONTROL))
- got_video_control_interface = TRUE;
- }
-
- if (!got_media_interface)
+ if (!tp_proxy_has_interface_by_id (proxy,
+ TP_IFACE_QUARK_CALL_CONTENT_INTERFACE_MEDIA))
{
tf_call_content_error_literal (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
@@ -1427,69 +1358,45 @@ got_content_properties (TpProxy *proxy, GHashTable *out_Properties,
return;
}
- self->media_type = tp_asv_get_uint32 (out_Properties, "Type", &valid);
- if (!valid)
- goto invalid_property;
-
-
- streams = tp_asv_get_boxed (out_Properties, "Streams",
- TP_ARRAY_TYPE_OBJECT_PATH_LIST);
- if (!streams)
- goto invalid_property;
+ self->streams = g_ptr_array_new_with_free_func (g_object_unref);
- self->streams = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, g_object_unref);
+ streams = tp_call_content_get_streams (proxy);
for (i = 0; i < streams->len; i++)
add_stream (self, g_ptr_array_index (streams, i));
- tp_proxy_add_interface_by_id (TP_PROXY (self->proxy),
- TP_IFACE_QUARK_CALL_CONTENT_INTERFACE_MEDIA);
-
-
tp_cli_call_content_interface_media_connect_to_new_media_description_offer (
- TP_CALL_CONTENT (proxy), new_media_description_offer, NULL, NULL,
- G_OBJECT (self), &myerror);
+ self->proxy, new_media_description_offer, NULL, NULL,
+ G_OBJECT (self), &error);
- if (myerror)
+ if (error)
{
tf_call_content_error (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
"Error connectiong to NewCodecMediaDescription signal: %s",
- myerror->message);
- g_simple_async_result_set_from_error (res, myerror);
+ error->message);
+ g_simple_async_result_set_from_error (res, error);
g_simple_async_result_complete (res);
g_object_unref (res);
- g_clear_error (&myerror);
+ g_clear_error (&error);
return;
}
- if (got_video_control_interface)
- setup_content_video_control (self, proxy, res);
+ if (tp_proxy_has_interface_by_id (proxy,
+ TP_IFACE_QUARK_CALL_CONTENT_INTERFACE_VIDEO_CONTROL))
+ setup_content_video_control (self, res);
else
- setup_content_media_properties (self, proxy, res);
-
- return;
+ setup_content_media_properties (self, res);
- invalid_property:
- tf_call_content_error_literal (self,
- TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, TP_ERROR_STR_CONFUSED,
- "Error getting the Content's properties: invalid type");
- g_simple_async_result_set_error (res, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
- "Error getting the Content's properties: invalid type");
- g_simple_async_result_complete (res);
- g_object_unref (res);
return;
}
static void
-streams_added (TpProxy *proxy,
- const GPtrArray *arg_Streams,
- gpointer user_data,
- GObject *weak_object)
+streams_added (TpCallContent *proxy,
+ GPtrArray *streams,
+ TfCallContent *self)
{
- TfCallContent *self = TF_CALL_CONTENT (weak_object);
guint i;
/* Ignore signals before we got the "Contents" property to avoid races that
@@ -1499,25 +1406,28 @@ streams_added (TpProxy *proxy,
if (!self->streams)
return;
- for (i = 0; i < arg_Streams->len; i++)
- add_stream (self, g_ptr_array_index (arg_Streams, i));
+ for (i = 0; i < streams->len; i++)
+ add_stream (self, g_ptr_array_index (streams, i));
}
static void
-streams_removed (TpProxy *proxy,
- const GPtrArray *arg_Streams,
- const GValueArray *arg_Reason,
- gpointer user_data,
- GObject *weak_object)
+streams_removed (TpCallContent *proxy,
+ const GPtrArray *streams,
+ TfCallContent *self)
{
- TfCallContent *self = TF_CALL_CONTENT (weak_object);
- guint i;
+ guint i, j;
if (!self->streams)
return;
- for (i = 0; i < arg_Streams->len; i++)
- g_hash_table_remove (self->streams, g_ptr_array_index (arg_Streams, i));
+ for (i = 0; i < streams->len; i++)
+ for (j = 0; j < self->streams->len; j++)
+ if (g_ptr_array_index (streams, i) ==
+ tf_call_stream_get_proxy (g_ptr_array_index (self->streams, j)))
+ {
+ g_ptr_array_remove_index_fast (self->streams, j);
+ break;
+ }
}
@@ -1529,7 +1439,6 @@ tf_call_content_init_async (GAsyncInitable *initable,
gpointer user_data)
{
TfCallContent *self = TF_CALL_CONTENT (initable);
- GError *myerror = NULL;
GSimpleAsyncResult *res;
if (cancellable != NULL)
@@ -1540,39 +1449,16 @@ tf_call_content_init_async (GAsyncInitable *initable,
return;
}
- tp_cli_call_content_connect_to_streams_added (
- TP_CALL_CONTENT (self->proxy), streams_added, NULL, NULL,
- G_OBJECT (self), &myerror);
- if (myerror)
- {
- tf_call_content_error (self,
- TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, TP_ERROR_STR_CONFUSED,
- "Error connectiong to StreamAdded signal: %s", myerror->message);
- g_simple_async_report_gerror_in_idle (G_OBJECT (self), callback,
- user_data, myerror);
- return;
- }
-
- tp_cli_call_content_connect_to_streams_removed (
- TP_CALL_CONTENT (self->proxy), streams_removed, NULL, NULL,
- G_OBJECT (self), &myerror);
- if (myerror)
- {
- tf_call_content_error (self,
- TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, TP_ERROR_STR_CONFUSED,
- "Error connectiong to StreamRemoved signal: %s", myerror->message);
- g_simple_async_report_gerror_in_idle (G_OBJECT (self), callback,
- user_data, myerror);
- return;
- }
+ tp_g_signal_connect_object (self->proxy, "streams-added",
+ G_CALLBACK (streams_added), self, 0);
+ tp_g_signal_connect_object (self->proxy, "streams-removed",
+ G_CALLBACK (streams_removed), self, 0);
res = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
tf_call_content_init_async);
- tp_cli_dbus_properties_call_get_all (self->proxy, -1,
- TP_IFACE_CALL_CONTENT, got_content_properties, res,
- NULL, G_OBJECT (self));
+ tp_proxy_prepare_async (self->proxy, NULL, content_prepared, res);
}
static gboolean
@@ -1594,20 +1480,18 @@ tf_call_content_init_finish (GAsyncInitable *initable,
TfCallContent *
tf_call_content_new_async (TfCallChannel *call_channel,
- const gchar *object_path, GError **error,
+ TpCallContent *content_proxy, GError **error,
GAsyncReadyCallback callback, gpointer user_data)
{
TfCallContent *self;
- TpCallContent *proxy = tp_call_content_new (
- call_channel->proxy, object_path, error);
- if (!proxy)
- return NULL;
+ g_return_val_if_fail (call_channel != NULL, NULL);
+ g_return_val_if_fail (content_proxy != NULL, NULL);
self = g_object_new (TF_TYPE_CALL_CONTENT, NULL);
self->call_channel = call_channel;
- self->proxy = proxy;
+ self->proxy = content_proxy;
g_async_initable_init_async (G_ASYNC_INITABLE (self), 0, NULL,
callback, user_data);
@@ -1928,8 +1812,6 @@ tf_call_content_bus_message (TfCallContent *content,
GstMessage *message)
{
gboolean ret = TRUE;
- GHashTableIter iter;
- gpointer key, value;
FsDTMFMethod method;
FsDTMFEvent event;
guint8 volume;
@@ -1937,6 +1819,7 @@ tf_call_content_bus_message (TfCallContent *content,
GList *secondary_codecs;
FsError error_no;
const gchar *error_msg;
+ guint i;
/* Guard against early disposal */
@@ -2010,9 +1893,9 @@ tf_call_content_bus_message (TfCallContent *content,
ret = FALSE;
}
- g_hash_table_iter_init (&iter, content->streams);
- while (g_hash_table_iter_next (&iter, &key, &value))
- if (tf_call_stream_bus_message (value, message))
+ for (i = 0; i < content->streams->len; i++)
+ if (tf_call_stream_bus_message (g_ptr_array_index (content->streams, i),
+ message))
return TRUE;
return ret;
@@ -2188,7 +2071,7 @@ _tf_call_content_put_fsstream (TfCallContent *content, FsStream *fsstream)
FsMediaType
tf_call_content_get_fs_media_type (TfCallContent *content)
{
- return tp_media_type_to_fs (content->media_type);
+ return tp_media_type_to_fs (tp_call_content_get_media_type (content->proxy));
}
static void
@@ -2316,8 +2199,7 @@ tf_call_content_sending_failed (TfContent *content,
const gchar *message)
{
TfCallContent *self = TF_CALL_CONTENT (content);
- GHashTableIter iter;
- gpointer key, value;
+ guint i;
if (!self->streams)
{
@@ -2325,9 +2207,9 @@ tf_call_content_sending_failed (TfContent *content,
return;
}
- g_hash_table_iter_init (&iter, self->streams);
- while (g_hash_table_iter_next (&iter, &key, &value))
- tf_call_stream_sending_failed (value, message);
+ for (i = 0; i < self->streams->len; i++)
+ tf_call_stream_sending_failed (g_ptr_array_index (self->streams, i),
+ message);
}
@@ -2337,8 +2219,7 @@ tf_call_content_receiving_failed (TfContent *content,
const gchar *message)
{
TfCallContent *self = TF_CALL_CONTENT (content);
- GHashTableIter iter;
- gpointer key, value;
+ guint i;
if (!self->streams)
{
@@ -2346,7 +2227,16 @@ tf_call_content_receiving_failed (TfContent *content,
return;
}
- g_hash_table_iter_init (&iter, self->streams);
- while (g_hash_table_iter_next (&iter, &key, &value))
- tf_call_stream_receiving_failed (value, handles, handle_count, message);
+ for (i = 0; i < self->streams->len; i++)
+ tf_call_stream_receiving_failed (g_ptr_array_index (self->streams, i),
+ handles, handle_count, message);
+}
+
+
+TpCallContent *
+tf_call_content_get_proxy (TfCallContent *content)
+{
+ g_return_val_if_fail (TF_IS_CALL_CONTENT (content), NULL);
+
+ return content->proxy;
}
diff --git a/telepathy-farstream/call-content.h b/telepathy-farstream/call-content.h
index 2a09208..7af9703 100644
--- a/telepathy-farstream/call-content.h
+++ b/telepathy-farstream/call-content.h
@@ -23,7 +23,7 @@
#include <glib-object.h>
#include <gst/gst.h>
-#include <telepathy-glib/channel.h>
+#include <telepathy-glib/telepathy-glib.h>
#include "call-channel.h"
#include "content.h"
@@ -74,7 +74,7 @@ GType tf_call_content_get_type (void);
TfCallContent *tf_call_content_new_async (
TfCallChannel *call_channel,
- const gchar *object_path,
+ TpCallContent *content_proxy,
GError **error,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -99,6 +99,9 @@ tf_call_content_get_fs_media_type (TfCallContent *content);
gboolean
tf_call_content_bus_message (TfCallContent *content, GstMessage *message);
+TpCallContent *
+tf_call_content_get_proxy (TfCallContent *content);
+
G_END_DECLS
#endif /* __TF_CALL_CONTENT_H__ */
diff --git a/telepathy-farstream/call-stream.c b/telepathy-farstream/call-stream.c
index 184dcbf..eeb2dd9 100644
--- a/telepathy-farstream/call-stream.c
+++ b/telepathy-farstream/call-stream.c
@@ -125,7 +125,7 @@ tf_call_stream_dispose (GObject *object)
static void
-sending_state_changed (TpProxy *proxy,
+sending_state_changed (TpCallStream *proxy,
guint arg_State,
gpointer user_data, GObject *weak_object)
{
@@ -176,7 +176,7 @@ sending_state_changed (TpProxy *proxy,
}
static void
-receiving_state_changed (TpProxy *proxy,
+receiving_state_changed (TpCallStream *proxy,
guint arg_State,
gpointer user_data, GObject *weak_object)
{
@@ -433,16 +433,16 @@ tf_call_stream_try_adding_fsstream (TfCallStream *self)
}
if (self->sending_state == TP_STREAM_FLOW_STATE_PENDING_START)
- sending_state_changed (TP_PROXY (self->proxy),
+ sending_state_changed (self->proxy,
self->sending_state, NULL, (GObject *) self);
if (self->receiving_state == TP_STREAM_FLOW_STATE_PENDING_START)
- receiving_state_changed (TP_PROXY (self->proxy),
+ receiving_state_changed (self->proxy,
self->receiving_state, NULL, (GObject *) self);
}
static void
-server_info_retrieved (TpProxy *proxy,
+server_info_retrieved (TpCallStream *proxy,
gpointer user_data, GObject *weak_object)
{
TfCallStream *self = TF_CALL_STREAM (weak_object);
@@ -453,7 +453,7 @@ server_info_retrieved (TpProxy *proxy,
}
static void
-relay_info_changed (TpProxy *proxy,
+relay_info_changed (TpCallStream *proxy,
const GPtrArray *arg_Relay_Info,
gpointer user_data, GObject *weak_object)
{
@@ -478,7 +478,7 @@ relay_info_changed (TpProxy *proxy,
}
static void
-stun_servers_changed (TpProxy *proxy,
+stun_servers_changed (TpCallStream *proxy,
const GPtrArray *arg_Servers,
gpointer user_data, GObject *weak_object)
{
@@ -821,7 +821,7 @@ tf_call_stream_add_endpoint (TfCallStream *self)
static void
-endpoints_changed (TpProxy *proxy,
+endpoints_changed (TpCallStream *proxy,
const GPtrArray *arg_Endpoints_Added,
const GPtrArray *arg_Endpoints_Removed,
gpointer user_data, GObject *weak_object)
@@ -974,7 +974,7 @@ got_stream_media_properties (TpProxy *proxy, GHashTable *out_Properties,
}
static void
-ice_restart_requested (TpProxy *proxy,
+ice_restart_requested (TpCallStream *proxy,
gpointer user_data, GObject *weak_object)
{
TfCallStream *self = TF_CALL_STREAM (weak_object);
@@ -1012,212 +1012,173 @@ ice_restart_requested (TpProxy *proxy,
}
static void
-got_stream_properties (TpProxy *proxy, GHashTable *out_Properties,
- const GError *error, gpointer user_data, GObject *weak_object)
+stream_prepared (GObject *src_object, GAsyncResult *res, gpointer user_data)
{
- TfCallStream *self = TF_CALL_STREAM (weak_object);
- GError *myerror = NULL;
- guint i;
- const gchar * const * interfaces;
- gboolean got_media_interface = FALSE;
+ TfCallStream *self = TF_CALL_STREAM (user_data);
+ TpProxy *proxy = TP_PROXY (src_object);
+ GError *error = NULL;
GHashTable *members;
GHashTableIter iter;
gpointer key, value;
- if (error)
+ if (!tp_proxy_prepare_finish (src_object, res, &error))
{
tf_call_stream_fail (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
TP_ERROR_STR_CONFUSED,
- "Error getting the Streams's properties: %s", error->message);
- return;
- }
-
- if (!out_Properties)
- {
- tf_call_stream_fail_literal (self,
- TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
- TP_ERROR_STR_INVALID_ARGUMENT,
- "Error getting the Content's properties: there are none");
+ "Error preparing the stream Streams: %s", error->message);
+ g_clear_error (&error);
return;
}
- interfaces = tp_asv_get_strv (out_Properties, "Interfaces");
-
- for (i = 0; interfaces[i]; i++)
- if (!strcmp (interfaces[i], TP_IFACE_CALL_STREAM_INTERFACE_MEDIA))
- {
- got_media_interface = TRUE;
- break;
- }
-
- if (!got_media_interface)
- {
- tf_call_stream_fail_literal (self,
- TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
- TP_ERROR_STR_INVALID_ARGUMENT,
- "Stream does not have the media interface,"
- " but HardwareStreaming was NOT true");
+ if (!tp_proxy_has_interface_by_id (proxy,
+ TP_IFACE_QUARK_CALL_STREAM_INTERFACE_MEDIA))
+ {
+ tf_call_stream_fail_literal (self,
+ TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
+ TP_ERROR_STR_INVALID_ARGUMENT,
+ "Stream does not have the media interface,"
+ " but HardwareStreaming was NOT true");
return;
- }
+ }
- members = tp_asv_get_boxed (out_Properties, "RemoteMembers",
- TP_HASH_TYPE_CONTACT_SENDING_STATE_MAP);
- if (!members)
- goto invalid_property;
+ members = tp_call_stream_get_remote_members (self->proxy);
- if (g_hash_table_size (members) != 1)
- {
- tf_call_stream_fail (self,
- TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
- TP_ERROR_STR_NOT_IMPLEMENTED,
- "Only one Member per Stream is supported, there are %d",
- g_hash_table_size (members));
- return;
- }
+ if (g_hash_table_size (members) != 1)
+ {
+ tf_call_stream_fail (self,
+ TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
+ TP_ERROR_STR_NOT_IMPLEMENTED,
+ "Only one Member per Stream is supported, there are %d",
+ g_hash_table_size (members));
+ return;
+ }
g_hash_table_iter_init (&iter, members);
-
if (g_hash_table_iter_next (&iter, &key, &value))
{
self->has_contact = TRUE;
self->contact_handle = GPOINTER_TO_UINT (key);
}
- tp_proxy_add_interface_by_id (TP_PROXY (self->proxy),
- TP_IFACE_QUARK_CALL_STREAM_INTERFACE_MEDIA);
-
-
tp_cli_call_stream_interface_media_connect_to_sending_state_changed (
TP_CALL_STREAM (proxy), sending_state_changed, NULL, NULL,
- G_OBJECT (self), &myerror);
- if (myerror)
+ G_OBJECT (self), &error);
+ if (error)
{
tf_call_stream_fail (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, "",
"Error connectiong to SendingStateChanged signal: %s",
- myerror->message);
- g_clear_error (&myerror);
+ error->message);
+ g_clear_error (&error);
return;
}
-
tp_cli_call_stream_interface_media_connect_to_receiving_state_changed (
TP_CALL_STREAM (proxy), receiving_state_changed, NULL, NULL,
- G_OBJECT (self), &myerror);
- if (myerror)
+ G_OBJECT (self), &error);
+ if (error)
{
tf_call_stream_fail (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, "",
"Error connectiong to ReceivingStateChanged signal: %s",
- myerror->message);
- g_clear_error (&myerror);
+ error->message);
+ g_clear_error (&error);
return;
}
tp_cli_call_stream_interface_media_connect_to_server_info_retrieved (
TP_CALL_STREAM (proxy), server_info_retrieved, NULL, NULL,
- G_OBJECT (self), &myerror);
- if (myerror)
+ G_OBJECT (self), &error);
+ if (error)
{
tf_call_stream_fail (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, "",
"Error connectiong to ServerInfoRetrived signal: %s",
- myerror->message);
- g_clear_error (&myerror);
+ error->message);
+ g_clear_error (&error);
return;
}
tp_cli_call_stream_interface_media_connect_to_stun_servers_changed (
TP_CALL_STREAM (proxy), stun_servers_changed, NULL, NULL,
- G_OBJECT (self), &myerror);
- if (myerror)
+ G_OBJECT (self), &error);
+ if (error)
{
tf_call_stream_fail (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, "",
"Error connectiong to ServerInfoRetrived signal: %s",
- myerror->message);
- g_clear_error (&myerror);
+ error->message);
+ g_clear_error (&error);
return;
}
tp_cli_call_stream_interface_media_connect_to_relay_info_changed (
TP_CALL_STREAM (proxy), relay_info_changed, NULL, NULL,
- G_OBJECT (self), &myerror);
- if (myerror)
+ G_OBJECT (self), &error);
+ if (error)
{
tf_call_stream_fail (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, "",
"Error connectiong to ServerInfoRetrived signal: %s",
- myerror->message);
- g_clear_error (&myerror);
+ error->message);
+ g_clear_error (&error);
return;
}
tp_cli_call_stream_interface_media_connect_to_endpoints_changed (
TP_CALL_STREAM (proxy), endpoints_changed, NULL, NULL,
- G_OBJECT (self), &myerror);
- if (myerror)
+ G_OBJECT (self), &error);
+ if (error)
{
tf_call_stream_fail (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, "",
"Error connectiong to EndpointsChanged signal: %s",
- myerror->message);
- g_clear_error (&myerror);
+ error->message);
+ g_clear_error (&error);
return;
}
tp_cli_call_stream_interface_media_connect_to_ice_restart_requested (
TP_CALL_STREAM (proxy), ice_restart_requested, NULL, NULL,
- G_OBJECT (self), &myerror);
- if (myerror)
+ G_OBJECT (self), &error);
+ if (error)
{
tf_call_stream_fail (self,
TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR, "",
"Error connectiong to ICERestartRequested signal: %s",
- myerror->message);
- g_clear_error (&myerror);
+ error->message);
+ g_clear_error (&error);
return;
}
- tp_cli_dbus_properties_call_get_all (proxy, -1,
+ tp_cli_dbus_properties_call_get_all (TP_PROXY (self->proxy), -1,
TP_IFACE_CALL_STREAM_INTERFACE_MEDIA,
got_stream_media_properties, NULL, NULL, G_OBJECT (self));
return;
-
- invalid_property:
- tf_call_stream_fail_literal (self,
- TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
- TP_ERROR_STR_INVALID_ARGUMENT,
- "Error getting the Stream's properties: invalid type");
- return;
}
TfCallStream *
-tf_call_stream_new (TfCallChannel *call_channel,
- TfCallContent *call_content,
- const gchar *object_path,
- GError **error)
+tf_call_stream_new (TfCallContent *call_content,
+ TpCallStream *stream_proxy)
{
TfCallStream *self;
- TpCallStream *proxy = tp_call_stream_new (call_channel->proxy,
- object_path, error);
- if (!proxy)
- return NULL;
+ g_assert (call_content != NULL);
+ g_assert (stream_proxy != NULL);
- self = g_object_new (TF_TYPE_STREAM, NULL);
+ self = g_object_new (TF_TYPE_CALL_STREAM, NULL);
self->call_content = call_content;
- self->proxy = proxy;
+ self->proxy = stream_proxy;
- tp_cli_dbus_properties_call_get_all (proxy, -1, TP_IFACE_CALL_STREAM,
- got_stream_properties, NULL, NULL, G_OBJECT (self));
+ tp_proxy_prepare_async (self->proxy, NULL, stream_prepared,
+ g_object_ref (self));
return self;
}
@@ -1532,3 +1493,12 @@ tf_call_stream_receiving_failed (TfCallStream *self,
TP_ERROR_STR_MEDIA_STREAMING_ERROR,
message, NULL, NULL, NULL, NULL);
}
+
+
+TpCallStream *
+tf_call_stream_get_proxy (TfCallStream *stream)
+{
+ g_return_val_if_fail (TF_IS_CALL_STREAM (stream), NULL);
+
+ return stream->proxy;
+}
diff --git a/telepathy-farstream/call-stream.h b/telepathy-farstream/call-stream.h
index 3f5c4b8..895872a 100644
--- a/telepathy-farstream/call-stream.h
+++ b/telepathy-farstream/call-stream.h
@@ -23,32 +23,32 @@
#include <glib-object.h>
#include <gst/gst.h>
-#include <telepathy-glib/channel.h>
+#include <telepathy-glib/telepathy-glib.h>
#include "call-channel.h"
#include "call-content.h"
G_BEGIN_DECLS
-#define TF_TYPE_STREAM tf_call_stream_get_type()
+#define TF_TYPE_CALL_STREAM tf_call_stream_get_type()
#define TF_CALL_STREAM(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- TF_TYPE_STREAM, TfCallStream))
+ TF_TYPE_CALL_STREAM, TfCallStream))
#define TF_CALL_STREAM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
- TF_TYPE_STREAM, TfCallStreamClass))
+ TF_TYPE_CALL_STREAM, TfCallStreamClass))
-#define TF_IS_STREAM(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TF_TYPE_STREAM))
+#define TF_IS_CALL_STREAM(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TF_TYPE_CALL_STREAM))
-#define TF_IS_STREAM_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), TF_TYPE_STREAM))
+#define TF_IS_CALL_STREAM_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), TF_TYPE_CALL_STREAM))
#define TF_CALL_STREAM_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
- TF_TYPE_STREAM, TfCallStreamClass))
+ TF_TYPE_CALL_STREAM, TfCallStreamClass))
typedef struct _TfCallStreamPrivate TfCallStreamPrivate;
@@ -113,10 +113,8 @@ struct _TfCallStreamClass{
GType tf_call_stream_get_type (void);
TfCallStream *tf_call_stream_new (
- TfCallChannel *channel,
TfCallContent *content,
- const gchar *object_path,
- GError **error);
+ TpCallStream *stream_proxy);
gboolean tf_call_stream_bus_message (TfCallStream *stream, GstMessage *message);
@@ -126,6 +124,9 @@ void tf_call_stream_receiving_failed (TfCallStream *stream,
guint *handles, guint handle_count,
const gchar *message);
+TpCallStream *
+tf_call_stream_get_proxy (TfCallStream *stream);
+
G_END_DECLS
diff --git a/telepathy-farstream/channel.c b/telepathy-farstream/channel.c
index 3d9b7bb..ac903c1 100644
--- a/telepathy-farstream/channel.c
+++ b/telepathy-farstream/channel.c
@@ -31,13 +31,7 @@
#include <stdlib.h>
-#include <telepathy-glib/call-1.h>
-#include <telepathy-glib/channel.h>
-#include <telepathy-glib/dbus.h>
-#include <telepathy-glib/enums.h>
-#include <telepathy-glib/errors.h>
-#include <telepathy-glib/interfaces.h>
-#include <telepathy-glib/util.h>
+#include <telepathy-glib/telepathy-glib.h>
#include <farstream/fs-conference.h>
@@ -346,11 +340,22 @@ channel_prepared (GObject *obj,
else if (tp_proxy_has_interface_by_id (as_proxy,
TP_IFACE_QUARK_CHANNEL_TYPE_CALL))
{
- tf_call_channel_new_async (channel_proxy, call_channel_ready, res);
+ if (!TP_IS_CALL_CHANNEL (channel_proxy))
+ {
+ g_simple_async_result_set_error (res, TP_ERROR,
+ TP_ERROR_INVALID_ARGUMENT,
+ "You must pass a TpCallChannel object if its a Call channel");
+ g_simple_async_result_set_op_res_gboolean (res, FALSE);
+ g_simple_async_result_complete (res);
+ }
+ else
+ {
+ tf_call_channel_new_async (channel_proxy, call_channel_ready, res);
- self->priv->channel_invalidated_handler = g_signal_connect (
- self->priv->channel_proxy,
- "invalidated", G_CALLBACK (channel_invalidated), self);
+ self->priv->channel_invalidated_handler = g_signal_connect (
+ self->priv->channel_proxy,
+ "invalidated", G_CALLBACK (channel_invalidated), self);
+ }
}
else
{
diff --git a/telepathy-farstream/content.h b/telepathy-farstream/content.h
index eea2455..77914f3 100644
--- a/telepathy-farstream/content.h
+++ b/telepathy-farstream/content.h
@@ -2,7 +2,6 @@
#define __TF_CONTENT_H__
#include <glib-object.h>
-#include <telepathy-glib/call-1.h>
#include <farstream/fs-conference.h>
G_BEGIN_DECLS