[gst-devel] Properly seeking in a track with gst-python

Jason Gerard DeRose jderose at jasonderose.org
Tue Feb 21 07:53:09 CET 2006


Adam,

I'm guessing you are trying to seek to 10 seconds into your track.
gstreamer0.8 (and as far as I know, 0.10 also) deals in nano seconds
(10^-9).  So you will need to multiply your seconds by gst.SECOND

nano_sec = sec * gst.SECOND

event = gst.event_new_seek(gst.FORMAT_TIME |
        				gst.SEEK_METHOD_SET |
				gst.SEEK_FLAG_FLUSH, nano_sec)

10 nano seconds is so close to the start of your track that you can't
tell the difference (well, and maybe so close that the bits gstreamer
spits out are the same as when starting from the beginning).

Happy hacking,
Jason

Adam Olsen wrote:
> I'm setting up the pipeline like so:
> 
> 
> play = gst.element_factory_make("playbin")
> audio_sink = gst.element_factory_make('esdsink')
> play.set_property("audio-sink", audio_sink)
> play.set_property("volume", 1)
> 
> play.set_property("uri", "file://%s" % self.loc)
> play.set_state(gst.STATE_PLAYING)
> 
> When trying to seek, I use the following:
> 
> value = 10
> play.set_state(gst.STATE_PAUSED)
> event = gst.event_new_seek(gst.FORMAT_TIME |
>                                    gst.SEEK_METHOD_SET |
>                                    gst.SEEK_FLAG_FLUSH, value)
> 
> play.send_event(event)
> play.set_state(gst.STATE_PLAYING)
> 
> This doesn't seem to be working, it just resets playback on the track.
> 
> What am I doing wrong?
> 
> Adam
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> 




More information about the gstreamer-devel mailing list