Mercurial > pidgin
diff libpurple/media/backend-fs2.c @ 29187:f351e87b7af0
Add codecs_ready to the media backend interface.
author | maiku@pidgin.im |
---|---|
date | Tue, 27 Oct 2009 19:06:29 +0000 |
parents | f65689100cfe |
children | 209fa20fc39f |
line wrap: on
line diff
--- a/libpurple/media/backend-fs2.c Tue Oct 27 18:42:01 2009 +0000 +++ b/libpurple/media/backend-fs2.c Tue Oct 27 19:06:29 2009 +0000 @@ -70,6 +70,8 @@ PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, GList *remote_candidates); +static gboolean purple_media_backend_fs2_codecs_ready(PurpleMediaBackend *self, + const gchar *sess_id); static GList *purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self, const gchar *sess_id); static GList *purple_media_backend_fs2_get_local_candidates( @@ -366,6 +368,7 @@ iface->add_stream = purple_media_backend_fs2_add_stream; iface->add_remote_candidates = purple_media_backend_fs2_add_remote_candidates; + iface->codecs_ready = purple_media_backend_fs2_codecs_ready; iface->get_codecs = purple_media_backend_fs2_get_codecs; iface->get_local_candidates = purple_media_backend_fs2_get_local_candidates; @@ -1500,6 +1503,53 @@ } } +static gboolean +purple_media_backend_fs2_codecs_ready(PurpleMediaBackend *self, + const gchar *sess_id) +{ + PurpleMediaBackendFs2Private *priv; + gboolean ret; + + g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE); + + priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self); + + if (sess_id != NULL) { + PurpleMediaBackendFs2Session *session = _get_session( + PURPLE_MEDIA_BACKEND_FS2(self), sess_id); + + if (session == NULL) + return FALSE; + + if (session->type & (PURPLE_MEDIA_SEND_AUDIO | + PURPLE_MEDIA_SEND_VIDEO)) + g_object_get(session->session, + "codecs-ready", &ret, NULL); + else + ret = TRUE; + } else { + GList *values = g_hash_table_get_values(priv->sessions); + + for (; values; values = g_list_delete_link(values, values)) { + PurpleMediaBackendFs2Session *session = values->data; + if (session->type & (PURPLE_MEDIA_SEND_AUDIO | + PURPLE_MEDIA_SEND_VIDEO)) + g_object_get(session->session, + "codecs-ready", &ret, NULL); + else + ret = TRUE; + + if (ret == FALSE) + break; + } + + if (values != NULL) + g_list_free(values); + } + + return ret; +} + static GList * purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self, const gchar *sess_id)