changeset 29210:2b2b930281a0

Add a way to set and get which media backend type to use.
author maiku@pidgin.im
date Wed, 28 Oct 2009 20:06:21 +0000
parents d510b0324721
children 3afc25b5b8fc
files libpurple/media/media.c libpurple/mediamanager.c libpurple/mediamanager.h
diffstat 3 files changed, 53 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media/media.c	Wed Oct 28 19:01:33 2009 +0000
+++ b/libpurple/media/media.c	Wed Oct 28 20:06:21 2009 +0000
@@ -371,9 +371,9 @@
 		case PROP_CONFERENCE_TYPE:
 			media->priv->conference_type =
 					g_value_dup_string(value);
-			/* Will eventually get this type from the media manager */
 			media->priv->backend = g_object_new(
-					PURPLE_TYPE_MEDIA_BACKEND_FS2,
+					purple_media_manager_get_backend_type(
+					purple_media_manager_get()),
 					"conference-type",
 					media->priv->conference_type,
 					"media", media,
--- a/libpurple/mediamanager.c	Wed Oct 28 19:01:33 2009 +0000
+++ b/libpurple/mediamanager.c	Wed Oct 28 20:06:21 2009 +0000
@@ -37,6 +37,7 @@
 #endif
 
 #ifdef USE_VV
+#include <media/backend-fs2.h>
 
 #include <gst/farsight/fs-element-added-notifier.h>
 #include <gst/interfaces/xoverlay.h>
@@ -79,6 +80,7 @@
 	GList *elements;
 	GList *output_windows;
 	gulong next_output_window_id;
+	GType backend_type;
 
 	PurpleMediaElementInfo *video_src;
 	PurpleMediaElementInfo *video_sink;
@@ -166,6 +168,9 @@
 	media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media);
 	media->priv->medias = NULL;
 	media->priv->next_output_window_id = 1;
+#ifdef USE_VV
+	media->priv->backend_type = PURPLE_TYPE_MEDIA_BACKEND_FS2;
+#endif
 
 	purple_prefs_add_none("/purple/media");
 	purple_prefs_add_none("/purple/media/audio");
@@ -910,6 +915,30 @@
 #endif
 }
 
+void
+purple_media_manager_set_backend_type(PurpleMediaManager *manager,
+		GType backend_type)
+{
+#ifdef USE_VV
+	g_return_if_fail(PURPLE_IS_MEDIA_MANAGER(manager));
+
+	manager->priv->backend_type = backend_type;
+#endif
+}
+
+GType
+purple_media_manager_get_backend_type(PurpleMediaManager *manager)
+{	
+#ifdef USE_VV
+	g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager),
+			PURPLE_MEDIA_CAPS_NONE);
+
+	return manager->priv->backend_type;
+#else
+	return G_TYPE_NONE;
+#endif
+}
+
 #ifdef USE_GSTREAMER
 
 /*
--- a/libpurple/mediamanager.h	Wed Oct 28 19:01:33 2009 +0000
+++ b/libpurple/mediamanager.h	Wed Oct 28 20:06:21 2009 +0000
@@ -213,6 +213,28 @@
  */
 PurpleMediaCaps purple_media_manager_get_ui_caps(PurpleMediaManager *manager);
 
+/**
+ * Sets which media backend type media objects will use.
+ *
+ * @param manager The manager to set the caps on.
+ * @param backend_type The media backend type to use.
+ *
+ * @since 2.7.0
+ */
+void purple_media_manager_set_backend_type(PurpleMediaManager *manager,
+		GType backend_type);
+
+/**
+ * Gets which media backend type media objects will use.
+ *
+ * @param manager The manager to get the media backend type from.
+ *
+ * @return The type of media backend type media objects will use.
+ *
+ * @since 2.7.0
+ */
+GType purple_media_manager_get_backend_type(PurpleMediaManager *manager);
+
 /*}@*/
 
 #ifdef __cplusplus