summaryrefslogtreecommitdiff
path: root/example-scripts
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2016-02-09 21:51:05 +0100
committerMaZderMind <git@mazdermind.de>2016-02-09 21:51:05 +0100
commit5352bfa148eecb02eed944c8b9e72cb16abc3cc7 (patch)
treeb478172172fc35e3e9e7e0d4e8cb1f8a026f36c7 /example-scripts
parente26af9436a9c84f111b1b8d40d6f565a6d8738cd (diff)
fix timing
Diffstat (limited to 'example-scripts')
-rwxr-xr-xexample-scripts/gstreamer/source-nostream-music-from-folder.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/example-scripts/gstreamer/source-nostream-music-from-folder.py b/example-scripts/gstreamer/source-nostream-music-from-folder.py
index a25a58a..a176a7d 100755
--- a/example-scripts/gstreamer/source-nostream-music-from-folder.py
+++ b/example-scripts/gstreamer/source-nostream-music-from-folder.py
@@ -122,6 +122,12 @@ class LoopSource(object):
self.log.debug('unlinking with joinpad')
self.joinpad.unlink(self.joinpad.get_peer())
+ clock = self.pipeline.get_clock()
+ if clock:
+ runtime = clock.get_time() - self.pipeline.get_base_time()
+ self.log.debug('setting pad offset to pipeline runtime: %sns', runtime)
+ pad.set_offset(runtime)
+
self.log.debug('linking with joinpad')
pad.link(self.joinpad)
@@ -140,9 +146,9 @@ class LoopSource(object):
next_uri = self.directory.get_random_uri()
self.log.info('next track %s', next_uri)
- self.pipeline.set_state(Gst.State.READY)
+ self.src.set_state(Gst.State.READY)
self.src.set_property('uri', next_uri);
- self.pipeline.set_state(Gst.State.PLAYING)
+ self.src.set_state(Gst.State.PLAYING)
return False
def on_eos(self, bus, message):