diff options
author | Patricia Muscalu <patricia@axis.com> | 2017-10-16 11:15:55 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2017-11-15 17:46:00 +0200 |
commit | 51d670f73bb4d4fd8fbfde2daf191bc8f7a74218 (patch) | |
tree | bdc7a32b31a4a94602a5cf0bab3e1a7864e57f28 | |
parent | c9605cc5e1c36a2839df389d5fa002aaef43f786 (diff) |
rtsp-stream: add functions to get rtp and rtcp multicast sockets
Change-Id: Iddfe6e0bd250cb0159096d5eba9e4202d22b56db
https://bugzilla.gnome.org/show_bug.cgi?id=788340
-rw-r--r-- | gst/rtsp-server/rtsp-stream.c | 64 | ||||
-rw-r--r-- | gst/rtsp-server/rtsp-stream.h | 8 |
2 files changed, 72 insertions, 0 deletions
diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c index 2551895..90eb825 100644 --- a/gst/rtsp-server/rtsp-stream.c +++ b/gst/rtsp-server/rtsp-stream.c @@ -3546,6 +3546,70 @@ gst_rtsp_stream_get_rtcp_socket (GstRTSPStream * stream, GSocketFamily family) } /** + * gst_rtsp_stream_get_rtp_multicast_socket: + * @stream: a #GstRTSPStream + * @family: the socket family + * + * Get the multicast RTP socket from @stream for a @family. + * + * Returns: (transfer full) (nullable): the multicast RTP socket or %NULL if no + * socket could be allocated for @family. Unref after usage + */ +GSocket * +gst_rtsp_stream_get_rtp_multicast_socket (GstRTSPStream * stream, GSocketFamily family) +{ + GstRTSPStreamPrivate *priv = GST_RTSP_STREAM_GET_PRIVATE (stream); + GSocket *socket; + const gchar *name; + + g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL); + g_return_val_if_fail (family == G_SOCKET_FAMILY_IPV4 || + family == G_SOCKET_FAMILY_IPV6, NULL); + g_return_val_if_fail (priv->mcast_udpsink[0], NULL); + + if (family == G_SOCKET_FAMILY_IPV6) + name = "socket-v6"; + else + name = "socket"; + + g_object_get (priv->mcast_udpsink[0], name, &socket, NULL); + + return socket; +} + +/** + * gst_rtsp_stream_get_rtcp_multicast_socket: + * @stream: a #GstRTSPStream + * @family: the socket family + * + * Get the multicast RTCP socket from @stream for a @family. + * + * Returns: (transfer full) (nullable): the multicast RTCP socket or %NULL if no + * socket could be allocated for @family. Unref after usage + */ +GSocket * +gst_rtsp_stream_get_rtcp_multicast_socket (GstRTSPStream * stream, GSocketFamily family) +{ + GstRTSPStreamPrivate *priv = GST_RTSP_STREAM_GET_PRIVATE (stream); + GSocket *socket; + const gchar *name; + + g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL); + g_return_val_if_fail (family == G_SOCKET_FAMILY_IPV4 || + family == G_SOCKET_FAMILY_IPV6, NULL); + g_return_val_if_fail (priv->mcast_udpsink[1], NULL); + + if (family == G_SOCKET_FAMILY_IPV6) + name = "socket-v6"; + else + name = "socket"; + + g_object_get (priv->mcast_udpsink[1], name, &socket, NULL); + + return socket; +} + +/** * gst_rtsp_stream_set_seqnum: * @stream: a #GstRTSPStream * @seqnum: a new sequence number diff --git a/gst/rtsp-server/rtsp-stream.h b/gst/rtsp-server/rtsp-stream.h index a934ab5..7aa1aa2 100644 --- a/gst/rtsp-server/rtsp-stream.h +++ b/gst/rtsp-server/rtsp-stream.h @@ -220,6 +220,14 @@ GSocket * gst_rtsp_stream_get_rtcp_socket (GstRTSPStream *stream, GSocketFamily family); GST_EXPORT +GSocket * gst_rtsp_stream_get_rtp_multicast_socket (GstRTSPStream *stream, + GSocketFamily family); + +GST_EXPORT +GSocket * gst_rtsp_stream_get_rtcp_multicast_socket (GstRTSPStream *stream, + GSocketFamily family); + +GST_EXPORT gboolean gst_rtsp_stream_update_crypto (GstRTSPStream * stream, guint ssrc, GstCaps * crypto); |