static void menu_hangup(GtkAction *action, gpointer data) { PidginMedia *gtkmedia = PIDGIN_MEDIA(data); purple_media_stream_info(gtkmedia->priv->media, PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); }
static void pidgin_media_pause_toggled(GtkToggleButton *toggle, PidginMedia *media) { purple_media_stream_info(media->priv->media, gtk_toggle_button_get_active(toggle) ? PURPLE_MEDIA_INFO_PAUSE : PURPLE_MEDIA_INFO_UNPAUSE, NULL, NULL, TRUE); }
static gboolean pidgin_media_delete_event_cb(GtkWidget *widget, GdkEvent *event, PidginMedia *media) { if (media->priv->media) purple_media_stream_info(media->priv->media, PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); return FALSE; }
static void minbif_media_reject_cb(PurpleMedia *media, int index) { purple_media_stream_info(media, PURPLE_MEDIA_INFO_REJECT, NULL, NULL, TRUE); }
static void minbif_media_accept_cb(PurpleMedia *media, int index) { purple_media_stream_info(media, PURPLE_MEDIA_INFO_ACCEPT, NULL, NULL, TRUE); }
static void google_session_handle_accept(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) { xmlnode *desc_element = xmlnode_get_child(sess, "description"); xmlnode *codec_element = xmlnode_get_child( desc_element, "payload-type"); GList *codecs = NULL, *video_codecs = NULL; JabberIq *result = NULL; const gchar *xmlns = xmlnode_get_namespace(desc_element); gboolean video = (xmlns && !strcmp(xmlns, NS_GOOGLE_SESSION_VIDEO)); GoogleAVSessionData *session_data = (GoogleAVSessionData *) session->session_data; for (; codec_element; codec_element = codec_element->next) { const gchar *xmlns, *encoding_name, *id, *clock_rate, *width, *height, *framerate; gboolean video_codec = FALSE; if (!purple_strequal(codec_element->name, "payload-type")) continue; xmlns = xmlnode_get_namespace(codec_element); encoding_name = xmlnode_get_attrib(codec_element, "name"); id = xmlnode_get_attrib(codec_element, "id"); if (!video || purple_strequal(xmlns, NS_GOOGLE_SESSION_PHONE)) clock_rate = xmlnode_get_attrib( codec_element, "clockrate"); else { clock_rate = "90000"; width = xmlnode_get_attrib(codec_element, "width"); height = xmlnode_get_attrib(codec_element, "height"); framerate = xmlnode_get_attrib( codec_element, "framerate"); video_codec = TRUE; } if (id && encoding_name) { PurpleMediaCodec *codec = purple_media_codec_new( atoi(id), encoding_name, video_codec ? PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_AUDIO, clock_rate ? atoi(clock_rate) : 0); if (video_codec) video_codecs = g_list_append( video_codecs, codec); else codecs = g_list_append(codecs, codec); } } if (codecs) purple_media_set_remote_codecs(session_data->media, "google-voice", session->remote_jid, codecs); if (video_codecs) purple_media_set_remote_codecs(session_data->media, "google-video", session->remote_jid, video_codecs); purple_media_stream_info(session_data->media, PURPLE_MEDIA_INFO_ACCEPT, NULL, NULL, FALSE); result = jabber_iq_new(js, JABBER_IQ_RESULT); jabber_iq_set_id(result, iq_id); xmlnode_set_attrib(result->node, "to", session->remote_jid); jabber_iq_send(result); }
static void jabber_google_relay_response_session_handle_initiate_cb(GoogleSession *session, const gchar *relay_ip, guint relay_udp, guint relay_tcp, guint relay_ssltcp, const gchar *relay_username, const gchar *relay_password) { GParameter *params; guint num_params; JabberStream *js = session->js; xmlnode *codec_element; const gchar *xmlns; PurpleMediaCodec *codec; GList *video_codecs = NULL; GList *codecs = NULL; JabberIq *result; GoogleAVSessionData *session_data = (GoogleAVSessionData *) session->session_data; params = jabber_google_session_get_params(js, relay_ip, relay_udp, relay_tcp, relay_ssltcp, relay_username, relay_password, &num_params); if (purple_media_add_stream(session_data->media, "google-voice", session->remote_jid, PURPLE_MEDIA_AUDIO, FALSE, "nice", num_params, params) == FALSE || (session_data->video && purple_media_add_stream( session_data->media, "google-video", session->remote_jid, PURPLE_MEDIA_VIDEO, FALSE, "nice", num_params, params) == FALSE)) { purple_media_error(session_data->media, "Error adding stream."); purple_media_stream_info(session_data->media, PURPLE_MEDIA_INFO_REJECT, NULL, NULL, TRUE); } else { /* successfully added stream(s) */ session_data->added_streams = TRUE; if (session_data->remote_audio_candidates) { purple_media_add_remote_candidates(session_data->media, "google-voice", session->remote_jid, session_data->remote_audio_candidates); purple_media_candidate_list_free(session_data->remote_audio_candidates); session_data->remote_audio_candidates = NULL; } if (session_data->remote_video_candidates) { purple_media_add_remote_candidates(session_data->media, "google-video", session->remote_jid, session_data->remote_video_candidates); purple_media_candidate_list_free(session_data->remote_video_candidates); session_data->remote_video_candidates = NULL; } } g_free(params); for (codec_element = xmlnode_get_child(session->description, "payload-type"); codec_element; codec_element = codec_element->next) { const char *id, *encoding_name, *clock_rate, *width, *height, *framerate; gboolean video; if (codec_element->name && strcmp(codec_element->name, "payload-type")) continue; xmlns = xmlnode_get_namespace(codec_element); encoding_name = xmlnode_get_attrib(codec_element, "name"); id = xmlnode_get_attrib(codec_element, "id"); if (!session_data->video || (xmlns && !strcmp(xmlns, NS_GOOGLE_SESSION_PHONE))) { clock_rate = xmlnode_get_attrib( codec_element, "clockrate"); video = FALSE; } else { width = xmlnode_get_attrib(codec_element, "width"); height = xmlnode_get_attrib(codec_element, "height"); framerate = xmlnode_get_attrib( codec_element, "framerate"); clock_rate = "90000"; video = TRUE; } if (id) { codec = purple_media_codec_new(atoi(id), encoding_name, video ? PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_AUDIO, clock_rate ? atoi(clock_rate) : 0); if (video) video_codecs = g_list_append( video_codecs, codec); else codecs = g_list_append(codecs, codec); } } if (codecs) purple_media_set_remote_codecs(session_data->media, "google-voice", session->remote_jid, codecs); if (video_codecs) purple_media_set_remote_codecs(session_data->media, "google-video", session->remote_jid, video_codecs); purple_media_codec_list_free(codecs); purple_media_codec_list_free(video_codecs); result = jabber_iq_new(js, JABBER_IQ_RESULT); jabber_iq_set_id(result, session->iq_id); xmlnode_set_attrib(result->node, "to", session->remote_jid); jabber_iq_send(result); }