From 42e1b52ef495c81e3c6f1d46fb2628ceeb00b50b Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Thu, 5 Oct 2023 22:00:37 +0200 Subject: [PATCH] Add Element.SeekPosition The method calls the C function gst_element_seek_simple to make the stream playing at the given time (in nanoseconds). It is useful to start the stream at a certain time, rewind, etc. --- gst/gst_element.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gst/gst_element.go b/gst/gst_element.go index d7720d1..b8e0f8d 100644 --- a/gst/gst_element.go +++ b/gst/gst_element.go @@ -592,3 +592,9 @@ func (e *Element) GetBaseTime() ClockTime { return ClockTime(ctime) } + +// SeekPosition seeks to the given position in the stream. The element should be in the PAUSED or PLAYING state and must be a seekable. +// The position is given in nanoseconds. +func (e *Element) SeekPosition(position int64) { + C.gst_element_seek_simple(e.Instance(), C.GstFormat(C.GST_FORMAT_TIME), C.GstSeekFlags(C.GST_SEEK_FLAG_FLUSH), C.gint64(position)) +}