#include <telepathy-farsight/channel.h>
+#include <gst/farsight/fs-element-added-notifier.h>
+
#include <libempathy/empathy-tp-contact-factory.h>
#include <libempathy/empathy-call-factory.h>
#include <libempathy/empathy-utils.h>
GtkWidget *vbox;
gulong video_output_motion_handler_id;
+ guint bus_message_source_id;
gdouble volume;
+ GtkWidget *volume_scale;
GtkWidget *volume_progress_bar;
GtkAdjustment *audio_input_adj;
GstElement *funnel;
GstElement *liveadder;
+ FsElementAddedNotifier *fsnotifier;
+
guint context_id;
GTimer *timer;
EmpathyCallWindowPriv *priv = GET_PRIV (self);
gdouble volume;
- volume = gtk_adjustment_get_value (adj)/100.0;
+ if (priv->audio_input == NULL)
+ return;
+
+ volume = gtk_adjustment_get_value (adj)/100.0;
/* Don't store the volume because of muting */
if (volume > 0 || gtk_toggle_tool_button_get_active (
empathy_call_window_create_audio_input (EmpathyCallWindow *self)
{
EmpathyCallWindowPriv *priv = GET_PRIV (self);
- GtkWidget *hbox, *vbox, *scale, *label;
- GtkAdjustment *adj;
+ GtkWidget *hbox, *vbox, *label;
hbox = gtk_hbox_new (TRUE, 3);
vbox = gtk_vbox_new (FALSE, 3);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 3);
- scale = gtk_vscale_new_with_range (0, 150, 100);
- gtk_range_set_inverted (GTK_RANGE (scale), TRUE);
+ priv->volume_scale = gtk_vscale_new_with_range (0, 150, 100);
+ gtk_range_set_inverted (GTK_RANGE (priv->volume_scale), TRUE);
label = gtk_label_new (_("Volume"));
- priv->audio_input_adj = adj = gtk_range_get_adjustment (GTK_RANGE (scale));
+ priv->audio_input_adj = gtk_range_get_adjustment (
+ GTK_RANGE (priv->volume_scale));
priv->volume = empathy_audio_src_get_volume (EMPATHY_GST_AUDIO_SRC
(priv->audio_input));
- gtk_adjustment_set_value (adj, priv->volume * 100);
+ gtk_adjustment_set_value (priv->audio_input_adj, priv->volume * 100);
- g_signal_connect (G_OBJECT (adj), "value-changed",
+ g_signal_connect (G_OBJECT (priv->audio_input_adj), "value-changed",
G_CALLBACK (empathy_call_window_mic_volume_changed_cb), self);
- gtk_box_pack_start (GTK_BOX (vbox), scale, TRUE, TRUE, 3);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->volume_scale, TRUE, TRUE, 3);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 3);
priv->volume_progress_bar = gtk_progress_bar_new ();
GtkWidget *page;
GstBus *bus;
gchar *filename;
+ GKeyFile *keyfile;
+ GError *error = NULL;
filename = empathy_file_lookup ("empathy-call-window.ui", "src");
gui = empathy_builder_get_file (filename,
"ui_manager", &priv->ui_manager,
"menufullscreen", &priv->menu_fullscreen,
NULL);
+ g_free (filename);
empathy_builder_connect (gui, self,
"menuhangup", "activate", empathy_call_window_hangup_cb,
priv->pipeline = gst_pipeline_new (NULL);
bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
- gst_bus_add_watch (bus, empathy_call_window_bus_message, self);
+ priv->bus_message_source_id = gst_bus_add_watch (bus,
+ empathy_call_window_bus_message, self);
+
+ priv->fsnotifier = fs_element_added_notifier_new ();
+ fs_element_added_notifier_add (priv->fsnotifier, GST_BIN (priv->pipeline));
+
+ keyfile = g_key_file_new ();
+ filename = empathy_file_lookup ("element-properties", "data");
+ if (g_key_file_load_from_file (keyfile, filename, G_KEY_FILE_NONE, &error))
+ {
+ fs_element_added_notifier_set_properties_from_keyfile (priv->fsnotifier,
+ keyfile);
+ }
+ else
+ {
+ g_warning ("Could not load element-properties file: %s", error->message);
+ g_key_file_free (keyfile);
+ g_clear_error (&error);
+ }
+ g_free (filename);
+
priv->remote_user_output_frame = gtk_frame_new (NULL);
gtk_widget_set_size_request (priv->remote_user_output_frame,
g_object_ref (priv->ui_manager);
g_object_unref (gui);
- g_free (filename);
}
/* Instead of specifying a width and a height, we specify only one size. That's
EmpathyCallWindowPriv *priv = GET_PRIV (self);
gchar *tmp;
+ /* translators: Call is a noun and %s is the contact name. This string is used
+ * in the window title */
tmp = g_strdup_printf (_("Call with %s"),
empathy_contact_get_name (priv->contact));
gtk_window_set_title (GTK_WINDOW (self), tmp);
else
{
g_warning ("call handler doesn't have a contact");
+ /* translators: Call is a noun. This string is used in the window title */
gtk_window_set_title (GTK_WINDOW (self), _("Call"));
/* Since we can't access the remote contact, we can't get a connection
if (priv->handler != NULL)
g_object_unref (priv->handler);
-
priv->handler = NULL;
if (priv->pipeline != NULL)
g_object_unref (priv->video_tee);
priv->video_tee = NULL;
+ if (priv->fsnotifier != NULL)
+ g_object_unref (priv->fsnotifier);
+ priv->fsnotifier = NULL;
+
if (priv->timer_id != 0)
g_source_remove (priv->timer_id);
priv->timer_id = 0;
priv->video_output_motion_handler_id = 0;
}
+ if (priv->bus_message_source_id != 0)
+ {
+ g_source_remove (priv->bus_message_source_id);
+ priv->bus_message_source_id = 0;
+ }
+
/* free any data held directly by the object here */
g_mutex_free (priv->lock);
if (priv->pipeline == NULL)
return TRUE;
+ if (priv->bus_message_source_id != 0)
+ {
+ g_source_remove (priv->bus_message_source_id);
+ priv->bus_message_source_id = 0;
+ }
+
state_change_return = gst_element_set_state (priv->pipeline, GST_STATE_NULL);
if (state_change_return == GST_STATE_CHANGE_SUCCESS ||
g_object_unref (priv->audio_input);
priv->audio_input = NULL;
+ g_signal_handlers_disconnect_by_func (priv->audio_input_adj,
+ empathy_call_window_mic_volume_changed_cb, self);
+
if (priv->audio_output != NULL)
g_object_unref (priv->audio_output);
priv->audio_output = NULL;
FALSE);
gtk_action_set_sensitive (priv->show_preview, FALSE);
+ gtk_progress_bar_set_fraction (
+ GTK_PROGRESS_BAR (priv->volume_progress_bar), 0);
+
gtk_widget_hide (priv->video_output);
gtk_widget_show (priv->remote_user_avatar_widget);
EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data);
EmpathyCallWindowPriv *priv = GET_PRIV (self);
EmpathyTpCall *call;
- gboolean can_send_video = priv->video_input != NULL && priv->contact != NULL
- && empathy_contact_can_voip_video (priv->contact);
+ gboolean can_send_video;
+
+ can_send_video = priv->video_input != NULL && priv->contact != NULL &&
+ empathy_contact_can_voip_video (priv->contact);
g_object_get (priv->handler, "tp-call", &call, NULL);
EmpathyCallWindowPriv *priv = GET_PRIV (window);
if (priv->pipeline != NULL)
- gst_element_set_state (priv->pipeline, GST_STATE_NULL);
+ {
+ if (priv->bus_message_source_id != 0)
+ {
+ g_source_remove (priv->bus_message_source_id);
+ priv->bus_message_source_id = 0;
+ }
+
+ gst_element_set_state (priv->pipeline, GST_STATE_NULL);
+ }
if (priv->call_state == CONNECTING)
empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING);
priv->pipeline = gst_pipeline_new (NULL);
bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
- gst_bus_add_watch (bus, empathy_call_window_bus_message, window);
+ priv->bus_message_source_id = gst_bus_add_watch (bus,
+ empathy_call_window_bus_message, window);
empathy_call_window_setup_remote_frame (bus, window);
empathy_call_window_setup_self_frame (bus, window);
+ g_signal_connect (G_OBJECT (priv->audio_input_adj), "value-changed",
+ G_CALLBACK (empathy_call_window_mic_volume_changed_cb), window);
+
+ /* While the call was disconnected, the input volume might have changed.
+ * However, since the audio_input source was destroyed, its volume has not
+ * been updated during that time. That's why we manually update it here */
+ empathy_call_window_mic_volume_changed_cb (priv->audio_input_adj, window);
+
g_object_unref (bus);
gtk_widget_show_all (priv->content_hbox);