summaryrefslogtreecommitdiff
path: root/voctocore/scripts/av-source-background-loop.py
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2015-11-16 23:31:15 +0100
committerMaZderMind <git@mazdermind.de>2015-11-16 23:31:43 +0100
commitd37661d72375bcea603afa0bac16703004923afe (patch)
treeafab0a1f1804fcdddb539418ff0b3adf35a4e551 /voctocore/scripts/av-source-background-loop.py
parent56b9bd28dcdf048e9513ed3e08c029db4f44cf47 (diff)
move voctocore/scripts to example-scripts
Diffstat (limited to 'voctocore/scripts/av-source-background-loop.py')
-rwxr-xr-xvoctocore/scripts/av-source-background-loop.py63
1 files changed, 0 insertions, 63 deletions
diff --git a/voctocore/scripts/av-source-background-loop.py b/voctocore/scripts/av-source-background-loop.py
deleted file mode 100755
index 9f4dc6d..0000000
--- a/voctocore/scripts/av-source-background-loop.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/python3
-import sys, gi, signal
-
-gi.require_version('Gst', '1.0')
-from gi.repository import Gst, GObject
-
-# init GObject & Co. before importing local classes
-GObject.threads_init()
-Gst.init([])
-
-class LoopSource(object):
- def __init__(self):
- pipeline = """
- uridecodebin name=src uri=http://c3voc.mazdermind.de/bg.ts !
- video/x-raw,format=I420,width=1920,height=1080,framerate=25/1,pixel-aspect-ratio=1/1 !
- matroskamux !
- tcpclientsink host=localhost port=16000
- """
-
- self.senderPipeline = Gst.parse_launch(pipeline)
- self.src = self.senderPipeline.get_by_name('src')
-
- # Binding End-of-Stream-Signal on Source-Pipeline
- self.senderPipeline.bus.add_signal_watch()
- self.senderPipeline.bus.connect("message::eos", self.on_eos)
- self.senderPipeline.bus.connect("message::error", self.on_error)
-
- print("playing")
- self.senderPipeline.set_state(Gst.State.PLAYING)
-
-
- def on_eos(self, bus, message):
- print('Received EOS-Signal, Seeking to start')
- self.src.seek(
- 1.0, # rate (float)
- Gst.Format.TIME, # format (Gst.Format)
- Gst.SeekFlags.FLUSH, # flags (Gst.SeekFlags)
- Gst.SeekType.SET, # start_type (Gst.SeekType)
- 0, # start (int)
- Gst.SeekType.NONE, # stop_type (Gst.SeekType)
- 0 # stop (int)
- )
-
- def on_error(self, bus, message):
- print('Received Error-Signal')
- (error, debug) = message.parse_error()
- print('Error-Details: #%u: %s' % (error.code, debug))
- sys.exit(1)
-
-def main():
- signal.signal(signal.SIGINT, signal.SIG_DFL)
-
- src = LoopSource()
-
- mainloop = GObject.MainLoop()
- try:
- mainloop.run()
- except KeyboardInterrupt:
- print('Terminated via Ctrl-C')
-
-
-if __name__ == '__main__':
- main()