summaryrefslogtreecommitdiff
path: root/gst/rtsp-server/rtsp-stream.c
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2017-11-24 17:34:31 +0100
committerEdward Hervey <bilboed@bilboed.com>2017-11-25 07:53:11 +0100
commit9514f2d3549f1c8847e69d3ce6e76a693bd1dc38 (patch)
treea30e3824dfe8f9d188bcd6194bc97e0fdff9976a /gst/rtsp-server/rtsp-stream.c
parentbb29d2e2ee46a1e1b3ffc52a3c0da91e42d82e0b (diff)
rtsp-media: Enable seeking query before pipeline is complete
SDP are now provided *before* the pipeline is fully complete. In order to know whether a media is seekable or not therefore requires asking the invididual streams. API: gst_rtsp_stream_seekable https://bugzilla.gnome.org/show_bug.cgi?id=790674
Diffstat (limited to 'gst/rtsp-server/rtsp-stream.c')
-rw-r--r--gst/rtsp-server/rtsp-stream.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c
index 7b458b1..fee99ac 100644
--- a/gst/rtsp-server/rtsp-stream.c
+++ b/gst/rtsp-server/rtsp-stream.c
@@ -4450,6 +4450,58 @@ gst_rtsp_stream_query_stop (GstRTSPStream * stream, gint64 * stop)
}
/**
+ * gst_rtsp_stream_seekable:
+ * @stream: a #GstRTSPStream
+ *
+ * Checks whether the individual @stream is seekable.
+ *
+ * Returns: %TRUE if @stream is seekable, else %FALSE.
+ */
+gboolean
+gst_rtsp_stream_seekable (GstRTSPStream * stream)
+{
+ GstRTSPStreamPrivate *priv;
+ GstPad *pad = NULL;
+ GstQuery *query = NULL;
+ gboolean seekable = FALSE;
+
+ g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), FALSE);
+
+ /* query stop position: if no sinks have been added yet,
+ * we obtain the stop position from the pad otherwise we query the sinks */
+
+ priv = stream->priv;
+
+ g_mutex_lock (&priv->lock);
+ /* depending on the transport type, it should query corresponding sink */
+ if (priv->srcpad) {
+ pad = gst_object_ref (priv->srcpad);
+ } else {
+ g_mutex_unlock (&priv->lock);
+ GST_WARNING_OBJECT (stream, "Pad not available, can't query seekability");
+ goto beach;
+ }
+ g_mutex_unlock (&priv->lock);
+
+ query = gst_query_new_seeking (GST_FORMAT_TIME);
+ if (!gst_pad_query (pad, query)) {
+ GST_WARNING_OBJECT (stream, "seeking query failed");
+ goto beach;
+ }
+ gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL);
+
+beach:
+ if (pad)
+ gst_object_unref (pad);
+ if (query)
+ gst_query_unref (query);
+
+ GST_DEBUG_OBJECT (stream, "Returning %d", seekable);
+
+ return seekable;
+}
+
+/**
* gst_rtsp_stream_complete_stream:
* @stream: a #GstRTSPStream
* @transport: a #GstRTSPTransport