cpw.maiku.media_refactor: 53856214: Add codecs_ready to the media backend in...

maiku at pidgin.im maiku at pidgin.im
Tue Oct 27 20:27:45 EDT 2009


-----------------------------------------------------------------
Revision: 538562140ea9117b4215eeae1caf203b467c7b86
Ancestor: 7d0d6870bab97255083c659a52423232152298c3
Author: maiku at pidgin.im
Date: 2009-10-27T19:06:29
Branch: im.pidgin.cpw.maiku.media_refactor
URL: http://d.pidgin.im/viewmtn/revision/info/538562140ea9117b4215eeae1caf203b467c7b86

Modified files:
        libpurple/media/backend-fs2.c
        libpurple/media/backend-iface.c
        libpurple/media/backend-iface.h libpurple/media/media.c

ChangeLog: 

Add codecs_ready to the media backend interface.

-------------- next part --------------
============================================================
--- libpurple/media/backend-fs2.c	7c9a8736070842b5d1e1b70c6dc559a5146190ff
+++ libpurple/media/backend-fs2.c	a38256bd4d56e91e286029e8069554d50cc19ec5
@@ -70,6 +70,8 @@ static void purple_media_backend_fs2_add
 		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(PurpleMe
 	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_cand
 	}
 }
 
+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)
============================================================
--- libpurple/media/backend-iface.c	66e765c4c6c382cd91e4aed531e1029f5be7646f
+++ libpurple/media/backend-iface.c	897573dc4fe4b9a2fcb5629f471c6723563ed128
@@ -146,6 +146,14 @@ purple_media_backend_add_remote_candidat
 			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,
============================================================
--- libpurple/media/backend-iface.h	63e8c35784d9b54cec87542787a6e9a78341a5cf
+++ libpurple/media/backend-iface.h	40282e5a3b058a1f73d3aefb228d9420d45516f4
@@ -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 @@ void purple_media_backend_add_remote_can
 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,
============================================================
--- libpurple/media/media.c	5dd0932df591eae15596f09dc327ca48627151ef
+++ libpurple/media/media.c	61c91af6e8b7e5f8e66fa44d969b017d3205764d
@@ -1425,40 +1425,10 @@ purple_media_codecs_ready(PurpleMedia *m
 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


More information about the Commits mailing list