changeset 28174:6ed9c1def7c8

Allow setting properties on GStreamer elements with fs-element.conf.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 05 Aug 2009 01:58:02 +0000
parents 94d7701a242e
children fa2e83d7ba7f
files libpurple/mediamanager.c
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/mediamanager.c	Wed Aug 05 01:34:21 2009 +0000
+++ b/libpurple/mediamanager.c	Wed Aug 05 01:58:02 2009 +0000
@@ -39,6 +39,7 @@
 #ifdef USE_VV
 
 #include <gst/farsight/fs-conference-iface.h>
+#include <gst/farsight/fs-element-added-notifier.h>
 #include <gst/interfaces/xoverlay.h>
 
 /** @copydoc _PurpleMediaManagerPrivate */
@@ -229,6 +230,9 @@
 	g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL);
 
 	if (manager->priv->pipeline == NULL) {
+		gchar *filename;
+		GError *err = NULL;
+		GKeyFile *keyfile;
 		GstBus *bus;
 		manager->priv->pipeline = gst_pipeline_new(NULL);
 
@@ -241,6 +245,33 @@
 				gst_bus_sync_signal_handler, NULL);
 		gst_object_unref(bus);
 
+		filename = g_build_filename(purple_user_dir(),
+				"fs-element.conf", NULL);
+		keyfile = g_key_file_new();
+		if (g_key_file_load_from_file(keyfile, filename,
+				G_KEY_FILE_NONE, &err)) {
+			FsElementAddedNotifier *notifier =
+					fs_element_added_notifier_new();
+			fs_element_added_notifier_add(notifier,
+					GST_BIN(manager->priv->pipeline));
+			fs_element_added_notifier_set_properties_from_keyfile(
+					notifier, keyfile);
+		} else {
+			if (err->code == 4)
+				purple_debug_info("mediamanager",
+						"Couldn't read "
+						"fs-element.conf: %s\n",
+						err->message);
+			else
+				purple_debug_error("mediamanager",
+						"Error reading "
+						"fs-element.conf: %s\n",
+						err->message);
+			g_error_free(err);
+			g_key_file_free(keyfile);
+		}
+		g_free(filename);
+
 		gst_element_set_state(manager->priv->pipeline,
 				GST_STATE_PLAYING);
 	}