]> git.0d.be Git - empathy.git/commitdiff
Make it possible to set element properties from a config file
authorOlivier Crête <olivier.crete@collabora.co.uk>
Fri, 10 Jul 2009 14:41:27 +0000 (15:41 +0100)
committerOlivier Crête <olivier.crete@collabora.co.uk>
Thu, 6 Aug 2009 17:24:40 +0000 (13:24 -0400)
data/Makefile.am
data/element-properties [new file with mode: 0644]
libempathy/empathy-call-handler.c

index 94737140f7511deee7dedeb6637c3aa05c97753c..81ca5a7b91b37d3a43e7b2cd097ea03350a9e9d5 100644 (file)
@@ -32,7 +32,8 @@ schemas_DATA   = $(schemas_in_files:.schemas.in=.schemas)
 
 streamingprefsdir =  $(datadir)/empathy
 streamingprefs_DATA =          \
-       codec-preferences
+       codec-preferences       \
+       element-properties
 
 if GCONF_SCHEMAS_INSTALL
 install-data-local:
diff --git a/data/element-properties b/data/element-properties
new file mode 100644 (file)
index 0000000..e8bd9c0
--- /dev/null
@@ -0,0 +1,17 @@
+# Put the desired properties in the style of
+#
+# [element name]
+# prop1=val1
+
+[gstrtpbin]
+latency=100
+
+[x264enc]
+byte-stream=1
+bframes=0
+b-adapt=0
+cabac=0
+dct8x8=0
+
+[ffenc_h263]
+rtp-payload-size=1
index 4565ec10b4cce9f418927f1ea5281618c6550225..09ea5a1799b9f4ada319b3b2c5dd8519a106d4a9 100644 (file)
@@ -321,49 +321,33 @@ empathy_call_handler_bus_message (EmpathyCallHandler *handler,
   tf_channel_bus_message (priv->tfchannel, message);
 }
 
-static void
-conference_element_added (FsElementAddedNotifier *notifier,
-    GstBin *bin,
-    GstElement *element,
-    gpointer user_data)
-{
-  GstElementFactory *factory;
-  const gchar *name;
-
-  factory = gst_element_get_factory (element);
-  name = gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory));
-
-  if (!tp_strdiff (name, "x264enc"))
-    {
-      /* Ensure that the encoder creates the baseline profile */
-      g_object_set (element,
-          "byte-stream", TRUE,
-          "bframes", 0,
-          "b-adapt", FALSE,
-          "cabac", FALSE,
-          "dct8x8", FALSE,
-          NULL);
-    }
-  else if (!tp_strdiff (name, "gstrtpbin"))
-    {
-      /* Lower the jitterbuffer latency to make it more suitable for video
-       * conferencing */
-      g_object_set (element, "latency", 100, NULL);
-    }
-}
-
 static void
 empathy_call_handler_tf_channel_session_created_cb (TfChannel *tfchannel,
   FsConference *conference, FsParticipant *participant,
   EmpathyCallHandler *self)
 {
   EmpathyCallHandlerPriv *priv = GET_PRIV (self);
+  GKeyFile *keyfile;
+  gchar *filename;
+  GError *error = NULL;
 
   priv->fsnotifier = fs_element_added_notifier_new ();
   fs_element_added_notifier_add (priv->fsnotifier, GST_BIN (conference));
 
-  g_signal_connect (priv->fsnotifier, "element-added",
-    G_CALLBACK (conference_element_added), NULL);
+  keyfile = g_key_file_new ();
+  filename = empathy_file_lookup ("element-properties", "data");
+  if (g_key_file_load_from_file (keyfile, filename, G_KEY_FILE_NONE, &error))
+    {
+      fs_element_added_notifier_set_properties_from_keyfile (priv->fsnotifier,
+          keyfile);
+    }
+  else
+    {
+      g_warning ("Could not load element-properties file: %s", error->message);
+      g_key_file_free (keyfile);
+      g_clear_error (&error);
+    }
+  g_free (filename);
 
   g_signal_emit (G_OBJECT (self), signals[CONFERENCE_ADDED], 0,
     GST_ELEMENT (conference));