/pidgin/main: c52fa2813311: mediamanager: add purple_media_manag...

Jakub Adam jakub.adam at ktknet.cz
Mon Jul 18 00:33:09 EDT 2016


Changeset: c52fa28133112d26a9f0a401de3b9ef3ae5cf725
Author:	 Jakub Adam <jakub.adam at ktknet.cz>
Date:	 2016-06-22 10:15 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/c52fa2813311

Description:

mediamanager: add purple_media_manager_enumerate_elements()

diffstat:

 libpurple/media-gst.h    |  11 +++++++++++
 libpurple/mediamanager.c |  22 ++++++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diffs (53 lines):

diff --git a/libpurple/media-gst.h b/libpurple/media-gst.h
--- a/libpurple/media-gst.h
+++ b/libpurple/media-gst.h
@@ -163,6 +163,17 @@ GstElement *purple_media_manager_get_ele
 		PurpleMediaSessionType type, PurpleMedia *media,
 		const gchar *session_id, const gchar *participant);
 
+/**
+ * purple_media_manager_enumerate_elements:
+ * @manager: The media manager to use to obtain the element infos.
+ * @type: The type of element infos to get.
+ *
+ * Returns: A #GList of registered #PurpleMediaElementInfo instances that match
+ * @type.
+ */
+GList *purple_media_manager_enumerate_elements(PurpleMediaManager *manager,
+		PurpleMediaElementType type);
+
 PurpleMediaElementInfo *purple_media_manager_get_element_info(
 		PurpleMediaManager *manager, const gchar *name);
 gboolean purple_media_manager_register_element(PurpleMediaManager *manager,
diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c
--- a/libpurple/mediamanager.c
+++ b/libpurple/mediamanager.c
@@ -2118,6 +2118,28 @@ purple_media_manager_init_device_monitor
 #endif /* GST_CHECK_VERSION(1, 4, 0) */
 }
 
+GList *
+purple_media_manager_enumerate_elements(PurpleMediaManager *manager,
+		PurpleMediaElementType type)
+{
+	GList *result = NULL;
+	GList *i;
+
+	for (i = manager->priv->elements; i; i = i->next) {
+		PurpleMediaElementInfo *info = i->data;
+		PurpleMediaElementType type2;
+
+		type2 = purple_media_element_info_get_element_type(info);
+
+		if ((type2 & type) == type) {
+			g_object_ref(info);
+			result = g_list_prepend(result, info);
+		}
+	}
+
+	return result;
+}
+
 /*
  * PurpleMediaElementType
  */



More information about the Commits mailing list