[gst-devel] Segment Seeking
Andoni Morales Alastruey
ylatuya at gmail.com
Sat Sep 1 17:03:13 CEST 2007
Hi,
I'm working on a project based on gstreamer for video scouting. I need
to perform several tasks as frame stepping, seamless looping and
start-stop seeking and I would like to ask some questions about that.
On this aplication, the user indexes video segments according to the
diferent plays (eg:Henry scores a goal at the 2º minute, Ronaldinho is
shown a red card on the minute '32,etc...). After, you should have the
option to review Henry's goal (start-stop seeking) or,e.g., view all the
goals of the match (seamless looping)
If the user wants to review Henry's goal he only have to click twice on
a list with all the diferent plays to show it again. This play (Henry's
goal) is a video segment starting at 1"50 and stopping at 2"10. I want
to perform a seek that start at 1"50 and stops at 2"10. The
gst_element_seek() is described as follows:
gboolean gst_element_seek (GstElement *element,
gdouble rate,
GstFormat format,
GstSeekFlags flags,
GstSeekType cur_type,
gint64 cur,
GstSeekType stop_type,
gint64 stop);
I doubt between this 2 ways:
gst_element_seek (bvw->priv->play, 1.0,
GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE ,
GST_SEEK_TYPE_SET, start_time * GST_MSECOND,
GST_SEEK_TYPE_SET, stop_time * GST_MSECOND );
or
gst_element_seek (bvw->priv->play, 1.0,
GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT ,
GST_SEEK_TYPE_SET, start_time * GST_MSECOND,
GST_SEEK_TYPE_SET, stop_time * GST_MSECOND );
What I don't realy know is if it's possible to perform a start-stop seek without using the
GST_SEEK_FLAG_SEGMENT flag.
To implementing the option for viewing various segments at once I think the best option is
to perform a segment seeking and wait to SEGMENT_DONE signal to advance through the
segments array.Is it the good way? Do I need to do something else?
And finally, to perform the frame stepping, I think the best option is to perform a seek 1/fps seconds
after the current positon (where fps is the actual Frame Per Secondsrate of the video):
gst_element_seek (bvw->priv->play, 1.0,
GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE ,
GST_SEEK_TYPE_CUR, 1/fsp * GST_MSECOND,
GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE );
But I don't know what kind of GstSeekType I have to choose to do that...
I think GST_SEEK_TYPE_CUR is the good one
( http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstEvent.html#GstSeekType" ) :
GST_SEEK_TYPE_NONE no change in position is required
GST_SEEK_TYPE_CUR change relative to current position
GST_SEEK_TYPE_SET absolute position is requested
GST_SEEK_TYPE_END relative position to duration is request
Thank you!
More information about the gstreamer-devel
mailing list