diff options
author | Michael Ruprecht <maiku@pidgin.im> | 2009-10-27 19:06:29 +0000 |
---|---|---|
committer | Michael Ruprecht <maiku@pidgin.im> | 2009-10-27 19:06:29 +0000 |
commit | 87c844f54b9954b25b682c027781e9957943f644 (patch) | |
tree | bd55966618a78777579325f6d52cf298fd706712 /libpurple/media | |
parent | fb30a1d30d7e86d263765063d42d00ae7a912036 (diff) | |
download | pidgin-87c844f54b9954b25b682c027781e9957943f644.tar.gz |
Add codecs_ready to the media backend interface.
Diffstat (limited to 'libpurple/media')
-rw-r--r-- | libpurple/media/backend-fs2.c | 50 | ||||
-rw-r--r-- | libpurple/media/backend-iface.c | 8 | ||||
-rw-r--r-- | libpurple/media/backend-iface.h | 4 | ||||
-rw-r--r-- | libpurple/media/media.c | 34 |
4 files changed, 64 insertions, 32 deletions
diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c index 739d7074d7..b92a1ca5c3 100644 --- a/libpurple/media/backend-fs2.c +++ b/libpurple/media/backend-fs2.c @@ -70,6 +70,8 @@ static void purple_media_backend_fs2_add_remote_candidates( 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 @@ purple_media_backend_iface_init(PurpleMediaBackendIface *iface) 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 @@ purple_media_backend_fs2_add_remote_candidates(PurpleMediaBackend *self, } } +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) diff --git a/libpurple/media/backend-iface.c b/libpurple/media/backend-iface.c index f364198298..9c06934ab7 100644 --- a/libpurple/media/backend-iface.c +++ b/libpurple/media/backend-iface.c @@ -146,6 +146,14 @@ purple_media_backend_add_remote_candidates(PurpleMediaBackend *self, sess_id, participant, remote_candidates); } +gboolean +purple_media_backend_codecs_ready(PurpleMediaBackend *self, + const gchar *sess_id) +{ + g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE); + return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->codecs_ready(self, + sess_id); +} GList * purple_media_backend_get_codecs(PurpleMediaBackend *self, diff --git a/libpurple/media/backend-iface.h b/libpurple/media/backend-iface.h index a6e5f99123..e0251b5200 100644 --- a/libpurple/media/backend-iface.h +++ b/libpurple/media/backend-iface.h @@ -54,6 +54,8 @@ struct _PurpleMediaBackendIface void (*add_remote_candidates) (PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, GList *remote_candidates); + gboolean (*codecs_ready) (PurpleMediaBackend *self, + const gchar *sess_id); GList *(*get_codecs) (PurpleMediaBackend *self, const gchar *sess_id); GList *(*get_local_candidates) (PurpleMediaBackend *self, @@ -75,6 +77,8 @@ gboolean purple_media_backend_add_stream(PurpleMediaBackend *self, void purple_media_backend_add_remote_candidates(PurpleMediaBackend *self, const gchar *sess_id, const gchar *participant, GList *remote_candidates); +gboolean purple_media_backend_codecs_ready(PurpleMediaBackend *self, + const gchar *sess_id); GList *purple_media_backend_get_codecs(PurpleMediaBackend *self, const gchar *sess_id); GList *purple_media_backend_get_local_candidates(PurpleMediaBackend *self, diff --git a/libpurple/media/media.c b/libpurple/media/media.c index 56d20e5078..aa5b853335 100644 --- a/libpurple/media/media.c +++ b/libpurple/media/media.c @@ -1425,40 +1425,10 @@ gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id) { #ifdef USE_VV - gboolean ret; - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - if (sess_id != NULL) { - PurpleMediaSession *session; - session = purple_media_get_session(media, 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(media->priv->sessions); - for (; values; values = g_list_delete_link(values, values)) { - PurpleMediaSession *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; + return purple_media_backend_codecs_ready( + media->priv->backend, sess_id); #else return FALSE; #endif |