Mercurial > pidgin
changeset 26034:3b82059e4069
Replace the ready signal in PidginMedia.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Tue, 13 Jan 2009 10:42:20 +0000 |
parents | 366f68124622 |
children | 958a5d614f71 |
files | pidgin/gtkmedia.c |
diffstat | 1 files changed, 37 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkmedia.c Tue Jan 13 09:50:13 2009 +0000 +++ b/pidgin/gtkmedia.c Tue Jan 13 10:42:20 2009 +0000 @@ -67,6 +67,8 @@ PidginMediaState state; GtkWidget *display; + GtkWidget *send_widget; + GtkWidget *recv_widget; GtkWidget *local_video; GtkWidget *remote_video; }; @@ -389,7 +391,7 @@ } static void -pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia) +pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *sid) { GstElement *pipeline = purple_media_get_pipeline(media); GtkWidget *send_widget = NULL, *recv_widget = NULL; @@ -399,43 +401,43 @@ gboolean videorecvbool = FALSE; GstBus *bus; - GList *sessions = purple_media_get_session_names(media); - - for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { - PurpleMediaSessionType type = purple_media_get_session_type(media, sessions->data); - if (type & PURPLE_MEDIA_AUDIO) { - if (!audiosendbin && (type & PURPLE_MEDIA_SEND_AUDIO)) { - purple_media_audio_init_src(&audiosendbin, &audiosendlevel); - purple_media_set_src(media, sessions->data, audiosendbin); - gst_element_set_state(audiosendbin, GST_STATE_PLAYING); - } - if (!audiorecvbool && (type & PURPLE_MEDIA_RECV_AUDIO)) { - audiorecvbool = TRUE; - } - } else if (type & PURPLE_MEDIA_VIDEO) { - if (!videosendbin && (type & PURPLE_MEDIA_SEND_VIDEO)) { - purple_media_video_init_src(&videosendbin); - gst_element_set_locked_state(videosendbin, TRUE); - purple_media_set_src(media, sessions->data, videosendbin); - } - if (!videorecvbool && (type & PURPLE_MEDIA_RECV_VIDEO)) { - videorecvbool = TRUE; - } + PurpleMediaSessionType type = purple_media_get_session_type(media, sid); + if (type & PURPLE_MEDIA_AUDIO) { + if (!audiosendbin && (type & PURPLE_MEDIA_SEND_AUDIO)) { + purple_media_audio_init_src(&audiosendbin, &audiosendlevel); + purple_media_set_src(media, sid, audiosendbin); + gst_element_set_state(audiosendbin, GST_STATE_PLAYING); + } + if (!audiorecvbool && (type & PURPLE_MEDIA_RECV_AUDIO)) { + audiorecvbool = TRUE; + } + } else if (type & PURPLE_MEDIA_VIDEO) { + if (!videosendbin && (type & PURPLE_MEDIA_SEND_VIDEO)) { + purple_media_video_init_src(&videosendbin); + gst_element_set_locked_state(videosendbin, TRUE); + purple_media_set_src(media, sid, videosendbin); + } + if (!videorecvbool && (type & PURPLE_MEDIA_RECV_VIDEO)) { + videorecvbool = TRUE; } } - if (videorecvbool || audiorecvbool) { - recv_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + if (gtkmedia->priv->recv_widget == NULL + && (videorecvbool || audiorecvbool)) { + recv_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display), recv_widget, TRUE, TRUE, 0); gtk_widget_show(recv_widget); - } - if (videosendbin || audiosendbin) { + } else + recv_widget = gtkmedia->priv->recv_widget; + if (gtkmedia->priv->send_widget == NULL + && (videosendbin || audiosendbin)) { send_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display), send_widget, TRUE, TRUE, 0); gtk_widget_show(send_widget); - } + } else + send_widget = gtkmedia->priv->send_widget; if (videorecvbool) { GtkWidget *aspect; @@ -535,12 +537,11 @@ G_CALLBACK(level_message_cb), gtkmedia); gst_object_unref(bus); -} -static void -pidgin_media_wait_cb(PurpleMedia *media, PidginMedia *gtkmedia) -{ - pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_WAITING); + if (send_widget != NULL) + gtkmedia->priv->send_widget = send_widget; + if (recv_widget != NULL) + gtkmedia->priv->recv_widget = recv_widget; } static void @@ -583,6 +584,9 @@ pidgin_media_emit_message(gtkmedia, _("You have rejected the call.")); } + } else if (type == PURPLE_MEDIA_STATE_CHANGED_NEW && + sid != NULL && name != NULL) { + pidgin_media_ready_cb(media, gtkmedia, sid); } else if (type == PURPLE_MEDIA_STATE_CHANGED_CONNECTED) { GstElement *audiosendbin = NULL, *audiorecvbin = NULL; GstElement *videosendbin = NULL, *videorecvbin = NULL; @@ -630,8 +634,6 @@ g_signal_connect(G_OBJECT(media->priv->media), "error", G_CALLBACK(pidgin_media_error_cb), media); - g_signal_connect(G_OBJECT(media->priv->media) ,"ready", - G_CALLBACK(pidgin_media_ready_cb), media); g_signal_connect(G_OBJECT(media->priv->media), "got-request", G_CALLBACK(pidgin_media_got_request_cb), media); g_signal_connect(G_OBJECT(media->priv->media), "state-changed",