Mercurial > pidgin
changeset 26285:b1c4fcc5b814
Add ssrc property to JingleRtp.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Tue, 17 Mar 2009 10:11:18 +0000 |
parents | 4f47eeaa1414 |
children | d8a7c7d9ac8a |
files | libpurple/protocols/jabber/jingle/rtp.c libpurple/protocols/jabber/jingle/rtp.h |
diffstat | 2 files changed, 34 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/rtp.c Tue Mar 17 04:40:25 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/rtp.c Tue Mar 17 10:11:18 2009 +0000 @@ -37,6 +37,7 @@ struct _JingleRtpPrivate { gchar *media_type; + gchar *ssrc; }; #define JINGLE_RTP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_RTP, JingleRtpPrivate)) @@ -63,6 +64,7 @@ enum { PROP_0, PROP_MEDIA_TYPE, + PROP_SSRC, }; GType @@ -108,6 +110,13 @@ "The media type (\"audio\" or \"video\") for this rtp session.", NULL, G_PARAM_READWRITE)); + g_object_class_install_property(gobject_class, PROP_SSRC, + g_param_spec_string("ssrc", + "ssrc", + "The ssrc for this rtp session.", + NULL, + G_PARAM_READWRITE)); + g_type_class_add_private(klass, sizeof(JingleRtpPrivate)); } @@ -115,7 +124,7 @@ jingle_rtp_init (JingleRtp *rtp) { rtp->priv = JINGLE_RTP_GET_PRIVATE(rtp); - memset(rtp->priv, 0, sizeof(rtp->priv)); + memset(rtp->priv, 0, sizeof(*rtp->priv)); } static void @@ -125,6 +134,7 @@ purple_debug_info("jingle-rtp","jingle_rtp_finalize\n"); g_free(priv->media_type); + g_free(priv->ssrc); } static void @@ -140,6 +150,10 @@ g_free(rtp->priv->media_type); rtp->priv->media_type = g_value_dup_string(value); break; + case PROP_SSRC: + g_free(rtp->priv->ssrc); + rtp->priv->ssrc = g_value_dup_string(value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -158,6 +172,9 @@ case PROP_MEDIA_TYPE: g_value_set_string(value, rtp->priv->media_type); break; + case PROP_SSRC: + g_value_set_string(value, rtp->priv->ssrc); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -172,6 +189,14 @@ return media_type; } +gchar * +jingle_rtp_get_ssrc(JingleContent *content) +{ + gchar *ssrc; + g_object_get(content, "ssrc", &ssrc, NULL); + return ssrc; +} + static PurpleMedia * jingle_rtp_get_media(JingleSession *session) { @@ -525,8 +550,11 @@ JingleContent *content = parent_class->parse(rtp); xmlnode *description = xmlnode_get_child(rtp, "description"); const gchar *media_type = xmlnode_get_attrib(description, "media"); + const gchar *ssrc = xmlnode_get_attrib(description, "ssrc"); purple_debug_info("jingle-rtp", "rtp parse\n"); g_object_set(content, "media-type", media_type, NULL); + if (ssrc != NULL) + g_object_set(content, "ssrc", ssrc, NULL); return content; } @@ -571,11 +599,15 @@ JingleSession *session = jingle_content_get_session(rtp); PurpleMedia *media = jingle_rtp_get_media(session); gchar *media_type = jingle_rtp_get_media_type(rtp); + gchar *ssrc = jingle_rtp_get_ssrc(rtp); gchar *name = jingle_content_get_name(rtp); GList *codecs = purple_media_get_codecs(media, name); xmlnode_set_attrib(description, "media", media_type); + if (ssrc != NULL) + xmlnode_set_attrib(description, "ssrc", ssrc); + g_free(media_type); g_free(name); g_object_unref(session);
--- a/libpurple/protocols/jabber/jingle/rtp.h Tue Mar 17 04:40:25 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/rtp.h Tue Mar 17 10:11:18 2009 +0000 @@ -73,6 +73,7 @@ GType jingle_rtp_get_type(void); gchar *jingle_rtp_get_media_type(JingleContent *content); +gchar *jingle_rtp_get_ssrc(JingleContent *content); PurpleMedia *jingle_rtp_initiate_media(JabberStream *js, const gchar *who,