]> git.scottworley.com Git - srec/blobdiff - srec.py
Rename button handlers to contain 'button'
[srec] / srec.py
diff --git a/srec.py b/srec.py
index 7421c74cc764f8642c3d4a5766c890ade5e044d6..3490695939be861a7dbd3eec0d439ba660948bb8 100644 (file)
--- a/srec.py
+++ b/srec.py
@@ -100,7 +100,7 @@ def begin_monitoring_file_size(size_display: Gtk.Label, filename: str) -> None:
     GLib.timeout_add_seconds(1, update_size_display)
 
 
     GLib.timeout_add_seconds(1, update_size_display)
 
 
-def on_start_recording(_: Gtk.Button, stack: Gtk.Stack) -> None:
+def on_start_button(_: Gtk.Button, stack: Gtk.Stack) -> None:
     global recording, sharing  # pylint: disable=global-statement
     assert recording is None
     assert sharing is None
     global recording, sharing  # pylint: disable=global-statement
     assert recording is None
     assert sharing is None
@@ -111,9 +111,14 @@ def on_start_recording(_: Gtk.Button, stack: Gtk.Stack) -> None:
     stack.set_visible_child_name("recording")
 
     if is_sharing_enabled(stack):
     stack.set_visible_child_name("recording")
 
     if is_sharing_enabled(stack):
+        out_opts = [
+            '-f', 'v4l2', '-framerate', '25', '-codec:v', 'rawvideo',
+            '-pix_fmt', 'yuv420p',
+        ]
         sharing = Stream.start(
         sharing = Stream.start(
-            ['ffmpeg', '-i', '/dev/video0', '-f', 'v4l2', '-framerate', '25',
-             '-codec:v', 'rawvideo', '-pix_fmt', 'yuv420p', '/dev/video9'])
+            ['ffmpeg', '-i', '/dev/video0']
+            + out_opts + ['/dev/video8']
+            + out_opts + ['/dev/video9'])
         time.sleep(3)  # Bad!!  We should not be sleeping in this thread!
 
     recording = Stream.start(
         time.sleep(3)  # Bad!!  We should not be sleeping in this thread!
 
     recording = Stream.start(
@@ -121,7 +126,7 @@ def on_start_recording(_: Gtk.Button, stack: Gtk.Stack) -> None:
         ['-f', 'pulse', '-ac', '2', '-i', 'default', filename])
 
 
         ['-f', 'pulse', '-ac', '2', '-i', 'default', filename])
 
 
-def on_stop_recording(_: Gtk.Button, stack: Gtk.Stack) -> None:
+def on_stop_button(_: Gtk.Button, stack: Gtk.Stack) -> None:
     global recording, sharing  # pylint: disable=global-statement
     assert recording is not None
     recording.stop()
     global recording, sharing  # pylint: disable=global-statement
     assert recording is not None
     recording.stop()
@@ -164,12 +169,12 @@ def on_activate(app: Gtk.Application) -> None:
     nr_box.append(screen)
     nr_box.append(Gtk.CheckButton(label='Webcam', active=True, group=screen))
     nr_box.append(make_share_control())
     nr_box.append(screen)
     nr_box.append(Gtk.CheckButton(label='Webcam', active=True, group=screen))
     nr_box.append(make_share_control())
-    nr_box.append(make_button("Start Recording", on_start_recording, stack))
+    nr_box.append(make_button("Start Recording", on_start_button, stack))
     stack.add_named(nr_box, "not_recording")
 
     r_box = Gtk.Box()
     r_box.set_orientation(Gtk.Orientation.VERTICAL)
     stack.add_named(nr_box, "not_recording")
 
     r_box = Gtk.Box()
     r_box.set_orientation(Gtk.Orientation.VERTICAL)
-    r_box.append(make_button("Stop Recording", on_stop_recording, stack))
+    r_box.append(make_button("Stop Recording", on_stop_button, stack))
     r_box.append(Gtk.Label(use_markup=True, justify=Gtk.Justification.CENTER))
     stack.add_named(r_box, "recording")
 
     r_box.append(Gtk.Label(use_markup=True, justify=Gtk.Justification.CENTER))
     stack.add_named(r_box, "recording")