changeset 26392:9c671fc1b351

Give more information to element creation functions. This should allow for Picture in Picture support.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Tue, 31 Mar 2009 23:53:03 +0000
parents 24feaf9cfbf1
children 462e5c27dbd7
files finch/gntmedia.c libpurple/media-gst.h libpurple/media.c libpurple/mediamanager.c pidgin/gtkmedia.c
diffstat 5 files changed, 29 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntmedia.c	Tue Mar 31 06:49:19 2009 +0000
+++ b/finch/gntmedia.c	Tue Mar 31 23:53:03 2009 +0000
@@ -390,7 +390,8 @@
 }
 
 static GstElement *
-create_default_audio_src(void)
+create_default_audio_src(PurpleMedia *media,
+		const gchar *session_id, const gchar *participant)
 {
 	GstElement *bin, *src, *volume;
 	GstPad *pad, *ghost;
@@ -416,7 +417,8 @@
 }
 
 static GstElement *
-create_default_audio_sink(void)
+create_default_audio_sink(PurpleMedia *media,
+		const gchar *session_id, const gchar *participant)
 {
 	GstElement *bin, *sink, *volume, *queue;
 	GstPad *pad, *ghost;
--- a/libpurple/media-gst.h	Tue Mar 31 06:49:19 2009 +0000
+++ b/libpurple/media-gst.h	Tue Mar 31 23:53:03 2009 +0000
@@ -65,7 +65,8 @@
 {
 	const gchar *id;
 	PurpleMediaElementType type;
-	GstElement *(*create)(void);
+	GstElement *(*create)(PurpleMedia *media,
+			const gchar *session_id, const gchar *participant);
 };
 
 #ifdef __cplusplus
@@ -120,7 +121,8 @@
  * @param type The type of source/sink to get.
  */
 GstElement *purple_media_manager_get_element(PurpleMediaManager *manager,
-		PurpleMediaSessionType type);
+		PurpleMediaSessionType type, PurpleMedia *media,
+		const gchar *session_id, const gchar *participant);
 
 PurpleMediaElementInfo *purple_media_manager_get_element_info(
 		PurpleMediaManager *manager, const gchar *name);
--- a/libpurple/media.c	Tue Mar 31 06:49:19 2009 +0000
+++ b/libpurple/media.c	Tue Mar 31 23:53:03 2009 +0000
@@ -1630,7 +1630,10 @@
 			stream->src = gst_element_factory_make(
 					"liveadder", NULL);
 			sink = purple_media_manager_get_element(priv->manager,
-					PURPLE_MEDIA_RECV_AUDIO);
+					PURPLE_MEDIA_RECV_AUDIO,
+					stream->session->media,
+					stream->session->id,
+					stream->participant);
 		} else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) {
 			stream->src = gst_element_factory_make(
 					"fsfunnel", NULL);
@@ -1745,7 +1748,8 @@
 		session_type = purple_media_from_fs(media_type,
 				FS_DIRECTION_SEND);
 		src = purple_media_manager_get_element(
-				media->priv->manager, session_type);
+				media->priv->manager, session_type,
+				media, session->id, who);
 		if (!GST_IS_ELEMENT(src)) {
 			purple_debug_error("media",
 					"Error creating src for session %s\n",
--- a/libpurple/mediamanager.c	Tue Mar 31 06:49:19 2009 +0000
+++ b/libpurple/mediamanager.c	Tue Mar 31 23:53:03 2009 +0000
@@ -353,7 +353,8 @@
 
 GstElement *
 purple_media_manager_get_element(PurpleMediaManager *manager,
-		PurpleMediaSessionType type)
+		PurpleMediaSessionType type, PurpleMedia *media,
+		const gchar *session_id, const gchar *participant)
 {
 #ifdef USE_VV
 	GstElement *ret = NULL;
@@ -383,7 +384,7 @@
 
 		if (ret == NULL) {
 			GstElement *bin, *fakesink;
-			ret = info->create();
+			ret = info->create(media, session_id, participant);
 			bin = gst_bin_new(info->id);
 			tee = gst_element_factory_make("tee", "tee");
 			gst_bin_add_many(GST_BIN(bin), ret, tee, NULL);
@@ -415,7 +416,7 @@
 		gst_pad_set_active(ghost, TRUE);
 		gst_element_add_pad(ret, ghost);
 	} else {
-		ret = info->create();
+		ret = info->create(media, session_id, participant);
 	}
 
 	if (ret == NULL)
@@ -612,7 +613,9 @@
 			queue = gst_element_factory_make(
 					"queue", NULL);
 			ow->sink = purple_media_manager_get_element(
-					manager, PURPLE_MEDIA_RECV_VIDEO);
+					manager, PURPLE_MEDIA_RECV_VIDEO,
+					ow->media, ow->session_id,
+					ow->participant);
 
 			if (participant == NULL) {
 				/* aka this is a preview sink */
--- a/pidgin/gtkmedia.c	Tue Mar 31 06:49:19 2009 +0000
+++ b/pidgin/gtkmedia.c	Tue Mar 31 23:53:03 2009 +0000
@@ -902,7 +902,8 @@
 }
 
 static GstElement *
-create_default_video_src(void)
+create_default_video_src(PurpleMedia *media,
+		const gchar *session_id, const gchar *participant)
 {
 	GstElement *sendbin, *src, *videoscale, *capsfilter;
 	GstPad *pad;
@@ -944,13 +945,15 @@
 }
 
 static GstElement *
-create_default_video_sink(void)
+create_default_video_sink(PurpleMedia *media,
+		const gchar *session_id, const gchar *participant)
 {
 	return gst_element_factory_make("autovideosink", NULL);
 }
 
 static GstElement *
-create_default_audio_src(void)
+create_default_audio_src(PurpleMedia *media,
+		const gchar *session_id, const gchar *participant)
 {
 	GstElement *bin, *src, *volume, *level;
 	GstPad *pad, *ghost;
@@ -979,7 +982,8 @@
 }
 
 static GstElement *
-create_default_audio_sink(void)
+create_default_audio_sink(PurpleMedia *media,
+		const gchar *session_id, const gchar *participant)
 {
 	GstElement *bin, *sink, *volume, *level, *queue;
 	GstPad *pad, *ghost;