diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-02-20 10:15:45 +0100 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-02-20 10:15:45 +0100 |
commit | 50fb23a47944f2a47427010db697afe5e4a003df (patch) | |
tree | ac737b8266705abafb50c1d63827dcfc9969fb83 | |
parent | 724bf9e4675d28b29e775c5c4ce8c964eb8ca7e6 (diff) | |
parent | 67ab1ed9edc0ce716557bf8db4fb68267b54bf45 (diff) |
Merge remote-tracking branch 'tester/call1-addcontent-direction' into call1call1
-rw-r--r-- | examples/cm/call/call-channel.c | 2 | ||||
-rw-r--r-- | spec/Channel_Type_Call.xml | 6 | ||||
-rw-r--r-- | telepathy-glib/base-call-channel.c | 10 | ||||
-rw-r--r-- | telepathy-glib/base-call-channel.h | 1 | ||||
-rw-r--r-- | telepathy-glib/call-channel.c | 4 | ||||
-rw-r--r-- | telepathy-glib/call-channel.h | 1 | ||||
-rw-r--r-- | tests/dbus/call-channel.c | 18 |
7 files changed, 37 insertions, 5 deletions
diff --git a/examples/cm/call/call-channel.c b/examples/cm/call/call-channel.c index a5361dd7f..677c4951a 100644 --- a/examples/cm/call/call-channel.c +++ b/examples/cm/call/call-channel.c @@ -310,6 +310,7 @@ static void call_accept (TpBaseCallChannel *self); static TpBaseCallContent * call_add_content (TpBaseCallChannel *self, const gchar *name, TpMediaStreamType media, + TpMediaStreamDirection initial_direction, GError **error); static void call_hangup (TpBaseCallChannel *self, guint reason, @@ -675,6 +676,7 @@ static TpBaseCallContent * call_add_content (TpBaseCallChannel *base, const gchar *content_name, guint content_type, + TpMediaStreamDirection initial_direction, GError **error) { ExampleCallChannel *self = EXAMPLE_CALL_CHANNEL (base); diff --git a/spec/Channel_Type_Call.xml b/spec/Channel_Type_Call.xml index 384f1ed2e..240cdddac 100644 --- a/spec/Channel_Type_Call.xml +++ b/spec/Channel_Type_Call.xml @@ -513,6 +513,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. call. </tp:docstring> </arg> + <arg direction="in" name="InitialDirection" type="u" + tp:type="Media_Stream_Direction"> + <tp:docstring> + The requested initial direction of the new content. + </tp:docstring> + </arg> <arg direction="out" name="Content" type="o"> <tp:docstring> Path to the newly-created <tp:dbus-ref diff --git a/telepathy-glib/base-call-channel.c b/telepathy-glib/base-call-channel.c index b66bd500c..41e691eff 100644 --- a/telepathy-glib/base-call-channel.c +++ b/telepathy-glib/base-call-channel.c @@ -1433,6 +1433,7 @@ static void tp_base_call_channel_add_content_dbus (TpSvcChannelTypeCall *iface, const gchar *name, TpMediaStreamType mtype, + TpMediaStreamDirection initial_direction, DBusGMethodInvocation *context) { TpBaseCallChannel *self = TP_BASE_CALL_CHANNEL (iface); @@ -1454,6 +1455,13 @@ tp_base_call_channel_add_content_dbus (TpSvcChannelTypeCall *iface, goto error; } + if (initial_direction >= NUM_TP_MEDIA_STREAM_DIRECTIONS) + { + g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + "Invalid initial direction"); + goto error; + } + if (!self->priv->mutable_contents || klass->add_content == NULL) { g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_CAPABLE, @@ -1461,7 +1469,7 @@ tp_base_call_channel_add_content_dbus (TpSvcChannelTypeCall *iface, goto error; } - content = klass->add_content (self, name, mtype, &error); + content = klass->add_content (self, name, mtype, initial_direction, &error); if (content == NULL) goto error; diff --git a/telepathy-glib/base-call-channel.h b/telepathy-glib/base-call-channel.h index 8f682851c..7f054c223 100644 --- a/telepathy-glib/base-call-channel.h +++ b/telepathy-glib/base-call-channel.h @@ -36,6 +36,7 @@ typedef TpBaseCallContent * (*TpBaseCallChannelAddContentFunc) ( TpBaseCallChannel *self, const gchar *name, TpMediaStreamType media, + TpMediaStreamDirection initial_direction, GError **error); typedef void (*TpBaseCallChannelHangupFunc) (TpBaseCallChannel *self, TpCallStateChangeReason reason, diff --git a/telepathy-glib/call-channel.c b/telepathy-glib/call-channel.c index 46153c5a2..4c59edd77 100644 --- a/telepathy-glib/call-channel.c +++ b/telepathy-glib/call-channel.c @@ -1465,6 +1465,7 @@ add_content_cb (TpChannel *channel, * @name: the suggested name of the content to add * @type: the media stream type of the content to be added to the call, from * #TpMediaStreamType + * @initial_direction: The initial direction of the content * @callback: a callback to call when the operation finishes * @user_data: data to pass to @callback * @@ -1478,6 +1479,7 @@ void tp_call_channel_add_content_async (TpCallChannel *self, gchar *name, TpMediaStreamType type, + TpMediaStreamDirection initial_direction, GAsyncReadyCallback callback, gpointer user_data) { @@ -1489,7 +1491,7 @@ tp_call_channel_add_content_async (TpCallChannel *self, user_data, tp_call_channel_add_content_async); tp_cli_channel_type_call_call_add_content (TP_CHANNEL (self), -1, - name, type, + name, type, initial_direction, add_content_cb, result, g_object_unref, G_OBJECT (self)); } diff --git a/telepathy-glib/call-channel.h b/telepathy-glib/call-channel.h index a48da5152..6193f4749 100644 --- a/telepathy-glib/call-channel.h +++ b/telepathy-glib/call-channel.h @@ -122,6 +122,7 @@ gboolean tp_call_channel_hangup_finish (TpCallChannel *self, void tp_call_channel_add_content_async (TpCallChannel *self, gchar *name, TpMediaStreamType type, + TpMediaStreamDirection initial_direction, GAsyncReadyCallback callback, gpointer user_data); TpCallContent *tp_call_channel_add_content_finish (TpCallChannel *self, diff --git a/tests/dbus/call-channel.c b/tests/dbus/call-channel.c index 024eefd3e..90b77bc53 100644 --- a/tests/dbus/call-channel.c +++ b/tests/dbus/call-channel.c @@ -632,16 +632,28 @@ test_basics (Test *test, /* AddContent with bad content-type must fail */ tp_call_channel_add_content_async (test->call_chan, - "", 31337, add_content_cb, test); + "", 31337, TP_MEDIA_STREAM_DIRECTION_BIDIRECTIONAL, + add_content_cb, test); g_main_loop_run (test->mainloop); g_assert (test->error != NULL); g_assert (test->added_content == NULL); g_clear_error (&test->error); - /* AddContent again, to add a video stream */ + /* AddContent with bad initial-direction must fail */ tp_call_channel_add_content_async (test->call_chan, - "", TP_MEDIA_STREAM_TYPE_VIDEO, add_content_cb, test); + "", TP_MEDIA_STREAM_TYPE_AUDIO, 31337, + add_content_cb, test); + g_main_loop_run (test->mainloop); + g_assert (test->error != NULL); + g_assert (test->added_content == NULL); + g_clear_error (&test->error); + + /* AddContent again, to add a video stream */ + + tp_call_channel_add_content_async (test->call_chan, + "", TP_MEDIA_STREAM_TYPE_VIDEO, TP_MEDIA_STREAM_DIRECTION_BIDIRECTIONAL, + add_content_cb, test); g_main_loop_run (test->mainloop); g_assert_no_error (test->error); |