From f93c1b261ed44eff2bbaa99d8c10ebd39682ca27 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 12 Jul 2010 12:56:55 +0200 Subject: call-window: Add 'details' pane containing encoding codecs (#599166) The details pane has been inspired from totem's 'Properties' pane. --- src/empathy-call-window.c | 63 +++++++++++ src/empathy-call-window.ui | 276 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 339 insertions(+) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index a8d1c40fa..9a3783f8a 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -167,6 +167,11 @@ struct _EmpathyCallWindowPriv GtkWidget *dtmf_panel; + /* Details vbox */ + GtkWidget *details_vbox; + GtkWidget *vcodec_encoding_label; + GtkWidget *acodec_encoding_label; + GstElement *video_input; GstElement *audio_input; GstElement *audio_output; @@ -1039,6 +1044,9 @@ empathy_call_window_init (EmpathyCallWindow *self) "camera_on", &priv->tool_button_camera_on, "action_camera_off", &priv->action_camera, "action_camera_preview", &priv->action_camera_preview, + "details_vbox", &priv->details_vbox, + "vcodec_encoding_label", &priv->vcodec_encoding_label, + "acodec_encoding_label", &priv->acodec_encoding_label, NULL); g_free (filename); @@ -1163,6 +1171,8 @@ empathy_call_window_init (EmpathyCallWindow *self) gtk_widget_set_sensitive (priv->dtmf_panel, FALSE); + empathy_sidebar_add_page (EMPATHY_SIDEBAR (priv->sidebar), _("Details"), + priv->details_vbox); gtk_widget_show_all (top_vbox); @@ -1328,6 +1338,51 @@ empathy_call_window_setup_avatars (EmpathyCallWindow *self, gtk_widget_show (priv->remote_user_avatar_widget); } +static void +update_send_codec (EmpathyCallWindow *self, + gboolean audio) +{ + EmpathyCallWindowPriv *priv = GET_PRIV (self); + FsCodec *codec; + GtkWidget *widget; + + if (audio) + { + codec = empathy_call_handler_get_send_audio_codec (priv->handler); + widget = priv->acodec_encoding_label; + } + else + { + codec = empathy_call_handler_get_send_video_codec (priv->handler); + widget = priv->vcodec_encoding_label; + } + + if (codec == NULL) + return; + + gtk_label_set_text (GTK_LABEL (widget), codec->encoding_name); +} + +static void +send_audio_codec_notify_cb (GObject *object, + GParamSpec *pspec, + gpointer user_data) +{ + EmpathyCallWindow *self = user_data; + + update_send_codec (self, TRUE); +} + +static void +send_video_codec_notify_cb (GObject *object, + GParamSpec *pspec, + gpointer user_data) +{ + EmpathyCallWindow *self = user_data; + + update_send_codec (self, FALSE); +} + static void empathy_call_window_constructed (GObject *object) { @@ -1352,6 +1407,14 @@ empathy_call_window_constructed (GObject *object) } /* If call has InitialVideo, the preview will be started once the call has * been started (start_call()). */ + + update_send_codec (self, TRUE); + update_send_codec (self, FALSE); + + tp_g_signal_connect_object (priv->handler, "notify::send-audio-codec", + G_CALLBACK (send_audio_codec_notify_cb), self, 0); + tp_g_signal_connect_object (priv->handler, "notify::send-video-codec", + G_CALLBACK (send_video_codec_notify_cb), self, 0); } static void empathy_call_window_dispose (GObject *object); diff --git a/src/empathy-call-window.ui b/src/empathy-call-window.ui index 0c0156d46..7916ba1f0 100644 --- a/src/empathy-call-window.ui +++ b/src/empathy-call-window.ui @@ -238,4 +238,280 @@ + + + 6 + False + False + 18 + vertical + + + + True + False + 6 + vertical + + + + True + Video + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + + 0 + True + True + + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + 4 + 2 + False + 6 + 12 + + + + True + Encoding Codec: + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + + 0 + 1 + 1 + 2 + fill + + + + + + + + True + True + Unknown + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_END + -1 + False + 0 + + + 1 + 2 + 1 + 2 + expand|shrink|fill + + + + + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + True + False + 6 + vertical + + + + True + Audio + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + + 0 + True + True + + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + 4 + 2 + False + 6 + 12 + + + + True + Encoding Codec: + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + True + Unknown + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_END + -1 + False + 0 + + + 1 + 2 + 0 + 1 + expand|shrink|fill + + + + + + + + + 0 + True + True + + + + + 0 + True + True + + + + -- cgit v1.2.3 From 33687760c2eb1d9ddf41092c88aef8ba65108df6 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 12 Jul 2010 17:16:37 +0200 Subject: call-window: display receiving codecs --- src/empathy-call-window.c | 74 +++++++++++++++++++++++++++ src/empathy-call-window.ui | 121 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 9a3783f8a..4856821ca 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -171,6 +171,8 @@ struct _EmpathyCallWindowPriv GtkWidget *details_vbox; GtkWidget *vcodec_encoding_label; GtkWidget *acodec_encoding_label; + GtkWidget *vcodec_decoding_label; + GtkWidget *acodec_decoding_label; GstElement *video_input; GstElement *audio_input; @@ -1047,6 +1049,8 @@ empathy_call_window_init (EmpathyCallWindow *self) "details_vbox", &priv->details_vbox, "vcodec_encoding_label", &priv->vcodec_encoding_label, "acodec_encoding_label", &priv->acodec_encoding_label, + "acodec_decoding_label", &priv->acodec_decoding_label, + "vcodec_decoding_label", &priv->vcodec_decoding_label, NULL); g_free (filename); @@ -1383,6 +1387,70 @@ send_video_codec_notify_cb (GObject *object, update_send_codec (self, FALSE); } +static void +update_recv_codec (EmpathyCallWindow *self, + gboolean audio) +{ + EmpathyCallWindowPriv *priv = GET_PRIV (self); + GList *codecs, *l; + GtkWidget *widget; + gchar *str = NULL; + + if (audio) + { + codecs = empathy_call_handler_get_recv_audio_codecs (priv->handler); + widget = priv->acodec_decoding_label; + } + else + { + codecs = empathy_call_handler_get_recv_video_codecs (priv->handler); + widget = priv->vcodec_decoding_label; + } + + if (codecs == NULL) + return; + + for (l = codecs; l != NULL; l = g_list_next (l)) + { + FsCodec *codec = l->data; + + if (str == NULL) + { + str = g_strdup (codec->encoding_name); + } + else + { + gchar *tmp = str; + + str = g_strdup_printf ("%s, %s", tmp, codec->encoding_name); + g_free (tmp); + } + } + + gtk_label_set_text (GTK_LABEL (widget), str); + g_free (str); +} + +static void +recv_audio_codecs_notify_cb (GObject *object, + GParamSpec *pspec, + gpointer user_data) +{ + EmpathyCallWindow *self = user_data; + + update_recv_codec (self, TRUE); +} + +static void +recv_video_codecs_notify_cb (GObject *object, + GParamSpec *pspec, + gpointer user_data) +{ + EmpathyCallWindow *self = user_data; + + update_recv_codec (self, FALSE); +} + static void empathy_call_window_constructed (GObject *object) { @@ -1410,11 +1478,17 @@ empathy_call_window_constructed (GObject *object) update_send_codec (self, TRUE); update_send_codec (self, FALSE); + update_recv_codec (self, TRUE); + update_recv_codec (self, FALSE); tp_g_signal_connect_object (priv->handler, "notify::send-audio-codec", G_CALLBACK (send_audio_codec_notify_cb), self, 0); tp_g_signal_connect_object (priv->handler, "notify::send-video-codec", G_CALLBACK (send_video_codec_notify_cb), self, 0); + tp_g_signal_connect_object (priv->handler, "notify::recv-audio-codecs", + G_CALLBACK (recv_audio_codecs_notify_cb), self, 0); + tp_g_signal_connect_object (priv->handler, "notify::recv-video-codecs", + G_CALLBACK (recv_video_codecs_notify_cb), self, 0); } static void empathy_call_window_dispose (GObject *object); diff --git a/src/empathy-call-window.ui b/src/empathy-call-window.ui index 7916ba1f0..781de76d9 100644 --- a/src/empathy-call-window.ui +++ b/src/empathy-call-window.ui @@ -363,6 +363,67 @@ + + + True + Decoding Codec: + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + + 0 + 1 + 2 + 3 + fill + + + + + + + + True + True + Unknown + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_END + -1 + False + 0 + + + 1 + 2 + 2 + 3 + expand|shrink|fill + + + + @@ -496,6 +557,66 @@ + + + True + Decoding Codec: + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + True + Unknown + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_END + -1 + False + 0 + + + 1 + 2 + 1 + 2 + expand|shrink|fill + + + + -- cgit v1.2.3 From ddecbcd81f0377608de94dcdf7e3a797ae0022fd Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 12 Jul 2010 17:54:56 +0200 Subject: reset codecs when call is disconnected --- src/empathy-call-window.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 4856821ca..7aa8f6dbf 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -1756,6 +1756,17 @@ empathy_call_window_reset_pipeline (EmpathyCallWindow *self) } } +static void +reset_details_pane (EmpathyCallWindow *self) +{ + EmpathyCallWindowPriv *priv = GET_PRIV (self); + + gtk_label_set_text (GTK_LABEL (priv->vcodec_encoding_label), _("Unknown")); + gtk_label_set_text (GTK_LABEL (priv->acodec_encoding_label), _("Unknown")); + gtk_label_set_text (GTK_LABEL (priv->vcodec_decoding_label), _("Unknown")); + gtk_label_set_text (GTK_LABEL (priv->acodec_decoding_label), _("Unknown")); +} + static gboolean empathy_call_window_disconnected (EmpathyCallWindow *self, gboolean restart) @@ -1823,6 +1834,8 @@ empathy_call_window_disconnected (EmpathyCallWindow *self, gtk_widget_show (priv->remote_user_avatar_widget); + reset_details_pane (self); + priv->sending_video = FALSE; priv->call_started = FALSE; -- cgit v1.2.3 From 652acf51f63f430fb5cbbc004739a2d7b551da71 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 13 Jul 2010 09:34:44 +0200 Subject: display the clock rate of the codec as well --- src/empathy-call-window.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 7aa8f6dbf..e607b2ef7 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -1349,6 +1349,7 @@ update_send_codec (EmpathyCallWindow *self, EmpathyCallWindowPriv *priv = GET_PRIV (self); FsCodec *codec; GtkWidget *widget; + gchar *tmp; if (audio) { @@ -1364,7 +1365,9 @@ update_send_codec (EmpathyCallWindow *self, if (codec == NULL) return; - gtk_label_set_text (GTK_LABEL (widget), codec->encoding_name); + tmp = g_strdup_printf ("%s/%u", codec->encoding_name, codec->clock_rate); + gtk_label_set_text (GTK_LABEL (widget), tmp); + g_free (tmp); } static void @@ -1394,7 +1397,7 @@ update_recv_codec (EmpathyCallWindow *self, EmpathyCallWindowPriv *priv = GET_PRIV (self); GList *codecs, *l; GtkWidget *widget; - gchar *str = NULL; + GString *str = NULL; if (audio) { @@ -1415,20 +1418,16 @@ update_recv_codec (EmpathyCallWindow *self, FsCodec *codec = l->data; if (str == NULL) - { - str = g_strdup (codec->encoding_name); - } + str = g_string_new (NULL); else - { - gchar *tmp = str; + g_string_append (str, ", "); - str = g_strdup_printf ("%s, %s", tmp, codec->encoding_name); - g_free (tmp); - } + g_string_append_printf (str, "%s/%u", codec->encoding_name, + codec->clock_rate); } - gtk_label_set_text (GTK_LABEL (widget), str); - g_free (str); + gtk_label_set_text (GTK_LABEL (widget), str->str); + g_string_free (str, TRUE); } static void -- cgit v1.2.3