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.
This commit is contained in:
Wim Taymans 2014-09-09 18:10:12 +02:00
parent 4056897111
commit ea5d4cfc7e
2 changed files with 35 additions and 0 deletions

View file

@ -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;
}

View file

@ -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__ */