diff options
Diffstat (limited to 'libempathy/empathy-call-handler.c')
-rw-r--r-- | libempathy/empathy-call-handler.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/libempathy/empathy-call-handler.c b/libempathy/empathy-call-handler.c index 59afe3f99..8d159cdd4 100644 --- a/libempathy/empathy-call-handler.c +++ b/libempathy/empathy-call-handler.c @@ -289,6 +289,56 @@ 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) + { + 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); + } + + return NULL; +} + static void empathy_call_handler_start_tpfs (EmpathyCallHandler *self) { @@ -308,6 +358,8 @@ empathy_call_handler_start_tpfs (EmpathyCallHandler *self) G_CALLBACK (empathy_call_handler_tf_channel_stream_created_cb), self); g_signal_connect (priv->tfchannel, "closed", G_CALLBACK (empathy_call_handler_tf_channel_closed_cb), self); + g_signal_connect (priv->tfchannel, "stream-get-codec-config", + G_CALLBACK (empathy_call_handler_tf_channel_codec_config_cb), self); g_object_unref (channel); } |