pidgin: 6a776851: Actually emit the PURPLE_MEDIA_INFO_{,UN...

maiku at pidgin.im maiku at pidgin.im
Mon Oct 19 18:12:05 EDT 2009


-----------------------------------------------------------------
Revision: 6a7768514466292d4922a09b4250b2df00c22e97
Ancestor: 443b035077bf07becfe1eb388373ddbd8629c524
Author: maiku at pidgin.im
Date: 2009-10-19T22:03:19
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6a7768514466292d4922a09b4250b2df00c22e97

Modified files:
        libpurple/media.c

ChangeLog: 

Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.

-------------- next part --------------
============================================================
--- libpurple/media.c	3f892d13451b570971aea92dbc6035e86e4a9a68
+++ libpurple/media.c	3bdd23bf80c6d8ab374dc4b34f70283a49dd479e
@@ -103,6 +103,8 @@ struct _PurpleMediaStream
 	gboolean initiator;
 	gboolean accepted;
 	gboolean candidates_prepared;
+	gboolean held;
+	gboolean paused;
 
 	GList *active_local_candidates;
 	GList *active_remote_candidates;
@@ -2330,11 +2332,46 @@ purple_media_stream_info(PurpleMedia *me
 		for (; streams; streams = g_list_delete_link(streams, streams)) {
 			PurpleMediaStream *stream = streams->data;
 			if (stream->session->type & PURPLE_MEDIA_SEND_VIDEO) {
+				stream->paused = active;
+
+				if (!stream->held)
+					g_object_set(stream->stream, "direction",
+							purple_media_to_fs_stream_direction(
+							stream->session->type & ((active) ?
+							~PURPLE_MEDIA_SEND_VIDEO :
+							PURPLE_MEDIA_VIDEO)), NULL);
+			}
+		}
+	} else if (local == TRUE && (type == PURPLE_MEDIA_INFO_HOLD ||
+			type == PURPLE_MEDIA_INFO_UNHOLD)) {
+		GList *streams;
+		gboolean active = (type == PURPLE_MEDIA_INFO_HOLD);
+
+		g_return_if_fail(PURPLE_IS_MEDIA(media));
+
+		streams = purple_media_get_streams(media,
+				session_id, participant);
+		for (; streams; streams = g_list_delete_link(streams, streams)) {
+			PurpleMediaStream *stream = streams->data;
+			stream->held = active;
+			if (stream->session->type & PURPLE_MEDIA_VIDEO) {
+				FsStreamDirection direction;
+
+				direction = ((active) ?
+						~PURPLE_MEDIA_VIDEO :
+						PURPLE_MEDIA_VIDEO);
+				if (!active && stream->paused)
+					direction &= ~PURPLE_MEDIA_SEND_VIDEO;
+
 				g_object_set(stream->stream, "direction",
 						purple_media_to_fs_stream_direction(
+						stream->session->type & direction), NULL);
+			} else if (stream->session->type & PURPLE_MEDIA_AUDIO) {
+				g_object_set(stream->stream, "direction",
+						purple_media_to_fs_stream_direction(
 						stream->session->type & ((active) ?
-						~PURPLE_MEDIA_SEND_VIDEO :
-						PURPLE_MEDIA_VIDEO)), NULL);
+						~PURPLE_MEDIA_AUDIO :
+						PURPLE_MEDIA_AUDIO)), NULL);
 			}
 		}
 	}


More information about the Commits mailing list