soc.2008.vv: bd12501d: Wait to set up the voice and video GUI u...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Jun 27 17:45:59 EDT 2008


-----------------------------------------------------------------
Revision: bd12501d3f5ff702be04d6aef2cc8e6fd255a8b2
Ancestor: 6edefad3be68b0ae1104b6235376600c14c9c605
Author: maiku at soc.pidgin.im
Date: 2008-06-27T18:44:49
Branch: im.pidgin.soc.2008.vv
URL: http://d.pidgin.im/viewmtn/revision/info/bd12501d3f5ff702be04d6aef2cc8e6fd255a8b2

Modified files:
        libpurple/media.c pidgin/gtkmedia.c

ChangeLog: 

Wait to set up the voice and video GUI until the responder has accepted the session.

-------------- next part --------------
============================================================
--- libpurple/media.c	d79242e7085b7fe194aab3f23d0a3b2516d9d5bf
+++ libpurple/media.c	c2440167ccce5225d0d2f782b77b334cce0a5f8e
@@ -436,15 +436,22 @@ purple_media_get_elements(PurpleMedia *m
 purple_media_get_elements(PurpleMedia *media, GstElement **audio_src, GstElement **audio_sink,
                                                   GstElement **video_src, GstElement **video_sink)
 {
-	 if (audio_src) 
-		g_object_get(G_OBJECT(media), "audio-src", *audio_src, NULL);
-	 if (audio_sink) 
-		g_object_get(G_OBJECT(media), "audio-sink", *audio_sink, NULL);
-	 if (video_src) 
-		g_object_get(G_OBJECT(media), "video-src", *video_src, NULL);
-	 if (video_sink) 
-		g_object_get(G_OBJECT(media), "video-sink", *video_sink, NULL);
+	GList *values = g_hash_table_get_values(media->priv->sessions);
 
+	for (; values; values = values->next) {
+		PurpleMediaSession *session = (PurpleMediaSession*)values->data;
+
+		if (session->type & PURPLE_MEDIA_SEND_AUDIO && audio_src)
+			*audio_src = session->src;
+		if (session->type & PURPLE_MEDIA_RECV_AUDIO && audio_sink)
+			*audio_sink = session->sink;
+		if (session->type & PURPLE_MEDIA_SEND_VIDEO && video_src)
+			*video_src = session->src;
+		if (session->type & PURPLE_MEDIA_RECV_VIDEO && video_sink)
+			*video_sink = session->sink;
+	}
+
+	g_list_free(values);
 }
 
 void 
============================================================
--- pidgin/gtkmedia.c	203bf7ac97ff890596f39a9b566e45b859caf97c
+++ pidgin/gtkmedia.c	53efcfcaee2c2adc8605c23481f7cbe3bb17297f
@@ -289,7 +289,6 @@ pidgin_media_ready_cb(PurpleMedia *media
 pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia)
 {
 	GstElement *element = purple_media_get_pipeline(media);
-	GtkWidget *send_widget = NULL, *recv_widget = NULL;
 
 	GstElement *audiosendbin = NULL, *audiosendlevel = NULL;
 	GstElement *audiorecvbin = NULL, *audiorecvlevel = NULL;
@@ -324,6 +323,39 @@ pidgin_media_ready_cb(PurpleMedia *media
 				       NULL);
 	}
 
+	bus = gst_pipeline_get_bus(GST_PIPELINE(element));
+	gst_bus_add_signal_watch(GST_BUS(bus));
+	g_signal_connect(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))),
+			 "message", G_CALLBACK(level_message_cb), gtkmedia);
+	if (videorecvbin || videosendbin)
+		gst_bus_set_sync_handler(bus, (GstBusSyncHandler)create_window, gtkmedia);
+	gst_object_unref(bus);
+}
+
+static void
+pidgin_media_wait_cb(PurpleMedia *media, PidginMedia *gtkmedia)
+{
+	pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_WAITING);
+}
+
+/* maybe we should have different callbacks for when we received the accept
+    and we accepted ourselves */
+static void
+pidgin_media_accept_cb(PurpleMedia *media, PidginMedia *gtkmedia)
+{
+	GtkWidget *send_widget = NULL, *recv_widget = NULL;
+
+	GstElement *audiosendbin = NULL;
+	GstElement *audiorecvbin = NULL;
+	GstElement *videosendbin = NULL;
+	GstElement *videorecvbin = NULL;
+
+	pidgin_media_emit_message(gtkmedia, _("Call in progress."));
+	pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
+
+	purple_media_get_elements(media, &audiosendbin, &audiorecvbin,
+				  &videosendbin, &videorecvbin);
+
 	recv_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
 	send_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
 
@@ -385,32 +417,9 @@ pidgin_media_ready_cb(PurpleMedia *media
 		gtk_widget_show(gtkmedia->priv->send_progress);
 		gtk_widget_show(gtkmedia->priv->recv_progress);
 	}
-
-	bus = gst_pipeline_get_bus(GST_PIPELINE(element));
-	gst_bus_add_signal_watch(GST_BUS(bus));
-	g_signal_connect(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))),
-			 "message", G_CALLBACK(level_message_cb), gtkmedia);
-	if (videorecvbin || videosendbin)
-		gst_bus_set_sync_handler(bus, (GstBusSyncHandler)create_window, gtkmedia);
-	gst_object_unref(bus);
 }
 
 static void
-pidgin_media_wait_cb(PurpleMedia *media, PidginMedia *gtkmedia)
-{
-	pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_WAITING);
-}
-
-/* maybe we should have different callbacks for when we received the accept
-    and we accepted ourselves */
-static void
-pidgin_media_accept_cb(PurpleMedia *media, PidginMedia *gtkmedia)
-{
-	pidgin_media_emit_message(gtkmedia, _("Call in progress."));
-	pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
-}
-
-static void
 pidgin_media_hangup_cb(PurpleMedia *media, PidginMedia *gtkmedia)
 {
 	pidgin_media_emit_message(gtkmedia, _("You have ended the call."));


More information about the Commits mailing list