pidgin.vv: e8e5a8ac: Add ssrc property to JingleRtp.

maiku at soc.pidgin.im maiku at soc.pidgin.im
Tue Mar 17 06:21:03 EDT 2009


-----------------------------------------------------------------
Revision: e8e5a8ac092e6f2aaf811669c16114a9e7cb69a1
Ancestor: 35d58b1fc34550022acd6be280ab6ce5a2614975
Author: maiku at soc.pidgin.im
Date: 2009-03-17T10:11:18
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/e8e5a8ac092e6f2aaf811669c16114a9e7cb69a1

Modified files:
        libpurple/protocols/jabber/jingle/rtp.c
        libpurple/protocols/jabber/jingle/rtp.h

ChangeLog: 

Add ssrc property to JingleRtp.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/rtp.c	0d00b133968013ba6a75d480b7010fc1e9864838
+++ libpurple/protocols/jabber/jingle/rtp.c	3716601e56d154c708f0abc247cfc317b987e1c9
@@ -37,6 +37,7 @@ struct _JingleRtpPrivate
 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 {
 enum {
 	PROP_0,
 	PROP_MEDIA_TYPE,
+	PROP_SSRC,
 };
 
 GType
@@ -108,6 +110,13 @@ jingle_rtp_class_init (JingleRtpClass *k
 			"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)
 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 @@ jingle_rtp_finalize (GObject *rtp)
 	purple_debug_info("jingle-rtp","jingle_rtp_finalize\n");
 
 	g_free(priv->media_type);
+	g_free(priv->ssrc);
 }
 
 static void
@@ -140,6 +150,10 @@ jingle_rtp_set_property (GObject *object
 			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 @@ jingle_rtp_get_property (GObject *object
 		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 @@ jingle_rtp_get_media_type(JingleContent 
 	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 @@ jingle_rtp_parse_internal(xmlnode *rtp)
 	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 @@ jingle_rtp_to_xml_internal(JingleContent
 		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);
============================================================
--- libpurple/protocols/jabber/jingle/rtp.h	8e904fcae062e4b3b31106b4795569fa92d9e46d
+++ libpurple/protocols/jabber/jingle/rtp.h	941805ea7771bc315daae4a39dc9c685647b373b
@@ -73,6 +73,7 @@ gchar *jingle_rtp_get_media_type(JingleC
 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,


More information about the Commits mailing list