[gst-devel] automagically skip parts of a stream
mail at renestadler.de
Tue Feb 13 01:24:08 CET 2007
Am Montag, den 12.02.2007, 20:54 +0100 schrieb Rainer Clasen:
> so far I was quite lucky using gstreamer just from the provided
> docs and googling around, but now I'm having no luck.
> I'm currently searching a way to skip parts of a Media stream - or to be
> more precise, I just want to pick a bit out of the stream. The start/end
> of the part to be picked will be stored in a database. My current Idea is
> to store these positions as Nanosecond offset.
> So what's the Right(tm) way to do this?
Just seek using the correct flags (see below).
> Making my application seek is likely a bit kludgy - especially as this is
> not expected to happen instantious.
If you issue a flushing seek, it happens instantaneously in the sense
that anything else that was queued before gets flushed out. This means
that the next data to be rendered is actually the part you selected with
> Do I have to write my own plugin for this (I guess I can take a look at
> cutter for some inspirations)?
cutter is an audio analyzer that detects silence, I can't see how this
would help here. You might want to have a closer look at the
documentation about seeking and segments instead:
You might end up doing something like this (in Python syntax):
# Wait for state change to happen:
success = pipeline.seek (1.0, gst.FORMAT_TIME,
gst.SEEK_FLAG_FLUSH | gst.SEEK_FLAG_ACCURATE,
gst.SEEK_TYPE_SET, gst.NSECOND * start_nsecs,
gst.SEEK_TYPE_SET, gst.NSECOND * end_nsecs)
print >> sys.stderr, "Seek failed!"
This plays only the selected range, assuming that the media source
supports seeking and the involved elements work correctly in this
More information about the gstreamer-devel