mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-24 08:08:22 +00:00
session: configure sdes with structure only
Remove code to configure the SDES with methods and types, only allow configuration with GstStructure
This commit is contained in:
parent
0060e1d45d
commit
ddd071e54c
4 changed files with 9 additions and 128 deletions
|
@ -460,6 +460,7 @@ rtp_session_init (RTPSession * sess)
|
|||
{
|
||||
gint i;
|
||||
gchar *str;
|
||||
GstStructure *sdes;
|
||||
|
||||
g_mutex_init (&sess->lock);
|
||||
sess->key = g_random_int ();
|
||||
|
@ -499,20 +500,24 @@ rtp_session_init (RTPSession * sess)
|
|||
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;
|
||||
|
@ -537,6 +542,7 @@ rtp_session_finalize (GObject * object)
|
|||
sess = RTP_SESSION_CAST (object);
|
||||
|
||||
g_mutex_clear (&sess->lock);
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
g_hash_table_destroy (sess->ssrcs[i]);
|
||||
|
||||
|
@ -1070,55 +1076,6 @@ rtp_session_get_rtcp_fraction (RTPSession * sess)
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -301,10 +301,6 @@ gdouble rtp_session_get_bandwidth (RTPSession *sess);
|
|||
void rtp_session_set_rtcp_fraction (RTPSession *sess, gdouble fraction);
|
||||
gdouble rtp_session_get_rtcp_fraction (RTPSession *sess);
|
||||
|
||||
gboolean rtp_session_set_sdes_string (RTPSession *sess, GstRTCPSDESType type,
|
||||
const gchar *cname);
|
||||
gchar* rtp_session_get_sdes_string (RTPSession *sess, GstRTCPSDESType type);
|
||||
|
||||
GstStructure * rtp_session_get_sdes_struct (RTPSession *sess);
|
||||
void rtp_session_set_sdes_struct (RTPSession *sess, const GstStructure *sdes);
|
||||
|
||||
|
|
|
@ -755,75 +755,6 @@ rtp_source_update_caps (RTPSource * src, GstCaps * caps)
|
|||
gst_caps_replace (&src->caps, caps);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -205,9 +205,6 @@ gchar * rtp_source_get_bye_reason (RTPSource *src);
|
|||
void rtp_source_update_caps (RTPSource *src, GstCaps *caps);
|
||||
|
||||
/* SDES info */
|
||||
gboolean rtp_source_set_sdes_string (RTPSource *src, GstRTCPSDESType type,
|
||||
const gchar *data);
|
||||
gchar* rtp_source_get_sdes_string (RTPSource *src, GstRTCPSDESType type);
|
||||
const GstStructure *
|
||||
rtp_source_get_sdes_struct (RTPSource * src);
|
||||
gboolean rtp_source_set_sdes_struct (RTPSource * src, GstStructure *sdes);
|
||||
|
|
Loading…
Reference in a new issue