# HG changeset patch # User Mike Ruprecht # Date 1237761241 0 # Node ID d01fb18be4d2c011683f296d862ece849a2e9b96 # Parent 5e605a489d531b59424da8f53d0ed32c59878a5f Move purple_media_get_devices to gtkprefs.c. diff -r 5e605a489d53 -r d01fb18be4d2 libpurple/media.c --- a/libpurple/media.c Sun Mar 22 22:14:16 2009 +0000 +++ b/libpurple/media.c Sun Mar 22 22:34:01 2009 +0000 @@ -38,7 +38,6 @@ #ifdef USE_VV -#include #include /** @copydoc _PurpleMediaSession */ @@ -1400,77 +1399,6 @@ } } -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) { diff -r 5e605a489d53 -r d01fb18be4d2 libpurple/media.h --- a/libpurple/media.h Sun Mar 22 22:14:16 2009 +0000 +++ b/libpurple/media.h Sun Mar 22 22:34:01 2009 +0000 @@ -427,15 +427,6 @@ 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. diff -r 5e605a489d53 -r d01fb18be4d2 pidgin/gtkprefs.c --- a/pidgin/gtkprefs.c Sun Mar 22 22:14:16 2009 +0000 +++ b/pidgin/gtkprefs.c Sun Mar 22 22:34:01 2009 +0000 @@ -57,6 +57,10 @@ #include "gtkutils.h" #include "pidginstock.h" +#ifdef USE_VV +#include +#endif + #define PROXYHOST 0 #define PROXYPORT 1 #define PROXYUSER 2 @@ -2401,13 +2405,97 @@ } #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)