From cfdc7408b533048515f59b7cd1190c5f1f0b2797 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 26 Dec 2013 14:43:35 +0100 Subject: [PATCH] stream: also return the running-time Return the running-time in the rtpinfo as well. --- gst/rtsp-server/rtsp-stream-transport.c | 2 +- gst/rtsp-server/rtsp-stream.c | 25 ++++++++++++++----------- gst/rtsp-server/rtsp-stream.h | 3 ++- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/gst/rtsp-server/rtsp-stream-transport.c b/gst/rtsp-server/rtsp-stream-transport.c index cf8eb64..faacc4a 100644 --- a/gst/rtsp-server/rtsp-stream-transport.c +++ b/gst/rtsp-server/rtsp-stream-transport.c @@ -331,7 +331,7 @@ gst_rtsp_stream_transport_get_rtpinfo (GstRTSPStreamTransport * trans) priv = trans->priv; - if (!gst_rtsp_stream_get_rtpinfo (priv->stream, &rtptime, &seq)) + if (!gst_rtsp_stream_get_rtpinfo (priv->stream, &rtptime, &seq, NULL)) return NULL; rtpinfo = g_string_new (""); diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c index bcc8ccf..3380bd0 100644 --- a/gst/rtsp-server/rtsp-stream.c +++ b/gst/rtsp-server/rtsp-stream.c @@ -1749,34 +1749,37 @@ was_not_joined: /** * gst_rtsp_stream_get_rtpinfo: * @stream: a #GstRTSPStream - * @rtptime: result RTP timestamp - * @seq: result RTP seqnum + * @rtptime: (allow-none): result RTP timestamp + * @seq: (allow-none): result RTP seqnum + * @running_time: (allow-none): result running-time * - * Retrieve the current rtptime and seq. This is used to + * Retrieve the current rtptime, seq and running-time. This is used to * construct a RTPInfo reply header. * - * Returns: %TRUE when rtptime and seq could be determined. + * Returns: %TRUE when rtptime, seq and running-time could be determined. */ gboolean gst_rtsp_stream_get_rtpinfo (GstRTSPStream * stream, - guint * rtptime, guint * seq) + guint * rtptime, guint * seq, GstClockTime * running_time) { GstRTSPStreamPrivate *priv; GObjectClass *payobjclass; g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), FALSE); - g_return_val_if_fail (rtptime != NULL, FALSE); - g_return_val_if_fail (seq != NULL, FALSE); priv = stream->priv; payobjclass = G_OBJECT_GET_CLASS (priv->payloader); - if (!g_object_class_find_property (payobjclass, "seqnum") || - !g_object_class_find_property (payobjclass, "timestamp")) - return FALSE; + if (seq && g_object_class_find_property (payobjclass, "seqnum")) + g_object_get (priv->payloader, "seqnum", seq, NULL); + + if (rtptime && g_object_class_find_property (payobjclass, "timestamp")) + g_object_get (priv->payloader, "timestamp", rtptime, NULL); - g_object_get (priv->payloader, "seqnum", seq, "timestamp", rtptime, NULL); + if (running_time + && g_object_class_find_property (payobjclass, "running-time")) + g_object_get (priv->payloader, "running-time", running_time, NULL); return TRUE; } diff --git a/gst/rtsp-server/rtsp-stream.h b/gst/rtsp-server/rtsp-stream.h index 71efa62..0eac432 100644 --- a/gst/rtsp-server/rtsp-stream.h +++ b/gst/rtsp-server/rtsp-stream.h @@ -118,7 +118,8 @@ void gst_rtsp_stream_get_ssrc (GstRTSPStream *stream, guint *ssrc); gboolean gst_rtsp_stream_get_rtpinfo (GstRTSPStream *stream, - guint *rtptime, guint *seq); + guint *rtptime, guint *seq, + GstClockTime *running_time); GstCaps * gst_rtsp_stream_get_caps (GstRTSPStream *stream); GstFlowReturn gst_rtsp_stream_recv_rtp (GstRTSPStream *stream, -- 2.7.4