summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-12-10 18:36:04 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-12-10 18:36:04 +0000
commit8b973428f3f1b2df938ea4a2f5786b3ff5f1e925 (patch)
tree4e953bb6e85aa3633c82f884c153332885e25098 /gst
parent5c1c4a4477f4177c84435b225ce161798ffc21f9 (diff)
downloadgst-plugins-bad-8b973428f3f1b2df938ea4a2f5786b3ff5f1e925.tar.gz
gst-plugins-bad-8b973428f3f1b2df938ea4a2f5786b3ff5f1e925.tar.bz2
gst-plugins-bad-8b973428f3f1b2df938ea4a2f5786b3ff5f1e925.zip
gst/rtpmanager/: Post a message when the SDES infor changes for a source.
Original commit message from CVS: * gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_class_init), (gst_rtp_bin_handle_message): * gst/rtpmanager/gstrtpsession.c: (source_get_sdes_structure), (on_ssrc_sdes): Post a message when the SDES infor changes for a source. * gst/rtpmanager/rtpsession.c: * gst/rtpmanager/rtpsource.c: Update some comments.
Diffstat (limited to 'gst')
-rw-r--r--gst/rtpmanager/gstrtpbin.c49
-rw-r--r--gst/rtpmanager/gstrtpsession.c66
-rw-r--r--gst/rtpmanager/rtpsession.c2
-rw-r--r--gst/rtpmanager/rtpsource.c4
4 files changed, 118 insertions, 3 deletions
diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c
index 9e642dff..9277a8b1 100644
--- a/gst/rtpmanager/gstrtpbin.c
+++ b/gst/rtpmanager/gstrtpbin.c
@@ -1021,6 +1021,7 @@ static GstStateChangeReturn gst_rtp_bin_change_state (GstElement * element,
static GstPad *gst_rtp_bin_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name);
static void gst_rtp_bin_release_pad (GstElement * element, GstPad * pad);
+static void gst_rtp_bin_handle_message (GstBin * bin, GstMessage * message);
static void gst_rtp_bin_clear_pt_map (GstRtpBin * bin);
GST_BOILERPLATE (GstRtpBin, gst_rtp_bin, GstBin, GST_TYPE_BIN);
@@ -1054,9 +1055,11 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
+ GstBinClass *gstbin_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
+ gstbin_class = (GstBinClass *) klass;
g_type_class_add_private (klass, sizeof (GstRtpBinPrivate));
@@ -1244,6 +1247,8 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
GST_DEBUG_FUNCPTR (gst_rtp_bin_request_new_pad);
gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_rtp_bin_release_pad);
+ gstbin_class->handle_message = GST_DEBUG_FUNCPTR (gst_rtp_bin_handle_message);
+
klass->clear_pt_map = GST_DEBUG_FUNCPTR (gst_rtp_bin_clear_pt_map);
GST_DEBUG_CATEGORY_INIT (gst_rtp_bin_debug, "rtpbin", 0, "RTP bin");
@@ -1471,6 +1476,50 @@ gst_rtp_bin_provide_clock (GstElement * element)
}
static void
+gst_rtp_bin_handle_message (GstBin * bin, GstMessage * message)
+{
+ GstRtpBin *rtpbin;
+
+ rtpbin = GST_RTP_BIN (bin);
+
+ switch (GST_MESSAGE_TYPE (message)) {
+ case GST_MESSAGE_ELEMENT:
+ {
+ const GstStructure *s = gst_message_get_structure (message);
+
+ /* we change the structure name and add the session ID to it */
+ if (gst_structure_has_name (s, "GstRTPSessionSDES")) {
+ GSList *walk;
+
+ /* find the session, the message source has it */
+ for (walk = rtpbin->sessions; walk; walk = g_slist_next (walk)) {
+ GstRtpBinSession *sess = (GstRtpBinSession *) walk->data;
+
+ /* if we found the session, change message. else we exit the loop and
+ * leave the message unchanged */
+ if (GST_OBJECT_CAST (sess->session) == GST_MESSAGE_SRC (message)) {
+ message = gst_message_make_writable (message);
+ s = gst_message_get_structure (message);
+
+ gst_structure_set_name ((GstStructure *) s, "GstRTPBinSDES");
+
+ gst_structure_set ((GstStructure *) s, "session", G_TYPE_UINT,
+ sess->id, NULL);
+ break;
+ }
+ }
+ }
+ /* fallthrough to forward the modified message to the parent */
+ }
+ default:
+ {
+ GST_BIN_CLASS (parent_class)->handle_message (bin, message);
+ break;
+ }
+ }
+}
+
+static void
calc_ntp_ns_base (GstRtpBin * bin)
{
GstClockTime now;
diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c
index 456f3abc..cfeec262 100644
--- a/gst/rtpmanager/gstrtpsession.c
+++ b/gst/rtpmanager/gstrtpsession.c
@@ -338,9 +338,75 @@ on_ssrc_active (RTPSession * session, RTPSource * src, GstRtpSession * sess)
src->ssrc);
}
+static GstStructure *
+source_get_sdes_structure (RTPSource * src)
+{
+ GstStructure *result;
+ GValue val = { 0 };
+ gchar *str;
+
+ result = gst_structure_empty_new ("GstRTPSessionSDES");
+
+ gst_structure_set (result, "ssrc", G_TYPE_UINT, src->ssrc, NULL);
+
+ g_value_init (&val, G_TYPE_STRING);
+ str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_CNAME);
+ if (str) {
+ g_value_take_string (&val, str);
+ gst_structure_set_value (result, "cname", &val);
+ }
+ str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_NAME);
+ if (str) {
+ g_value_take_string (&val, str);
+ gst_structure_set_value (result, "name", &val);
+ }
+ str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_EMAIL);
+ if (str) {
+ g_value_take_string (&val, str);
+ gst_structure_set_value (result, "email", &val);
+ }
+ str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_PHONE);
+ if (str) {
+ g_value_take_string (&val, str);
+ gst_structure_set_value (result, "phone", &val);
+ }
+ str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_LOC);
+ if (str) {
+ g_value_take_string (&val, str);
+ gst_structure_set_value (result, "location", &val);
+ }
+ str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_TOOL);
+ if (str) {
+ g_value_take_string (&val, str);
+ gst_structure_set_value (result, "tool", &val);
+ }
+ str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_NOTE);
+ if (str) {
+ g_value_take_string (&val, str);
+ gst_structure_set_value (result, "note", &val);
+ }
+ str = rtp_source_get_sdes_string (src, GST_RTCP_SDES_PRIV);
+ if (str) {
+ g_value_take_string (&val, str);
+ gst_structure_set_value (result, "priv", &val);
+ }
+
+ return result;
+}
+
static void
on_ssrc_sdes (RTPSession * session, RTPSource * src, GstRtpSession * sess)
{
+ GstStructure *s;
+ GstMessage *m;
+
+ /* convert the new SDES info into a message */
+ RTP_SESSION_LOCK (session);
+ s = source_get_sdes_structure (src);
+ RTP_SESSION_UNLOCK (session);
+ m = gst_message_new_custom (GST_MESSAGE_ELEMENT, GST_OBJECT (sess), s);
+ gst_element_post_message (GST_ELEMENT_CAST (sess), m);
+
g_signal_emit (sess, gst_rtp_session_signals[SIGNAL_ON_SSRC_SDES], 0,
src->ssrc);
}
diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c
index ab5e7688..5cba052b 100644
--- a/gst/rtpmanager/rtpsession.c
+++ b/gst/rtpmanager/rtpsession.c
@@ -1221,7 +1221,7 @@ rtp_session_process_rr (RTPSession * sess, GstRTCPPacket * packet,
rtp_session_process_rb (sess, source, packet, arrival);
}
-/* FIXME, we're just printing this for now... */
+/* Get SDES items and store them in the SSRC */
static void
rtp_session_process_sdes (RTPSession * sess, GstRTCPPacket * packet,
RTPArrivalStats * arrival)
diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c
index 00f298d4..4985bccc 100644
--- a/gst/rtpmanager/rtpsource.c
+++ b/gst/rtpmanager/rtpsource.c
@@ -600,7 +600,7 @@ rtp_source_set_sdes_string (RTPSource * src, GstRTCPSDESType type,
* @data remains valid until the next call to rtp_source_set_sdes().
*
* Returns: %TRUE if @type was valid and @data and @len contain valid
- * data.
+ * data. @data can be NULL when the item was unset.
*/
gboolean
rtp_source_get_sdes (RTPSource * src, GstRTCPSDESType type, guint8 ** data,
@@ -627,7 +627,7 @@ rtp_source_get_sdes (RTPSource * src, GstRTCPSDESType type, guint8 ** data,
* Get the SDES item of @type from @src.
*
* Returns: a null-terminated copy of the SDES item or NULL when @type was not
- * valid. g_free() after usage.
+ * valid or the SDES item was unset. g_free() after usage.
*/
gchar *
rtp_source_get_sdes_string (RTPSource * src, GstRTCPSDESType type)