pidgin.vv: 3589b814: Make voice calls in Finch work again.

maiku at soc.pidgin.im maiku at soc.pidgin.im
Sat Mar 21 05:15:40 EDT 2009


-----------------------------------------------------------------
Revision: 3589b814fb4baa52ae7be71e2ed48eaea592820d
Ancestor: e8eb025c98fcbebbe47363c29426e81abbf78130
Author: maiku at soc.pidgin.im
Date: 2009-03-21T06:10:28
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/3589b814fb4baa52ae7be71e2ed48eaea592820d

Modified files:
        finch/gntmedia.c

ChangeLog: 

Make voice calls in Finch work again.

-------------- next part --------------
============================================================
--- finch/gntmedia.c	e6b136fcfa4ddb1bf03f700481fc0e3366ef3d3c
+++ finch/gntmedia.c	80c8d8c2b8f6bab59e322ef4b1fbcda5887e7618
@@ -159,25 +159,9 @@ static void
 }
 
 static void
-finch_media_ready_cb(PurpleMedia *media, FinchMedia *gntmedia)
-{
-	GstElement *sendbin, *sendlevel;
-
-	GList *sessions = purple_media_get_session_names(media);
-
-	purple_media_audio_init_src(&sendbin, &sendlevel);
-
-	for (; sessions; sessions = sessions->next) {
-		purple_media_set_src(media, sessions->data, sendbin);
-	}
-	g_list_free(sessions);
-}
-
-static void
 finch_media_accept_cb(PurpleMedia *media, FinchMedia *gntmedia)
 {
 	GntWidget *parent;
-	GstElement *sendbin = NULL;
 
 	finch_media_emit_message(gntmedia, _("Call in progress."));
 
@@ -200,9 +184,6 @@ finch_media_accept_cb(PurpleMedia *media
 		parent = parent->parent;
 	gnt_box_readjust(GNT_BOX(parent));
 	gnt_widget_draw(parent);
-
-	purple_media_get_elements(media, &sendbin, NULL, NULL, NULL);
-	gst_element_set_state(GST_ELEMENT(sendbin), GST_STATE_PLAYING);
 }
 
 static void
@@ -244,9 +225,6 @@ finch_media_state_changed_cb(PurpleMedia
 			 */
 			g_object_unref(gntmedia);
 		}
-	} else if (state == PURPLE_MEDIA_STATE_NEW
-			&& sid != NULL && name != NULL) {
-		finch_media_ready_cb(media, gntmedia);
 	} else if (state == PURPLE_MEDIA_STATE_CONNECTED) {
 		finch_media_accept_cb(media, gntmedia);
 	}
@@ -370,6 +348,41 @@ call_cmd_cb(PurpleConversation *conv, co
 	return PURPLE_CMD_STATUS_OK;
 }
 
+static GstElement *
+create_default_audio_src(void)
+{
+	GstElement *ret = NULL, *level = NULL;
+	purple_media_audio_init_src(&ret, &level);
+	return ret;
+}
+
+static GstElement *
+create_default_audio_sink(void)
+{
+	GstElement *ret = NULL, *level = NULL;
+	purple_media_audio_init_recv(&ret, &level);
+	return ret;
+}
+
+static PurpleMediaElementInfo default_audio_src =
+{
+	"finchdefaultaudiosrc",		/* id */
+	PURPLE_MEDIA_ELEMENT_AUDIO	/* type */
+			| PURPLE_MEDIA_ELEMENT_SRC
+			| PURPLE_MEDIA_ELEMENT_ONE_SRC
+			| PURPLE_MEDIA_ELEMENT_UNIQUE,
+	create_default_audio_src,	/* create */
+};
+
+static PurpleMediaElementInfo default_audio_sink =
+{
+	"finchdefaultaudiosink",	/* id */
+	PURPLE_MEDIA_ELEMENT_AUDIO	/* type */
+			| PURPLE_MEDIA_ELEMENT_SINK
+			| PURPLE_MEDIA_ELEMENT_ONE_SINK,
+	create_default_audio_sink,	/* create */
+};
+
 void finch_media_manager_init(void)
 {
 	PurpleMediaManager *manager = purple_media_manager_get();
@@ -377,6 +390,10 @@ void finch_media_manager_init(void)
 	purple_cmd_register("call", "", PURPLE_CMD_P_DEFAULT,
 			PURPLE_CMD_FLAG_IM, NULL,
 			call_cmd_cb, _("call: Make an audio call."), NULL);
+
+	purple_debug_info("gntmedia", "Registering media element types\n");
+	purple_media_manager_set_active_element(manager, &default_audio_src);
+	purple_media_manager_set_active_element(manager, &default_audio_sink);
 }
 
 void finch_media_manager_uninit(void)


More information about the Commits mailing list