diff options
Diffstat (limited to 'voctocore/experiments/failovertest.py')
-rwxr-xr-x | voctocore/experiments/failovertest.py | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/voctocore/experiments/failovertest.py b/voctocore/experiments/failovertest.py deleted file mode 100755 index deb665b..0000000 --- a/voctocore/experiments/failovertest.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/python3 -import gi, time - -# import GStreamer and GTK-Helper classes -gi.require_version('Gst', '1.0') -from gi.repository import GLib, Gst, GObject - -# init GObject before importing local classes -GObject.threads_init() -Gst.init(None) - -from videodisplay import VideomixerWithDisplay -from shmsrc import ShmSrc - -class Example: - def __init__(self): - self.mainloop = GObject.MainLoop() - self.pipeline = Gst.Pipeline() - - self.bus = self.pipeline.get_bus() - self.bus.add_signal_watch() - self.bus.connect('message::eos', self.on_eos) - self.bus.connect('message::error', self.on_error) - - self.addTest('/tmp/v-cam2') - self.addTest('/tmp/v-cam1') - - def addTest(self, socket): - self.mixdisplay = VideomixerWithDisplay() - self.videoconvert = Gst.ElementFactory.make('videoconvert', None) - self.grabbersrc = ShmSrc(socket, Gst.Caps.from_string('video/x-raw,width=1280,height=720,framerate=25/1,format=RGBx')) - - # Add elements to pipeline - self.pipeline.add(self.grabbersrc) - self.pipeline.add(self.videoconvert) - self.pipeline.add(self.mixdisplay) - self.grabbersrc.link(self.videoconvert) - self.videoconvert.link(self.mixdisplay) - - def run(self): - self.pipeline.set_state(Gst.State.PAUSED) - time.sleep(0.5) - self.pipeline.set_state(Gst.State.PLAYING) - self.mainloop.run() - - def kill(self): - self.pipeline.set_state(Gst.State.NULL) - self.mainloop.quit() - - def on_eos(self, bus, msg): - print('on_eos()') - #self.kill() - - def on_error(self, bus, msg): - print('on_error():', msg.parse_error()) - #self.kill() - -example = Example() -example.run() |