From b1642e68a321a80d7557863409455375906c14ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Fri, 10 Jul 2009 15:21:16 +0100 Subject: Put codec preferences in a configuration file --- libempathy/empathy-call-handler.c | 53 +++++++++------------------------------ 1 file changed, 12 insertions(+), 41 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-call-handler.c b/libempathy/empathy-call-handler.c index f73c41e2e..4565ec10b 100644 --- a/libempathy/empathy-call-handler.c +++ b/libempathy/empathy-call-handler.c @@ -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 -- cgit v1.2.3