libpurple/protocols/jabber/jingle/rtp.c

branch
soc.2013.gobjectification
changeset 35076
cadfc3f9a7cc
parent 35061
307195f879f3
child 35083
3b6577fd64ee
child 36958
2ab9fcc7ca7c
equal deleted inserted replaced
35075:3a3c90a0ec07 35076:cadfc3f9a7cc
20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 */ 23 */
24 24
25 #include "config.h" 25 #include "internal.h"
26 #include "glibcompat.h"
26 27
27 #ifdef USE_VV 28 #ifdef USE_VV
28 29
29 #include "jabber.h" 30 #include "jabber.h"
30 #include "jingle.h" 31 #include "jingle.h"
56 static PurpleXmlNode *jingle_rtp_to_xml_internal(JingleContent *rtp, PurpleXmlNode *content, JingleActionType action); 57 static PurpleXmlNode *jingle_rtp_to_xml_internal(JingleContent *rtp, PurpleXmlNode *content, JingleActionType action);
57 static void jingle_rtp_handle_action_internal(JingleContent *content, PurpleXmlNode *jingle, JingleActionType action); 58 static void jingle_rtp_handle_action_internal(JingleContent *content, PurpleXmlNode *jingle, JingleActionType action);
58 59
59 static PurpleMedia *jingle_rtp_get_media(JingleSession *session); 60 static PurpleMedia *jingle_rtp_get_media(JingleSession *session);
60 61
61 static JingleContentClass *parent_class = NULL;
62 #if 0 62 #if 0
63 enum { 63 enum {
64 LAST_SIGNAL 64 LAST_SIGNAL
65 }; 65 };
66 static guint jingle_rtp_signals[LAST_SIGNAL] = {0}; 66 static guint jingle_rtp_signals[LAST_SIGNAL] = {0};
68 68
69 enum { 69 enum {
70 PROP_0, 70 PROP_0,
71 PROP_MEDIA_TYPE, 71 PROP_MEDIA_TYPE,
72 PROP_SSRC, 72 PROP_SSRC,
73 PROP_LAST
73 }; 74 };
75
76 static JingleContentClass *parent_class = NULL;
77 static GParamSpec *properties[PROP_LAST];
74 78
75 GType 79 GType
76 jingle_rtp_get_type() 80 jingle_rtp_get_type()
77 { 81 {
78 static GType type = 0; 82 static GType type = 0;
107 klass->parent_class.to_xml = jingle_rtp_to_xml_internal; 111 klass->parent_class.to_xml = jingle_rtp_to_xml_internal;
108 klass->parent_class.parse = jingle_rtp_parse_internal; 112 klass->parent_class.parse = jingle_rtp_parse_internal;
109 klass->parent_class.description_type = JINGLE_APP_RTP; 113 klass->parent_class.description_type = JINGLE_APP_RTP;
110 klass->parent_class.handle_action = jingle_rtp_handle_action_internal; 114 klass->parent_class.handle_action = jingle_rtp_handle_action_internal;
111 115
112 g_object_class_install_property(gobject_class, PROP_MEDIA_TYPE, 116 properties[PROP_MEDIA_TYPE] = g_param_spec_string("media-type",
113 g_param_spec_string("media-type",
114 "Media Type", 117 "Media Type",
115 "The media type (\"audio\" or \"video\") for this rtp session.", 118 "The media type (\"audio\" or \"video\") for this rtp session.",
116 NULL, 119 NULL,
117 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 120 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
118 g_object_class_install_property(gobject_class, PROP_SSRC, 121 g_object_class_install_property(gobject_class, PROP_MEDIA_TYPE,
119 g_param_spec_string("ssrc", 122 properties[PROP_MEDIA_TYPE]);
123
124 properties[PROP_SSRC] = g_param_spec_string("ssrc",
120 "ssrc", 125 "ssrc",
121 "The ssrc for this rtp session.", 126 "The ssrc for this rtp session.",
122 NULL, 127 NULL,
123 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 128 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
129 g_object_class_install_property(gobject_class, PROP_SSRC,
130 properties[PROP_SSRC]);
124 131
125 g_type_class_add_private(klass, sizeof(JingleRtpPrivate)); 132 g_type_class_add_private(klass, sizeof(JingleRtpPrivate));
126 } 133 }
127 134
128 static void 135 static void
880 content = jingle_content_create(JINGLE_APP_RTP, "initiator", 887 content = jingle_content_create(JINGLE_APP_RTP, "initiator",
881 "session", "audio-session", "both", transport); 888 "session", "audio-session", "both", transport);
882 jingle_session_add_content(session, content); 889 jingle_session_add_content(session, content);
883 JINGLE_RTP(content)->priv->media_type = g_strdup("audio"); 890 JINGLE_RTP(content)->priv->media_type = g_strdup("audio");
884 jingle_rtp_init_media(content); 891 jingle_rtp_init_media(content);
885 g_object_notify(G_OBJECT(content), "media-type"); 892 g_object_notify_by_pspec(G_OBJECT(content), properties[PROP_MEDIA_TYPE]);
886 } 893 }
887 if (type & PURPLE_MEDIA_VIDEO) { 894 if (type & PURPLE_MEDIA_VIDEO) {
888 transport = jingle_transport_create(transport_type); 895 transport = jingle_transport_create(transport_type);
889 content = jingle_content_create(JINGLE_APP_RTP, "initiator", 896 content = jingle_content_create(JINGLE_APP_RTP, "initiator",
890 "session", "video-session", "both", transport); 897 "session", "video-session", "both", transport);
891 jingle_session_add_content(session, content); 898 jingle_session_add_content(session, content);
892 JINGLE_RTP(content)->priv->media_type = g_strdup("video"); 899 JINGLE_RTP(content)->priv->media_type = g_strdup("video");
893 jingle_rtp_init_media(content); 900 jingle_rtp_init_media(content);
894 g_object_notify(G_OBJECT(content), "media-type"); 901 g_object_notify_by_pspec(G_OBJECT(content), properties[PROP_MEDIA_TYPE]);
895 } 902 }
896 903
897 g_free(me); 904 g_free(me);
898 905
899 if (jingle_rtp_get_media(session) == NULL) { 906 if (jingle_rtp_get_media(session) == NULL) {

mercurial