changeset 26059:1ff5304f6e9d

Added codecs-changed signal.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Tue, 27 Jan 2009 08:46:53 +0000
parents ac56e5707a72
children 5b64b7d8da39
files libpurple/media.c libpurple/protocols/jabber/jingle/rtp.c
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Tue Jan 27 07:48:03 2009 +0000
+++ b/libpurple/media.c	Tue Jan 27 08:46:53 2009 +0000
@@ -118,6 +118,7 @@
 
 enum {
 	ERROR,
+	CODECS_CHANGED,
 	NEW_CANDIDATE,
 	READY_NEW,
 	STATE_CHANGED,
@@ -199,6 +200,10 @@
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
 					 g_cclosure_marshal_VOID__STRING,
 					 G_TYPE_NONE, 1, G_TYPE_STRING);
+	purple_media_signals[CODECS_CHANGED] = g_signal_new("codecs-changed", G_TYPE_FROM_CLASS(klass),
+					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+					 g_cclosure_marshal_VOID__STRING,
+					 G_TYPE_NONE, 1, G_TYPE_STRING);
 	purple_media_signals[NEW_CANDIDATE] = g_signal_new("new-candidate", G_TYPE_FROM_CLASS(klass),
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
 					 purple_smarshal_VOID__POINTER_POINTER_OBJECT,
@@ -1151,12 +1156,17 @@
 					PurpleMediaSession *session = sessions->data;
 					if (session->session == fssession) {
 						gboolean ready;
+						gchar *session_id;
+
 						g_object_get(session->session, "codecs-ready", &ready, NULL);
 						if (session->codecs_ready == FALSE && ready == TRUE) {
 							session->codecs_ready = ready;
 							purple_media_emit_ready(media, session, NULL);
 						}
 
+						session_id = g_strdup(session->id);
+						g_signal_emit(media, purple_media_signals[CODECS_CHANGED], 0, session_id);
+						g_free(session_id);
 						g_list_free(sessions);
 						break;
 					}
--- a/libpurple/protocols/jabber/jingle/rtp.c	Tue Jan 27 07:48:03 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Tue Jan 27 08:46:53 2009 +0000
@@ -271,6 +271,14 @@
 }
 
 static void
+jingle_rtp_codecs_changed_cb(PurpleMedia *media, gchar *sid,
+		JingleSession *session)
+{
+	purple_debug_info("jingle-rtp", "jingle_rtp_codecs_changed_cb: "
+			"session_id: %s jingle_session: %p\n", sid, session);
+}
+
+static void
 jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, PurpleMediaCandidate *candidate, JingleSession *session)
 {
 	purple_debug_info("jingle-rtp", "jingle_rtp_new_candidate_cb\n");
@@ -359,6 +367,8 @@
 	g_hash_table_insert(js->medias, sid, media);
 
 	/* connect callbacks */
+	g_signal_connect(G_OBJECT(media), "codecs-changed",
+				 G_CALLBACK(jingle_rtp_codecs_changed_cb), session);
 	g_signal_connect(G_OBJECT(media), "new-candidate",
 				 G_CALLBACK(jingle_rtp_new_candidate_cb), session);
 	g_signal_connect(G_OBJECT(media), "ready-new",