diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-07-14 17:21:07 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-07-14 17:21:07 +0800 |
commit | ab41c50394233d90650679b9aced9b92f6eb630d (patch) | |
tree | 18890e1da78876830b4c75e4a0f55cbc515c0874 /libempathy/empathy-call-handler.c | |
parent | f94f23d8e922713c593e423722ee50517e12cb49 (diff) | |
parent | 652acf51f63f430fb5cbbc004739a2d7b551da71 (diff) | |
download | gsoc2013-empathy-ab41c50394233d90650679b9aced9b92f6eb630d.tar gsoc2013-empathy-ab41c50394233d90650679b9aced9b92f6eb630d.tar.gz gsoc2013-empathy-ab41c50394233d90650679b9aced9b92f6eb630d.tar.bz2 gsoc2013-empathy-ab41c50394233d90650679b9aced9b92f6eb630d.tar.lz gsoc2013-empathy-ab41c50394233d90650679b9aced9b92f6eb630d.tar.xz gsoc2013-empathy-ab41c50394233d90650679b9aced9b92f6eb630d.tar.zst gsoc2013-empathy-ab41c50394233d90650679b9aced9b92f6eb630d.zip |
Merge branch 'debug-av-599166'
Diffstat (limited to 'libempathy/empathy-call-handler.c')
-rw-r--r-- | libempathy/empathy-call-handler.c | 203 |
1 files changed, 200 insertions, 3 deletions
diff --git a/libempathy/empathy-call-handler.c b/libempathy/empathy-call-handler.c index 1f9ab7213..07620ad4b 100644 --- a/libempathy/empathy-call-handler.c +++ b/libempathy/empathy-call-handler.c @@ -54,7 +54,11 @@ enum { PROP_GST_BUS, PROP_CONTACT, PROP_INITIAL_AUDIO, - PROP_INITIAL_VIDEO + PROP_INITIAL_VIDEO, + PROP_SEND_AUDIO_CODEC, + PROP_SEND_VIDEO_CODEC, + PROP_RECV_AUDIO_CODECS, + PROP_RECV_VIDEO_CODECS, }; /* private structure */ @@ -66,6 +70,11 @@ typedef struct { TfChannel *tfchannel; gboolean initial_audio; gboolean initial_video; + + FsCodec *send_audio_codec; + FsCodec *send_video_codec; + GList *recv_audio_codecs; + GList *recv_video_codecs; } EmpathyCallHandlerPriv; #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCallHandler) @@ -106,7 +115,13 @@ empathy_call_handler_dispose (GObject *object) static void empathy_call_handler_finalize (GObject *object) { - /* free any data held directly by the object here */ + EmpathyCallHandlerPriv *priv = GET_PRIV (object); + + fs_codec_destroy (priv->send_audio_codec); + fs_codec_destroy (priv->send_video_codec); + fs_codec_list_destroy (priv->recv_audio_codecs); + fs_codec_list_destroy (priv->recv_video_codecs); + if (G_OBJECT_CLASS (empathy_call_handler_parent_class)->finalize) G_OBJECT_CLASS (empathy_call_handler_parent_class)->finalize (object); } @@ -176,6 +191,18 @@ empathy_call_handler_get_property (GObject *object, case PROP_INITIAL_VIDEO: g_value_set_boolean (value, priv->initial_video); break; + case PROP_SEND_AUDIO_CODEC: + g_value_set_boxed (value, priv->send_audio_codec); + break; + case PROP_SEND_VIDEO_CODEC: + g_value_set_boxed (value, priv->send_video_codec); + break; + case PROP_RECV_AUDIO_CODECS: + g_value_set_boxed (value, priv->recv_audio_codecs); + break; + case PROP_RECV_VIDEO_CODECS: + g_value_set_boxed (value, priv->recv_video_codecs); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } @@ -222,6 +249,34 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) g_object_class_install_property (object_class, PROP_INITIAL_VIDEO, param_spec); + param_spec = g_param_spec_boxed ("send-audio-codec", + "send audio codec", "Codec used to encode the outgoing video stream", + FS_TYPE_CODEC, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_SEND_AUDIO_CODEC, + param_spec); + + param_spec = g_param_spec_boxed ("send-video-codec", + "send video codec", "Codec used to encode the outgoing video stream", + FS_TYPE_CODEC, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_SEND_VIDEO_CODEC, + param_spec); + + param_spec = g_param_spec_boxed ("recv-audio-codecs", + "recvs audio codec", "Codecs used to decode the incoming audio stream", + FS_TYPE_CODEC_LIST, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_RECV_AUDIO_CODECS, + param_spec); + + param_spec = g_param_spec_boxed ("recv-video-codecs", + "recvs video codec", "Codecs used to decode the incoming video stream", + FS_TYPE_CODEC_LIST, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_RECV_VIDEO_CODECS, + param_spec); + signals[CONFERENCE_ADDED] = g_signal_new ("conference-added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, @@ -288,15 +343,104 @@ empathy_call_handler_new_for_channel (EmpathyTpCall *call) NULL)); } +static void +update_sending_codec (EmpathyCallHandler *self, + FsCodec *codec, + FsSession *session) +{ + EmpathyCallHandlerPriv *priv = GET_PRIV (self); + FsMediaType type; + + if (codec == NULL || session == NULL) + return; + + g_object_get (session, "media-type", &type, NULL); + + if (type == FS_MEDIA_TYPE_AUDIO) + { + priv->send_audio_codec = fs_codec_copy (codec); + g_object_notify (G_OBJECT (self), "send-audio-codec"); + } + else if (type == FS_MEDIA_TYPE_VIDEO) + { + priv->send_video_codec = fs_codec_copy (codec); + g_object_notify (G_OBJECT (self), "send-video-codec"); + } +} + +static void +update_receiving_codec (EmpathyCallHandler *self, + GList *codecs, + FsStream *stream) +{ + EmpathyCallHandlerPriv *priv = GET_PRIV (self); + FsSession *session; + FsMediaType type; + + if (codecs == NULL || stream == NULL) + return; + + g_object_get (stream, "session", &session, NULL); + if (session == NULL) + return; + + g_object_get (session, "media-type", &type, NULL); + + if (type == FS_MEDIA_TYPE_AUDIO) + { + priv->recv_audio_codecs = fs_codec_list_copy (codecs); + g_object_notify (G_OBJECT (self), "recv-audio-codecs"); + } + else if (type == FS_MEDIA_TYPE_VIDEO) + { + priv->recv_video_codecs = fs_codec_list_copy (codecs); + g_object_notify (G_OBJECT (self), "recv-video-codecs"); + } + + g_object_unref (session); +} + void empathy_call_handler_bus_message (EmpathyCallHandler *handler, GstBus *bus, GstMessage *message) { EmpathyCallHandlerPriv *priv = GET_PRIV (handler); + const GstStructure *s = gst_message_get_structure (message); if (priv->tfchannel == NULL) return; + if (s != NULL && + gst_structure_has_name (s, "farsight-send-codec-changed")) + { + const GValue *val; + FsCodec *codec; + FsSession *session; + + val = gst_structure_get_value (s, "codec"); + codec = g_value_get_boxed (val); + + val = gst_structure_get_value (s, "session"); + session = g_value_get_object (val); + + update_sending_codec (handler, codec, session); + } + else if (s != NULL && + gst_structure_has_name (s, "farsight-recv-codecs-changed")) + { + const GValue *val; + GList *codecs; + FsStream *stream; + + val = gst_structure_get_value (s, "codecs"); + codecs = g_value_get_boxed (val); + + val = gst_structure_get_value (s, "stream"); + stream = g_value_get_object (val); + + update_receiving_codec (handler, codecs, stream); + } + tf_channel_bus_message (priv->tfchannel, message); } @@ -367,6 +511,10 @@ empathy_call_handler_tf_channel_stream_created_cb (TfChannel *tfchannel, guint media_type; GstPad *spad; gboolean retval; + FsStream *fs_stream; + GList *codecs; + FsSession *session; + FsCodec *codec; g_signal_connect (stream, "src-pad-added", G_CALLBACK (empathy_call_handler_tf_stream_src_pad_added_cb), handler); @@ -386,7 +534,25 @@ empathy_call_handler_tf_channel_stream_created_cb (TfChannel *tfchannel, tf_stream_error (stream, TP_MEDIA_STREAM_ERROR_MEDIA_ERROR, "Could not link source"); - gst_object_unref (spad); + /* Get sending codec */ + g_object_get (stream, "farsight-session", &session, NULL); + g_object_get (session, "current-send-codec", &codec, NULL); + + update_sending_codec (handler, codec, session); + + tp_clear_object (&session); + tp_clear_object (&codec); + + /* Get receiving codec */ + g_object_get (stream, "farsight-stream", &fs_stream, NULL); + g_object_get (fs_stream, "current-recv-codecs", &codecs, NULL); + + update_receiving_codec (handler, codecs, fs_stream); + + fs_codec_list_destroy (codecs); + tp_clear_object (&fs_stream); + + gst_object_unref (spad); } static void @@ -526,3 +692,34 @@ empathy_call_handler_has_initial_video (EmpathyCallHandler *handler) return priv->initial_video; } +FsCodec * +empathy_call_handler_get_send_audio_codec (EmpathyCallHandler *self) +{ + EmpathyCallHandlerPriv *priv = GET_PRIV (self); + + return priv->send_audio_codec; +} + +FsCodec * +empathy_call_handler_get_send_video_codec (EmpathyCallHandler *self) +{ + EmpathyCallHandlerPriv *priv = GET_PRIV (self); + + return priv->send_video_codec; +} + +GList * +empathy_call_handler_get_recv_audio_codecs (EmpathyCallHandler *self) +{ + EmpathyCallHandlerPriv *priv = GET_PRIV (self); + + return priv->recv_audio_codecs; +} + +GList * +empathy_call_handler_get_recv_video_codecs (EmpathyCallHandler *self) +{ + EmpathyCallHandlerPriv *priv = GET_PRIV (self); + + return priv->recv_video_codecs; +} |