{
gint i;
gchar *str;
+ GstStructure *sdes;
g_mutex_init (&sess->lock);
sess->key = g_random_int ();
sess->probation = DEFAULT_PROBATION;
/* some default SDES entries */
+ sdes = gst_structure_new_empty ("application/x-rtp-source-sdes");
/* we do not want to leak details like the username or hostname here */
str = g_strdup_printf ("user%u@host-%x", g_random_int (), g_random_int ());
- rtp_source_set_sdes_string (sess->source, GST_RTCP_SDES_CNAME, str);
+ gst_structure_set (sdes, "cname", G_TYPE_STRING, str, NULL);
g_free (str);
#if 0
/* we do not want to leak the user's real name here */
str = g_strdup_printf ("Anon%u", g_random_int ());
- rtp_source_set_sdes_string (sess->source, GST_RTCP_SDES_NAME, str);
+ gst_structure_set (sdes, "name", G_TYPE_STRING, str, NULL);
g_free (str);
#endif
- rtp_source_set_sdes_string (sess->source, GST_RTCP_SDES_TOOL, "GStreamer");
+ gst_structure_set (sdes, "tool", G_TYPE_STRING, "GStreamer", NULL);
+
+ /* and configure in the source */
+ rtp_source_set_sdes_struct (sess->source, sdes);
sess->first_rtcp = TRUE;
sess->next_rtcp_check_time = GST_CLOCK_TIME_NONE;
sess = RTP_SESSION_CAST (object);
g_mutex_clear (&sess->lock);
+
for (i = 0; i < 32; i++)
g_hash_table_destroy (sess->ssrcs[i]);
}
/**
- * rtp_session_set_sdes_string:
- * @sess: an #RTPSession
- * @type: the type of the SDES item
- * @item: a null-terminated string to set.
- *
- * Store an SDES item of @type in @sess.
- *
- * Returns: %FALSE if the data was unchanged @type is invalid.
- */
-gboolean
-rtp_session_set_sdes_string (RTPSession * sess, GstRTCPSDESType type,
- const gchar * item)
-{
- gboolean result;
-
- g_return_val_if_fail (RTP_IS_SESSION (sess), FALSE);
-
- RTP_SESSION_LOCK (sess);
- result = rtp_source_set_sdes_string (sess->source, type, item);
- RTP_SESSION_UNLOCK (sess);
-
- return result;
-}
-
-/**
- * rtp_session_get_sdes_string:
- * @sess: an #RTPSession
- * @type: the type of the SDES item
- *
- * Get the SDES item of @type from @sess.
- *
- * Returns: a null-terminated copy of the SDES item or NULL when @type was not
- * valid. g_free() after usage.
- */
-gchar *
-rtp_session_get_sdes_string (RTPSession * sess, GstRTCPSDESType type)
-{
- gchar *result;
-
- g_return_val_if_fail (RTP_IS_SESSION (sess), NULL);
-
- RTP_SESSION_LOCK (sess);
- result = rtp_source_get_sdes_string (sess->source, type);
- RTP_SESSION_UNLOCK (sess);
-
- return result;
-}
-
-/**
* rtp_session_get_sdes_struct:
* @sess: an #RTSPSession
*
}
/**
- * rtp_source_set_sdes_string:
- * @src: an #RTPSource
- * @type: the type of the SDES item
- * @data: the SDES data
- *
- * Store an SDES item of @type in @src.
- *
- * Returns: %FALSE if the SDES item was unchanged or @type is unknown.
- */
-gboolean
-rtp_source_set_sdes_string (RTPSource * src, GstRTCPSDESType type,
- const gchar * data)
-{
- const gchar *old;
- const gchar *field;
-
- field = gst_rtcp_sdes_type_to_name (type);
-
- if (gst_structure_has_field (src->sdes, field))
- old = gst_structure_get_string (src->sdes, field);
- else
- old = NULL;
-
- if (old == NULL && data == NULL)
- return FALSE;
-
- if (old != NULL && data != NULL && strcmp (old, data) == 0)
- return FALSE;
-
- if (data == NULL)
- gst_structure_remove_field (src->sdes, field);
- else
- gst_structure_set (src->sdes, field, G_TYPE_STRING, data, NULL);
-
- return TRUE;
-}
-
-/**
- * rtp_source_get_sdes_string:
- * @src: an #RTPSource
- * @type: the type of the SDES item
- *
- * Get the SDES item of @type from @src.
- *
- * Returns: a null-terminated copy of the SDES item or NULL when @type was not
- * valid or the SDES item was unset. g_free() after usage.
- */
-gchar *
-rtp_source_get_sdes_string (RTPSource * src, GstRTCPSDESType type)
-{
- gchar *result;
- const gchar *type_name;
-
- g_return_val_if_fail (RTP_IS_SOURCE (src), NULL);
-
- if (type < 0 || type > GST_RTCP_SDES_PRIV - 1)
- return NULL;
-
- type_name = gst_rtcp_sdes_type_to_name (type);
-
- if (!gst_structure_has_field (src->sdes, type_name))
- return NULL;
-
- result = g_strdup (gst_structure_get_string (src->sdes, type_name));
-
- return result;
-}
-
-/**
* rtp_source_set_rtp_from:
* @src: an #RTPSource
* @address: the RTP address to set