Add parameter to disable SIGINT handling from run_pipeline().
Change-Id: I47ad946f19aad0d1bdf06695d2ffce1027865a2c
diff --git a/edgetpuvision/camera.py b/edgetpuvision/camera.py
index a5de10f..590c4df 100644
--- a/edgetpuvision/camera.py
+++ b/edgetpuvision/camera.py
@@ -37,7 +37,7 @@
self._thread = threading.Thread(target=gstreamer.run_pipeline,
args=(pipeline, self._layout, render_overlay,
- gstreamer.Display.NONE, signals))
+ gstreamer.Display.NONE, False, signals))
self._thread.start()
def stop_recording(self):
diff --git a/edgetpuvision/gstreamer.py b/edgetpuvision/gstreamer.py
index 7b18837..c424bbe 100644
--- a/edgetpuvision/gstreamer.py
+++ b/edgetpuvision/gstreamer.py
@@ -255,7 +255,7 @@
def quit():
Gtk.main_quit()
-def run_pipeline(pipeline, layout, render_overlay, display, signals=None):
+def run_pipeline(pipeline, layout, render_overlay, display, handle_sigint=True, signals=None):
signals = signals or {}
# Create pipeline
@@ -317,8 +317,11 @@
bus.add_signal_watch()
bus.connect('message', on_bus_message)
+ # Handle signals.
+ if handle_sigint:
+ GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, Gtk.main_quit)
+
# Run pipeline.
- GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, Gtk.main_quit)
pipeline.set_state(Gst.State.PLAYING)
try:
Gtk.main()