[gst-devel] Gnonlin and media-start

Mike MacHenry dskippy at ccs.neu.edu
Fri Feb 22 19:54:22 CET 2008


I am wondering if anyone can help me work around what I'm pretty sure
is a bug. In this program the first filesource plays the first two
seconds of my audio file (passed in the first argument) and the second
plays the next two seconds. The start time of the second filesource is
2, which means that it should start right after the first filesource
but it does not, it waits for 2 more seconds and starts 4 seconds in.
When I make the media-start property of the second filesource 0, it
does start right after the first filesource with not pause. Of course
it then plays the first two seconds of the file over again, rather
than the next two. Is there maybe a trick I might employ? I tried to
set my start for the second clip to zero so it starts two seconds back
but then it just is not heard at all.

Thanks,
-mike

#!/usr/bin/python
import pygst
pygst.require("0.10")
import gst
import gobject
import sys

def OnPad(comp, pad):
        convpad = compconvert.get_compatible_pad(pad, pad.get_caps())
        pad.link(convpad)

pipeline = gst.Pipeline()
comp = gst.element_factory_make("gnlcomposition")
pipeline.add(comp)
comp.connect("pad-added", OnPad)

compconvert = gst.element_factory_make("audioconvert")
pipeline.add(compconvert)

sink = gst.element_factory_make("alsasink")
pipeline.add(sink)
compconvert.link(sink)

audio1 = gst.element_factory_make("gnlfilesource")
comp.add(audio1)
audio1.set_property("location", sys.argv[1])
audio1.set_property("start", 0 * gst.SECOND)
audio1.set_property("duration", 2 * gst.SECOND)
audio1.set_property("media-start", 0 * gst.SECOND)
audio1.set_property("media-duration", 2 * gst.SECOND)

audio2 = gst.element_factory_make("gnlfilesource")
comp.add(audio2)
audio2.set_property("location", sys.argv[1])
audio2.set_property("start", 2 * gst.SECOND)
audio2.set_property("duration", 2 * gst.SECOND)
audio2.set_property("media-start", 2 * gst.SECOND)
audio2.set_property("media-duration", 2 * gst.SECOND)

pipeline.set_state(gst.STATE_PLAYING)
gobject.MainLoop().run()




More information about the gstreamer-devel mailing list