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);
{
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));
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");
}
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;
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);
}
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)
* @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,
* 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)