summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gst/rtpmanager/rtpsession.c151
-rw-r--r--gst/rtpmanager/rtpsession.h3
-rw-r--r--gst/rtpmanager/rtpsource.c52
-rw-r--r--gst/rtpmanager/rtpsource.h3
4 files changed, 104 insertions, 105 deletions
diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c
index cda0418..1583cb7 100644
--- a/gst/rtpmanager/rtpsession.c
+++ b/gst/rtpmanager/rtpsession.c
@@ -49,13 +49,7 @@ enum
#define DEFAULT_BANDWIDTH RTP_STATS_BANDWIDTH
#define DEFAULT_RTCP_FRACTION RTP_STATS_RTCP_BANDWIDTH
#define DEFAULT_RTCP_MTU 1400
-#define DEFAULT_SDES_CNAME NULL
-#define DEFAULT_SDES_NAME NULL
-#define DEFAULT_SDES_EMAIL NULL
-#define DEFAULT_SDES_PHONE NULL
-#define DEFAULT_SDES_LOCATION NULL
-#define DEFAULT_SDES_TOOL NULL
-#define DEFAULT_SDES_NOTE NULL
+#define DEFAULT_SDES NULL
#define DEFAULT_NUM_SOURCES 0
#define DEFAULT_NUM_ACTIVE_SOURCES 0
#define DEFAULT_SOURCES NULL
@@ -68,13 +62,7 @@ enum
PROP_BANDWIDTH,
PROP_RTCP_FRACTION,
PROP_RTCP_MTU,
- PROP_SDES_CNAME,
- PROP_SDES_NAME,
- PROP_SDES_EMAIL,
- PROP_SDES_PHONE,
- PROP_SDES_LOCATION,
- PROP_SDES_TOOL,
- PROP_SDES_NOTE,
+ PROP_SDES,
PROP_NUM_SOURCES,
PROP_NUM_ACTIVE_SOURCES,
PROP_SOURCES,
@@ -273,40 +261,10 @@ rtp_session_class_init (RTPSessionClass * klass)
16, G_MAXINT16, DEFAULT_RTCP_MTU,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_SDES_CNAME,
- g_param_spec_string ("sdes-cname", "SDES CNAME",
- "The CNAME to put in SDES messages of this session",
- DEFAULT_SDES_CNAME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SDES_NAME,
- g_param_spec_string ("sdes-name", "SDES NAME",
- "The NAME to put in SDES messages of this session",
- DEFAULT_SDES_NAME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SDES_EMAIL,
- g_param_spec_string ("sdes-email", "SDES EMAIL",
- "The EMAIL to put in SDES messages of this session",
- DEFAULT_SDES_EMAIL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SDES_PHONE,
- g_param_spec_string ("sdes-phone", "SDES PHONE",
- "The PHONE to put in SDES messages of this session",
- DEFAULT_SDES_PHONE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SDES_LOCATION,
- g_param_spec_string ("sdes-location", "SDES LOCATION",
- "The LOCATION to put in SDES messages of this session",
- DEFAULT_SDES_LOCATION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SDES_TOOL,
- g_param_spec_string ("sdes-tool", "SDES TOOL",
- "The TOOL to put in SDES messages of this session",
- DEFAULT_SDES_TOOL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SDES_NOTE,
- g_param_spec_string ("sdes-note", "SDES NOTE",
- "The NOTE to put in SDES messages of this session",
- DEFAULT_SDES_NOTE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, PROP_SDES,
+ g_param_spec_boxed ("sdes", "SDES",
+ "The SDES items of this session",
+ GST_TYPE_STRUCTURE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_NUM_SOURCES,
g_param_spec_uint ("num-sources", "Num Sources",
@@ -469,33 +427,8 @@ rtp_session_set_property (GObject * object, guint prop_id,
case PROP_RTCP_MTU:
sess->mtu = g_value_get_uint (value);
break;
- case PROP_SDES_CNAME:
- rtp_session_set_sdes_string (sess, GST_RTCP_SDES_CNAME,
- g_value_get_string (value));
- break;
- case PROP_SDES_NAME:
- rtp_session_set_sdes_string (sess, GST_RTCP_SDES_NAME,
- g_value_get_string (value));
- break;
- case PROP_SDES_EMAIL:
- rtp_session_set_sdes_string (sess, GST_RTCP_SDES_EMAIL,
- g_value_get_string (value));
- break;
- case PROP_SDES_PHONE:
- rtp_session_set_sdes_string (sess, GST_RTCP_SDES_PHONE,
- g_value_get_string (value));
- break;
- case PROP_SDES_LOCATION:
- rtp_session_set_sdes_string (sess, GST_RTCP_SDES_LOC,
- g_value_get_string (value));
- break;
- case PROP_SDES_TOOL:
- rtp_session_set_sdes_string (sess, GST_RTCP_SDES_TOOL,
- g_value_get_string (value));
- break;
- case PROP_SDES_NOTE:
- rtp_session_set_sdes_string (sess, GST_RTCP_SDES_NOTE,
- g_value_get_string (value));
+ case PROP_SDES:
+ rtp_session_set_sdes_struct (sess, g_value_get_boxed (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -527,33 +460,8 @@ rtp_session_get_property (GObject * object, guint prop_id,
case PROP_RTCP_MTU:
g_value_set_uint (value, sess->mtu);
break;
- case PROP_SDES_CNAME:
- g_value_take_string (value, rtp_session_get_sdes_string (sess,
- GST_RTCP_SDES_CNAME));
- break;
- case PROP_SDES_NAME:
- g_value_take_string (value, rtp_session_get_sdes_string (sess,
- GST_RTCP_SDES_NAME));
- break;
- case PROP_SDES_EMAIL:
- g_value_take_string (value, rtp_session_get_sdes_string (sess,
- GST_RTCP_SDES_EMAIL));
- break;
- case PROP_SDES_PHONE:
- g_value_take_string (value, rtp_session_get_sdes_string (sess,
- GST_RTCP_SDES_PHONE));
- break;
- case PROP_SDES_LOCATION:
- g_value_take_string (value, rtp_session_get_sdes_string (sess,
- GST_RTCP_SDES_LOC));
- break;
- case PROP_SDES_TOOL:
- g_value_take_string (value, rtp_session_get_sdes_string (sess,
- GST_RTCP_SDES_TOOL));
- break;
- case PROP_SDES_NOTE:
- g_value_take_string (value, rtp_session_get_sdes_string (sess,
- GST_RTCP_SDES_NOTE));
+ case PROP_SDES:
+ g_value_take_boxed (value, rtp_session_get_sdes_struct (sess));
break;
case PROP_NUM_SOURCES:
g_value_set_uint (value, rtp_session_get_num_sources (sess));
@@ -957,6 +865,45 @@ rtp_session_get_sdes_string (RTPSession * sess, GstRTCPSDESType type)
return result;
}
+/**
+ * rtp_session_get_sdes_struct:
+ * @sess: an #RTSPSession
+ *
+ * Get the SDES data as a #GstStructure
+ *
+ * Returns: a GstStructure with SDES items for @sess.
+ */
+GstStructure *
+rtp_session_get_sdes_struct (RTPSession * sess)
+{
+ GstStructure *result;
+
+ g_return_val_if_fail (RTP_IS_SESSION (sess), NULL);
+
+ RTP_SESSION_LOCK (sess);
+ result = rtp_source_get_sdes_struct (sess->source);
+ RTP_SESSION_UNLOCK (sess);
+
+ return result;
+}
+
+/**
+ * rtp_session_set_sdes_struct:
+ * @sess: an #RTSPSession
+ * @sdes: a #GstStructure
+ *
+ * Set the SDES data as a #GstStructure.
+ */
+void
+rtp_session_set_sdes_struct (RTPSession * sess, const GstStructure * sdes)
+{
+ g_return_if_fail (RTP_IS_SESSION (sess));
+
+ RTP_SESSION_LOCK (sess);
+ rtp_source_set_sdes_struct (sess->source, sdes);
+ RTP_SESSION_UNLOCK (sess);
+}
+
static GstFlowReturn
source_push_rtp (RTPSource * source, gpointer data, RTPSession * session)
{
diff --git a/gst/rtpmanager/rtpsession.h b/gst/rtpmanager/rtpsession.h
index 6312f1c..25e228b 100644
--- a/gst/rtpmanager/rtpsession.h
+++ b/gst/rtpmanager/rtpsession.h
@@ -267,6 +267,9 @@ gboolean rtp_session_set_sdes_string (RTPSession *sess, GstRTCPSDE
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);
+
/* handling sources */
RTPSource* rtp_session_get_internal_source (RTPSession *sess);
diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c
index 209c17b..4d7c468 100644
--- a/gst/rtpmanager/rtpsource.c
+++ b/gst/rtpmanager/rtpsource.c
@@ -316,8 +316,16 @@ rtp_source_create_stats (RTPSource * src)
return s;
}
-static GstStructure *
-rtp_source_create_sdes (RTPSource * src)
+/**
+ * rtp_source_get_sdes_struct:
+ * @src: an #RTSPSource
+ *
+ * Get the SDES data as a GstStructure
+ *
+ * Returns: a GstStructure with SDES items for @src.
+ */
+GstStructure *
+rtp_source_get_sdes_struct (RTPSource * src)
{
GstStructure *s;
gchar *str;
@@ -356,6 +364,44 @@ rtp_source_create_sdes (RTPSource * src)
return s;
}
+/**
+ * rtp_source_set_sdes_struct:
+ * @src: an #RTSPSource
+ * @sdes: a #GstStructure with SDES info
+ *
+ * Set the SDES items from @sdes.
+ */
+void
+rtp_source_set_sdes_struct (RTPSource * src, const GstStructure * sdes)
+{
+ const gchar *str;
+
+ if (!gst_structure_has_name (sdes, "application/x-rtp-source-sdes"))
+ return;
+
+ if ((str = gst_structure_get_string (sdes, "cname"))) {
+ rtp_source_set_sdes_string (src, GST_RTCP_SDES_CNAME, str);
+ }
+ if ((str = gst_structure_get_string (sdes, "name"))) {
+ rtp_source_set_sdes_string (src, GST_RTCP_SDES_NAME, str);
+ }
+ if ((str = gst_structure_get_string (sdes, "email"))) {
+ rtp_source_set_sdes_string (src, GST_RTCP_SDES_EMAIL, str);
+ }
+ if ((str = gst_structure_get_string (sdes, "phone"))) {
+ rtp_source_set_sdes_string (src, GST_RTCP_SDES_PHONE, str);
+ }
+ if ((str = gst_structure_get_string (sdes, "location"))) {
+ rtp_source_set_sdes_string (src, GST_RTCP_SDES_LOC, str);
+ }
+ if ((str = gst_structure_get_string (sdes, "tool"))) {
+ rtp_source_set_sdes_string (src, GST_RTCP_SDES_TOOL, str);
+ }
+ if ((str = gst_structure_get_string (sdes, "note"))) {
+ rtp_source_set_sdes_string (src, GST_RTCP_SDES_NOTE, str);
+ }
+}
+
static void
rtp_source_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
@@ -396,7 +442,7 @@ rtp_source_get_property (GObject * object, guint prop_id,
g_value_set_boolean (value, rtp_source_is_sender (src));
break;
case PROP_SDES:
- g_value_take_boxed (value, rtp_source_create_sdes (src));
+ g_value_take_boxed (value, rtp_source_get_sdes_struct (src));
break;
case PROP_STATS:
g_value_take_boxed (value, rtp_source_create_stats (src));
diff --git a/gst/rtpmanager/rtpsource.h b/gst/rtpmanager/rtpsource.h
index 8286f2e..8355bc0 100644
--- a/gst/rtpmanager/rtpsource.h
+++ b/gst/rtpmanager/rtpsource.h
@@ -187,6 +187,9 @@ gboolean rtp_source_get_sdes (RTPSource *src, GstRTCPSDESType
guint8 **data, guint *len);
gchar* rtp_source_get_sdes_string (RTPSource *src, GstRTCPSDESType type);
+GstStructure * rtp_source_get_sdes_struct (RTPSource * src);
+void rtp_source_set_sdes_struct (RTPSource * src, const GstStructure *sdes);
+
/* handling network address */
void rtp_source_set_rtp_from (RTPSource *src, GstNetAddress *address);
void rtp_source_set_rtcp_from (RTPSource *src, GstNetAddress *address);