From ea5d4cfc7e29d010c0d7b6a2f606de76a6d117f4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 9 Sep 2014 18:10:12 +0200 Subject: [PATCH] stream-transport: make method to handle received data Make a method to handle the data received on a channel. It sends the data to the stream of the transport on the RTP or RTCP pads based on the channel number. --- gst/rtsp-server/rtsp-stream-transport.c | 32 ++++++++++++++++++++++++++++++++ gst/rtsp-server/rtsp-stream-transport.h | 3 +++ 2 files changed, 35 insertions(+) diff --git a/gst/rtsp-server/rtsp-stream-transport.c b/gst/rtsp-server/rtsp-stream-transport.c index a99295b..cd0a143 100644 --- a/gst/rtsp-server/rtsp-stream-transport.c +++ b/gst/rtsp-server/rtsp-stream-transport.c @@ -501,3 +501,35 @@ gst_rtsp_stream_transport_keep_alive (GstRTSPStreamTransport * trans) if (priv->keep_alive) priv->keep_alive (priv->ka_user_data); } + +/** + * gst_rtsp_stream_transport_recv_data: + * @trans: a #GstRTSPStreamTransport + * @channel: a channel + * @buffer: (transfer full): a #GstBuffer + * + * Receive @buffer on @channel @trans. + * + * Returns: a #GstFlowReturn. Returns GST_FLOW_NOT_LINKED when @channel is not + * configured in the transport of @trans. + */ +GstFlowReturn +gst_rtsp_stream_transport_recv_data (GstRTSPStreamTransport * trans, + guint channel, GstBuffer * buffer) +{ + GstRTSPStreamTransportPrivate *priv; + const GstRTSPTransport *tr; + GstFlowReturn res; + + priv = trans->priv; + tr = priv->transport; + + if (tr->interleaved.min == channel) { + res = gst_rtsp_stream_recv_rtp (priv->stream, buffer); + } else if (tr->interleaved.max == channel) { + res = gst_rtsp_stream_recv_rtcp (priv->stream, buffer); + } else { + res = GST_FLOW_NOT_LINKED; + } + return res; +} diff --git a/gst/rtsp-server/rtsp-stream-transport.h b/gst/rtsp-server/rtsp-stream-transport.h index 7735ee7..c3ee257 100644 --- a/gst/rtsp-server/rtsp-stream-transport.h +++ b/gst/rtsp-server/rtsp-stream-transport.h @@ -128,6 +128,9 @@ gboolean gst_rtsp_stream_transport_send_rtp (GstRTSPStreamT gboolean gst_rtsp_stream_transport_send_rtcp (GstRTSPStreamTransport *trans, GstBuffer *buffer); +GstFlowReturn gst_rtsp_stream_transport_recv_data (GstRTSPStreamTransport *trans, + guint channel, GstBuffer *buffer); + G_END_DECLS #endif /* __GST_RTSP_STREAM_TRANSPORT_H__ */ -- 2.7.4