changeset 29587:bd6279df50de

Move mute functionality into the Fs2 media backend.
author maiku@pidgin.im
date Tue, 27 Oct 2009 21:32:11 +0000
parents 0761fc41bbe3
children c08c36bd009d
files libpurple/media/backend-fs2.c libpurple/media/media.c
diffstat 2 files changed, 30 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media/backend-fs2.c	Tue Oct 27 21:18:41 2009 +0000
+++ b/libpurple/media/backend-fs2.c	Tue Oct 27 21:32:11 2009 +0000
@@ -1121,6 +1121,36 @@
 					err->message);
 			g_error_free(err);
 		}
+	} else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE ||
+			type == PURPLE_MEDIA_INFO_UNMUTE)) {
+		PurpleMediaBackendFs2Private *priv =
+				PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
+		gboolean active = (type == PURPLE_MEDIA_INFO_MUTE);
+		GList *sessions;
+
+		if (sid == NULL)
+			sessions = g_hash_table_get_values(priv->sessions);
+		else
+			sessions = g_list_prepend(NULL,
+					_get_session(self, sid));
+
+		purple_debug_info("media", "Turning mute %s\n",
+				active ? "on" : "off");
+
+		for (; sessions; sessions = g_list_delete_link(
+				sessions, sessions)) {
+			PurpleMediaBackendFs2Session *session =
+					sessions->data;
+
+			if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
+				gchar *name = g_strdup_printf("volume_%s",
+						session->id);
+				GstElement *volume = gst_bin_get_by_name(
+						GST_BIN(priv->confbin), name);
+				g_free(name);
+				g_object_set(volume, "mute", active, NULL);
+			}
+		}
 	} else if (local == TRUE && (type == PURPLE_MEDIA_INFO_PAUSE ||
 			type == PURPLE_MEDIA_INFO_UNPAUSE)) {
 		gboolean active = (type == PURPLE_MEDIA_INFO_PAUSE);
--- a/libpurple/media/media.c	Tue Oct 27 21:18:41 2009 +0000
+++ b/libpurple/media/media.c	Tue Oct 27 21:32:11 2009 +0000
@@ -716,37 +716,6 @@
 
 			stream->accepted = TRUE;
 		}
-	} else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE ||
-			type == PURPLE_MEDIA_INFO_UNMUTE)) {
-		GList *sessions;
-		gboolean active = (type == PURPLE_MEDIA_INFO_MUTE);
-
-		g_return_if_fail(PURPLE_IS_MEDIA(media));
-
-		if (session_id == NULL)
-			sessions = g_hash_table_get_values(
-					media->priv->sessions);
-		else
-			sessions = g_list_prepend(NULL,
-					purple_media_get_session(
-					media, session_id));
-
-		purple_debug_info("media", "Turning mute %s\n",
-				active ? "on" : "off");
-
-		for (; sessions; sessions = g_list_delete_link(
-				sessions, sessions)) {
-			PurpleMediaSession *session = sessions->data;
-			if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
-				gchar *name = g_strdup_printf("volume_%s",
-						session->id);
-				GstElement *volume = gst_bin_get_by_name(
-						GST_BIN(session->media->
-						priv->confbin), name);
-				g_free(name);
-				g_object_set(volume, "mute", active, NULL);
-			}
-		}
 	}
 
 	g_signal_emit(media, purple_media_signals[STREAM_INFO],