changeset 24950:431c59a6959d

Add purple_media_manager_get_element.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Thu, 06 Nov 2008 01:32:58 +0000
parents 1a2d446cb8a0
children 94224a5563db
files libpurple/mediamanager.c libpurple/mediamanager.h
diffstat 2 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/mediamanager.c	Mon Nov 03 03:07:07 2008 +0000
+++ b/libpurple/mediamanager.c	Thu Nov 06 01:32:58 2008 +0000
@@ -199,4 +199,29 @@
 			g_list_delete_link(manager->priv->medias, list);
 }
 
+GstElement *
+purple_media_manager_get_element(PurpleMediaManager *manager,
+		PurpleMediaSessionType type)
+{
+	GstElement *ret = NULL;
+	GstElement *level = NULL;
+
+	/* TODO: If src, retrieve current src */
+	/* TODO: Send a signal here to allow for overriding the source/sink */
+
+	if (type & PURPLE_MEDIA_SEND_AUDIO)
+		purple_media_audio_init_src(&ret, &level);
+	else if (type & PURPLE_MEDIA_RECV_AUDIO)
+		purple_media_audio_init_recv(&ret, &level);
+	else if (type & PURPLE_MEDIA_SEND_VIDEO)
+		purple_media_video_init_src(&ret);
+	else if (type & PURPLE_MEDIA_RECV_VIDEO)
+		purple_media_video_init_recv(&ret);
+
+	if (ret == NULL)
+		purple_debug_error("media", "Error creating source or sink\n");
+
+	return ret;
+}
+
 #endif  /* USE_VV */
--- a/libpurple/mediamanager.h	Mon Nov 03 03:07:07 2008 +0000
+++ b/libpurple/mediamanager.h	Thu Nov 06 01:32:58 2008 +0000
@@ -123,6 +123,15 @@
 purple_media_manager_remove_media(PurpleMediaManager *manager,
 				  PurpleMedia *media);
 
+/**
+ * Returns a GStreamer source or sink for audio or video.
+ *
+ * @param manager The media manager to use to obtain the source/sink.
+ * @param type The type of source/sink to get.
+ */
+GstElement *purple_media_manager_get_element(PurpleMediaManager *manager,
+		PurpleMediaSessionType type);
+
 /*}@*/
 
 #ifdef __cplusplus