From 1db7e620607350db94528d40aa3d932ce9fd215c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 1 Jul 2013 17:28:55 +0200 Subject: [PATCH] rtspsrc: add signal to notify of the SDP This way, the app can look and modify the SDP. --- gst/rtsp/gstrtspsrc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index e8b00c1cf6..911069f5a1 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -121,6 +121,7 @@ GST_STATIC_PAD_TEMPLATE ("internalsink_%u", enum { SIGNAL_HANDLE_REQUEST, + SIGNAL_ON_SDP, LAST_SIGNAL }; @@ -573,6 +574,27 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass) 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); + /** + * GstRTSPSrc::on-sdp: + * @rtspsrc: a #GstRTSPSrc + * @sdp: a #GstSDPMessage + * + * Emited when the client has retrieved the SDP and before it configures the + * streams in the SDP. @sdp can be inspected and modified. + * + * This signal is called from the streaming thread, you should therefore not + * do any state changes on @rtspsrc because this might deadlock. If you want + * to modify the state as a result of this signal, post a + * #GST_MESSAGE_REQUEST_STATE message on the bus or signal the main thread + * in some other way. + * + * Since: 1.2 + */ + gst_rtspsrc_signals[SIGNAL_ON_SDP] = + g_signal_new ("on-sdp", G_TYPE_FROM_CLASS (klass), 0, + 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1, + GST_TYPE_SDP_MESSAGE | G_SIGNAL_TYPE_STATIC_SCOPE); + gstelement_class->send_event = gst_rtspsrc_send_event; gstelement_class->provide_clock = gst_rtspsrc_provide_clock; gstelement_class->change_state = gst_rtspsrc_change_state; @@ -5816,6 +5838,9 @@ gst_rtspsrc_open_from_sdp (GstRTSPSrc * src, GstSDPMessage * sdp, gst_rtsp_ext_list_parse_sdp (src->extensions, sdp, src->props); + /* let the app inspect and change the SDP */ + g_signal_emit (src, gst_rtspsrc_signals[SIGNAL_ON_SDP], 0, sdp); + gst_segment_init (&src->segment, GST_FORMAT_TIME); /* parse range for duration reporting. */