pidgin.vv: 558eb2b7: Move purple_media_get_devices to gtkpref...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Sun Mar 22 23:01:12 EDT 2009


-----------------------------------------------------------------
Revision: 558eb2b776e57c69d0030818b2906d6f5798ace9
Ancestor: 6b1edb2d4894609880c33e4ba13feccc792f91b0
Author: maiku at soc.pidgin.im
Date: 2009-03-22T22:34:01
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/558eb2b776e57c69d0030818b2906d6f5798ace9

Modified files:
        libpurple/media.c libpurple/media.h pidgin/gtkprefs.c

ChangeLog: 

Move purple_media_get_devices to gtkprefs.c.

-------------- next part --------------
============================================================
--- libpurple/media.c	f9edeb564695b19827e22f0a3c1f87c5d324ef08
+++ libpurple/media.c	738b091574b0ba33c21eb1167a6f5056a625655e
@@ -38,7 +38,6 @@
 
 #ifdef USE_VV
 
-#include <gst/interfaces/propertyprobe.h>
 #include <gst/farsight/fs-conference-iface.h>
 
 /** @copydoc _PurpleMediaSession */
@@ -1400,77 +1399,6 @@ purple_media_end(PurpleMedia *media,
 	}
 }
 
-GList*
-purple_media_get_devices(const gchar *plugin)
-{
-	GObjectClass *klass;
-	GstPropertyProbe *probe;
-	const GParamSpec *pspec;
-	GstElement *element = gst_element_factory_make(plugin, NULL);
-	GstElementFactory *factory;
-	const gchar *longname = NULL;
-	GList *ret = NULL;
-
-	if (element == NULL)
-		return NULL;
-
-	factory = gst_element_get_factory(element);
-
-	longname = gst_element_factory_get_longname(factory);
-	klass = G_OBJECT_GET_CLASS(element);
-
-	if (!g_object_class_find_property (klass, "device") ||
-			!GST_IS_PROPERTY_PROBE (element) ||
-			!(probe = GST_PROPERTY_PROBE (element)) ||
-			!(pspec = gst_property_probe_get_property (probe, "device"))) {
-		purple_debug_info("media", "Found source '%s' (%s) - no device\n",
-				longname, GST_PLUGIN_FEATURE (factory)->name);
-	} else {
-		gint n;
-		gchar *name;
-		GValueArray *array;
-
-		purple_debug_info("media", "Found devices\n");
-
-		/* Set autoprobe[-fps] to FALSE to avoid delays when probing. */
-		if (g_object_class_find_property (klass, "autoprobe")) {
-			g_object_set (G_OBJECT (element), "autoprobe", FALSE, NULL);
-			if (g_object_class_find_property (klass, "autoprobe-fps")) {
-				g_object_set (G_OBJECT (element), "autoprobe-fps", FALSE, NULL);
-			}
-		}
-
-		array = gst_property_probe_probe_and_get_values (probe, pspec);
-		if (array != NULL) {
-			for (n = 0 ; n < array->n_values ; n++) {
-				GValue *device = g_value_array_get_nth (array, n);
-				
-				ret = g_list_append(ret, g_value_dup_string(device));
-
-				g_object_set(G_OBJECT(element), "device",
-						g_value_get_string(device), NULL);
-				g_object_get(G_OBJECT(element), "device-name", &name, NULL);
-				purple_debug_info("media", "Found source '%s' (%s) - device '%s' (%s)\n",
-						  longname, GST_PLUGIN_FEATURE (factory)->name,
-						  name, g_value_get_string(device));
-				g_free(name);
-			}
-			g_value_array_free(array);
-		}
-
-		/* Restore autoprobe[-fps] to TRUE. */
-		if (g_object_class_find_property (klass, "autoprobe")) {
-			g_object_set (G_OBJECT (element), "autoprobe", TRUE, NULL);
-			if (g_object_class_find_property (klass, "autoprobe-fps")) {
-				g_object_set (G_OBJECT (element), "autoprobe-fps", TRUE, NULL);
-			}
-		}
-	}
-
-	gst_object_unref(element);
-	return ret;
-}
-
 void
 purple_media_audio_init_src(GstElement **sendbin, GstElement **sendlevel)
 {
============================================================
--- libpurple/media.h	4758b15a4cc300dd4c1f355c3ee72771e15316fb
+++ libpurple/media.h	7baf8e7aa7f7a031684c64da0a8f99b0e8d4776f
@@ -427,15 +427,6 @@ void purple_media_end(PurpleMedia *media
 		const gchar *participant);
 
 /**
- * Enumerates a list of devices.
- *
- * @param plugin The name of the GStreamer plugin from which to enumerate devices.
- *
- * @return The list of enumerated devices.
- */
-GList *purple_media_get_devices(const gchar *plugin);
-
-/**
  * Creates a default audio source.
  *
  * @param sendbin Set to the newly created audio source.
============================================================
--- pidgin/gtkprefs.c	75964e0d2e04f610f228db15a321b7249e537838
+++ pidgin/gtkprefs.c	4382bd85a6597bff32c2adc9aefd88c89fc29501
@@ -57,6 +57,10 @@
 #include "gtkutils.h"
 #include "pidginstock.h"
 
+#ifdef USE_VV
+#include <gst/interfaces/propertyprobe.h>
+#endif
+
 #define PROXYHOST 0
 #define PROXYPORT 1
 #define PROXYUSER 2
@@ -2401,13 +2405,97 @@ sound_page(void)
 }
 
 #ifdef USE_VV
+static GList*
+get_devices(const gchar *plugin)
+{
+	GObjectClass *klass;
+	GstPropertyProbe *probe;
+	const GParamSpec *pspec;
+	GstElement *element = gst_element_factory_make(plugin, NULL);
+	GstElementFactory *factory;
+	const gchar *longname = NULL;
+	GList *ret = NULL;
 
+	if (element == NULL)
+		return NULL;
+
+	factory = gst_element_get_factory(element);
+
+	longname = gst_element_factory_get_longname(factory);
+	klass = G_OBJECT_GET_CLASS(element);
+
+	if (!g_object_class_find_property(klass, "device") ||
+			!GST_IS_PROPERTY_PROBE(element) ||
+			!(probe = GST_PROPERTY_PROBE(element)) ||
+			!(pspec = gst_property_probe_get_property(probe,
+					"device"))) {
+		purple_debug_info("media",
+				"Found source '%s' (%s) - no device\n",
+				longname, GST_PLUGIN_FEATURE (factory)->name);
+	} else {
+		gint n;
+		gchar *name;
+		GValueArray *array;
+
+		purple_debug_info("media", "Found devices\n");
+
+		/* Set autoprobe[-fps] to FALSE to avoid delays when probing. */
+		if (g_object_class_find_property (klass, "autoprobe")) {
+			g_object_set(G_OBJECT (element),
+					"autoprobe", FALSE, NULL);
+			if (g_object_class_find_property(klass,
+					"autoprobe-fps")) {
+				g_object_set(G_OBJECT(element),
+						"autoprobe-fps", FALSE, NULL);
+			}
+		}
+
+		array = gst_property_probe_probe_and_get_values(probe, pspec);
+		if (array != NULL) {
+			for (n = 0 ; n < array->n_values ; n++) {
+				GValue *device = g_value_array_get_nth(
+						array, n);
+				
+				ret = g_list_append(ret,
+						g_value_dup_string(device));
+
+				g_object_set(G_OBJECT(element), "device",
+						g_value_get_string(device),
+						NULL);
+				g_object_get(G_OBJECT(element),
+						"device-name", &name, NULL);
+				purple_debug_info("media", "Found source '%s'"
+						" (%s) - device '%s' (%s)\n",
+						longname, GST_PLUGIN_FEATURE(
+						factory)->name,	name,
+						g_value_get_string(device));
+				g_free(name);
+			}
+			g_value_array_free(array);
+		}
+
+		/* Restore autoprobe[-fps] to TRUE. */
+		if (g_object_class_find_property(klass, "autoprobe")) {
+			g_object_set(G_OBJECT(element),
+					"autoprobe", TRUE, NULL);
+			if (g_object_class_find_property(klass,
+					"autoprobe-fps")) {
+				g_object_set(G_OBJECT(element),
+						"autoprobe-fps", TRUE, NULL);
+			}
+		}
+	}
+
+	gst_object_unref(element);
+	return ret;
+}
+
 /* get a GList of pairs name / device */
 static GList *
 get_device_items(const gchar *plugin)
 {
 	GList *ret = NULL;
-	GList *devices = purple_media_get_devices(plugin);
+	GList *devices = get_devices(plugin);
 	GstElement *element = gst_element_factory_make(plugin, NULL);
 
 	if (element == NULL)


More information about the Commits mailing list