]> git.0d.be Git - empathy.git/commitdiff
Put codec preferences in a configuration file
authorOlivier Crête <olivier.crete@collabora.co.uk>
Fri, 10 Jul 2009 14:21:16 +0000 (15:21 +0100)
committerOlivier Crête <olivier.crete@collabora.co.uk>
Thu, 6 Aug 2009 17:24:39 +0000 (13:24 -0400)
data/Makefile.am
data/codec-preferences [new file with mode: 0644]
libempathy/empathy-call-handler.c

index 52108fbe7f725ef73640b27f65ac94e85eec4ed4..94737140f7511deee7dedeb6637c3aa05c97753c 100644 (file)
@@ -30,6 +30,10 @@ schemas_in_files = empathy.schemas.in
 schemas_DATA    = $(schemas_in_files:.schemas.in=.schemas)
 @INTLTOOL_SCHEMAS_RULE@
 
+streamingprefsdir =  $(datadir)/empathy
+streamingprefs_DATA =          \
+       codec-preferences
+
 if GCONF_SCHEMAS_INSTALL
 install-data-local:
        if test -z "$(DESTDIR)" ; then \
diff --git a/data/codec-preferences b/data/codec-preferences
new file mode 100644 (file)
index 0000000..0cb0910
--- /dev/null
@@ -0,0 +1,36 @@
+# Favorite audio codecs
+
+[audio/SPEEX:8000]
+clock-rate=8000
+
+[audio/SPEEX:16000]
+clock-rate=16000
+
+[audio/AMR]
+
+[audio/G729]
+
+[audio/ILBC]
+
+# Disabled audio codecs
+
+[audio/DV]
+id=-1
+
+[audio/MPA]
+id=-1
+
+[audio/VORBIS]
+id=-1
+
+[audio/MP3]
+id=-1
+
+
+# Favorite video codecs
+
+[video/H264]
+
+[video/H263]
+
+[video/THEORA]
index f73c41e2eb683931f61f97dd0846b9f4cf67a282..4565ec10b4cce9f418927f1ea5281618c6550225 100644 (file)
@@ -426,54 +426,25 @@ empathy_call_handler_tf_channel_closed_cb (TfChannel *tfchannel,
   g_signal_emit (G_OBJECT (handler), signals[CLOSED], 0);
 }
 
-static GList *
-empathy_call_handler_tf_channel_codec_config_get_defaults (FsCodec *codecs)
-{
-  GList *l = NULL;
-  int i;
-
-  for (i = 0; codecs[i].encoding_name != NULL; i++)
-      l = g_list_append (l, fs_codec_copy (codecs + i));
-
-  return l;
-}
-
 static GList *
 empathy_call_handler_tf_channel_codec_config_cb (TfChannel *channel,
   guint stream_id, FsMediaType media_type, guint direction, gpointer user_data)
 {
-  FsCodec audio_codecs[] = {
-    { FS_CODEC_ID_ANY, "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000, },
-    { FS_CODEC_ID_ANY, "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000, },
-
-    { FS_CODEC_ID_DISABLE, "DV",     FS_MEDIA_TYPE_AUDIO, },
-    { FS_CODEC_ID_DISABLE, "MPA",    FS_MEDIA_TYPE_AUDIO, },
-    { FS_CODEC_ID_DISABLE, "VORBIS", FS_MEDIA_TYPE_AUDIO, },
-    { FS_CODEC_ID_DISABLE, "MP3",    FS_MEDIA_TYPE_AUDIO, },
-    { 0, NULL, 0,}
-  };
-  FsCodec video_codecs[] = {
-    { FS_CODEC_ID_ANY, "H264",   FS_MEDIA_TYPE_VIDEO, },
-    { FS_CODEC_ID_ANY, "THEORA", FS_MEDIA_TYPE_VIDEO, },
-    { FS_CODEC_ID_ANY, "H263",   FS_MEDIA_TYPE_VIDEO, },
-
-    { FS_CODEC_ID_DISABLE, "DV",   FS_MEDIA_TYPE_VIDEO, },
-    { FS_CODEC_ID_DISABLE, "JPEG", FS_MEDIA_TYPE_VIDEO, },
-    { FS_CODEC_ID_DISABLE, "MPV",  FS_MEDIA_TYPE_VIDEO, },
-    { 0, NULL, 0}
-  };
-
-  switch (media_type)
+  gchar *filename = empathy_file_lookup ("codec-preferences", "data");
+  GList *codecs;
+  GError *error = NULL;
+
+  codecs = fs_codec_list_from_keyfile (filename, &error);
+  g_free (filename);
+
+  if (!codecs)
     {
-      case FS_MEDIA_TYPE_AUDIO:
-        return empathy_call_handler_tf_channel_codec_config_get_defaults
-          (audio_codecs);
-      case FS_MEDIA_TYPE_VIDEO:
-        return empathy_call_handler_tf_channel_codec_config_get_defaults
-          (video_codecs);
+      g_warning ("No codec-preferences file: %s",
+          error ? error->message : "No error message");
     }
+  g_clear_error (&error);
 
-  return NULL;
+  return codecs;
 }
 
 static void