stream-transport: make method to handle received data
authorWim Taymans <wtaymans@redhat.com>
Tue, 9 Sep 2014 16:10:12 +0000 (18:10 +0200)
committerWim Taymans <wtaymans@redhat.com>
Tue, 16 Sep 2014 08:45:20 +0000 (10:45 +0200)
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
gst/rtsp-server/rtsp-stream-transport.h

index a99295b..cd0a143 100644 (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;
+}
index 7735ee7..c3ee257 100644 (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__ */