Mercurial > pidgin
changeset 24931:943a09762d95
Removed several PurpleMedia functions that now seem unnecessary:
* purple_media_get_device_name
* purple_media_get_element
* purple_media_element_set_device
* purple_media_element_set_device_from_name (didn't exist)
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Sun, 31 Aug 2008 22:46:16 +0000 |
parents | 0baeafee93be |
children | 5606408fff59 |
files | libpurple/media.c libpurple/media.h pidgin/gtkprefs.c |
diffstat | 3 files changed, 10 insertions(+), 109 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/media.c Sun Aug 31 21:20:05 2008 +0000 +++ b/libpurple/media.c Sun Aug 31 22:46:16 2008 +0000 @@ -750,21 +750,6 @@ g_signal_emit(media, purple_media_signals[GOT_ACCEPT], 0); } -gchar* -purple_media_get_device_name(GstElement *element, const gchar *device) -{ - gchar *name; - - GstElementFactory *factory = gst_element_get_factory(element); - GstElement *temp = gst_element_factory_create(factory, "tmp_src"); - - g_object_set(G_OBJECT (temp), "device", device, NULL); - g_object_get(G_OBJECT (temp), "device-name", &name, NULL); - gst_object_unref(temp); - - return name; -} - GList* purple_media_get_devices(GstElement *element) { @@ -807,12 +792,10 @@ if (array != NULL) { for (n = 0 ; n < array->n_values ; n++) { GValue *device = g_value_array_get_nth (array, n); - gst_element_set_state (element, GST_STATE_NULL); ret = g_list_append(ret, g_value_dup_string(device)); - name = purple_media_get_device_name(GST_ELEMENT(element), - g_value_get_string(device)); + 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)); @@ -833,12 +816,6 @@ return ret; } -void -purple_media_element_set_device(GstElement *element, const gchar *device) -{ - g_object_set(G_OBJECT(element), "device", device, NULL); -} - gchar * purple_media_element_get_device(GstElement *element) { @@ -847,20 +824,6 @@ return device; } -GstElement * -purple_media_get_element(const gchar *factory_name) -{ - GstElementFactory *factory = gst_element_factory_find(factory_name); - GstElement *element; - - if (factory == NULL) - return NULL; - - element = gst_element_factory_create(factory, NULL); - gst_object_unref(factory); - return element; -} - void purple_media_audio_init_src(GstElement **sendbin, GstElement **sendlevel) { @@ -886,21 +849,8 @@ gst_element_add_pad(*sendbin, ghost); g_object_set(G_OBJECT(*sendlevel), "message", TRUE, NULL); - /* set current audio device on "src"... */ - if (audio_device) { - GList *devices = purple_media_get_devices(src); - GList *dev = devices; - purple_debug_info("media", "Setting device of GstElement src to %s\n", - audio_device); - for (; dev ; dev = dev->next) { - gchar *device = (gchar *) dev->data; - char *name = purple_media_get_device_name(src, device); - if (strcmp(name, audio_device) == 0) { - purple_media_element_set_device(src, device); - } - g_free(name); - } - } + if (audio_device != NULL && strcmp(audio_device, "")) + g_object_set(G_OBJECT(src), "device", audio_device, NULL); } void @@ -945,21 +895,8 @@ gst_bin_add(GST_BIN(*sendbin), local_sink); gst_element_link(queue, local_sink); - /* set current video device on "src"... */ - if (video_device) { - GList *devices = purple_media_get_devices(src); - GList *dev = devices; - purple_debug_info("media", "Setting device of GstElement src to %s\n", - video_device); - for (; dev ; dev = dev->next) { - gchar *device = (gchar *) dev->data; - char *name = purple_media_get_device_name(src, device); - if (strcmp(name, video_device) == 0) { - purple_media_element_set_device(src, device); - } - g_free(name); - } - } + if (video_device != NULL && strcmp(video_device, "")) + g_object_set(G_OBJECT(src), "device", video_device, NULL); } void
--- a/libpurple/media.h Sun Aug 31 21:20:05 2008 +0000 +++ b/libpurple/media.h Sun Aug 31 22:46:16 2008 +0000 @@ -285,17 +285,6 @@ void purple_media_got_accept(PurpleMedia *media); /** - * Gets the name of a device. - * - * @param element The plugin the device is from. - * @param device The device data to retreive the name from. - * - * @return The name of the device. - */ -gchar *purple_media_get_device_name(GstElement *element, - const gchar *device); - -/** * Enumerates a list of devices. * * @param element The plugin from which to enumerate devices. @@ -305,23 +294,6 @@ GList *purple_media_get_devices(GstElement *element); /** - * Sets the device to be used with the particular plugin. - * - * @param element The plugin to set the device on. - * @param device The device to set the plugin to. - */ -void purple_media_element_set_device(GstElement *element, const gchar *device); - -/** - * Sets the device from the given name. - * - * @param element The plugin to set the device on. - * @param name The name of the device to set the plugin to. - */ -void purple_media_element_set_device_from_name(GstElement *element, - const gchar *name); - -/** * Gets the device the plugin is currently set to. * * @param element The plugin to retrieve the device from. @@ -331,15 +303,6 @@ gchar *purple_media_element_get_device(GstElement *element); /** - * Creates an element from a factory name. - * - * @param factory_name Name of the factory to create an element from. - * - * @return The element that was created, NULL if it couldn't find the factory. - */ -GstElement *purple_media_get_element(const gchar *factory_name); - -/** * Creates a default audio source. * * @param sendbin Set to the newly created audio source.
--- a/pidgin/gtkprefs.c Sun Aug 31 21:20:05 2008 +0000 +++ b/pidgin/gtkprefs.c Sun Aug 31 22:46:16 2008 +0000 @@ -2030,7 +2030,8 @@ GList *ret = NULL; for(; devices ; devices = devices->next) { - gchar *name = purple_media_get_device_name(GST_ELEMENT(element), devices->data); + gchar *name; + g_object_get(G_OBJECT(element), "device-name", &name, NULL); ret = g_list_append(ret, name); ret = g_list_append(ret, g_strdup(devices->data)); } @@ -2121,7 +2122,7 @@ GtkWidget *preview_button = NULL; const char *plugin = value; const char *device = purple_prefs_get_string("/purple/media/video/device"); - GstElement *video = purple_media_get_element(plugin); + GstElement *video = gst_element_factory_make(plugin, NULL); GList *video_items = NULL; GList *list; @@ -2229,8 +2230,8 @@ const char *plugin = purple_prefs_get_string("/purple/media/video/plugin"); const char *device = purple_prefs_get_string("/purple/media/video/device"); - GstElement *video = purple_media_get_element(plugin); - GstElement *audio = purple_media_get_element("alsasrc"); + GstElement *video = gst_element_factory_make(plugin, NULL); + GstElement *audio = gst_element_factory_make("alsasrc", NULL); GList *video_items = NULL; GList *audio_items = NULL;