rtspclientsink: Add "update-sdp" signal that allows updating the SDP before sending it to the server

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/178>
This commit is contained in:
Sebastian Dröge 2020-12-15 11:07:01 +02:00 committed by GStreamer Merge Bot
parent d6d3ecaafb
commit ac5213dcdf
2 changed files with 28 additions and 0 deletions

View file

@ -414,6 +414,15 @@
],
"return-type": "GstCaps",
"when": "last"
},
"update-sdp": {
"args": [
{
"name": "arg0",
"type": "GstSDPMessage"
}
],
"return-type": "void"
}
}
}

View file

@ -246,6 +246,7 @@ enum
SIGNAL_NEW_PAYLOADER,
SIGNAL_REQUEST_RTCP_KEY,
SIGNAL_ACCEPT_CERTIFICATE,
SIGNAL_UPDATE_SDP,
LAST_SIGNAL
};
@ -805,6 +806,22 @@ gst_rtsp_client_sink_class_init (GstRTSPClientSinkClass * klass)
G_TYPE_BOOLEAN, 3, G_TYPE_TLS_CONNECTION, G_TYPE_TLS_CERTIFICATE,
G_TYPE_TLS_CERTIFICATE_FLAGS);
/**
* GstRTSPClientSink::update-sdp:
* @rtsp_client_sink: a #GstRTSPClientSink
* @sdp: a #GstSDPMessage
*
* Emitted right before the ANNOUNCE request is sent to the server with the
* generated SDP. The SDP can be updated from signal handlers but the order
* and number of medias must not be changed.
*
* Since: 1.20
*/
gst_rtsp_client_sink_signals[SIGNAL_UPDATE_SDP] =
g_signal_new_class_handler ("update-sdp", G_TYPE_FROM_CLASS (klass),
0, 0, NULL, NULL, NULL,
G_TYPE_NONE, 1, GST_TYPE_SDP_MESSAGE | G_SIGNAL_TYPE_STATIC_SCOPE);
gstelement_class->provide_clock = gst_rtsp_client_sink_provide_clock;
gstelement_class->change_state = gst_rtsp_client_sink_change_state;
gstelement_class->request_new_pad =
@ -4453,6 +4470,8 @@ gst_rtsp_client_sink_record (GstRTSPClientSink * sink, gboolean async)
if (res < 0)
goto create_request_failed;
g_signal_emit (sink, gst_rtsp_client_sink_signals[SIGNAL_UPDATE_SDP], 0, sdp);
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CONTENT_TYPE,
"application/sdp");