Camera: move the camera engine into a stdio worker process
CI / test (push) Failing after 49s

- Replace the in-process GTK3 run_gui() with run_worker(), which owns the camera engine.
- Worker streams downscaled Cairo BGRA frames to stdout, with a length header per frame.
- Worker reads UI commands from stdin (switch, snap, snap_full, rec_start, quit) and emits state lines (info, active, flash, toast, saved_photo, rec_state).
- SIGINT/SIGTERM set a stop flag so the worker shuts down cleanly.
This commit is contained in:
nandi committed 2026-11-28 12:25:29 -08:00
1 parent 1c954aa657
commit de39b74282
4 files changed
+193 -907

No files matched your search

+13
View File
@@ -32,6 +32,7 @@ Installs:
/usr/local/bin/chandra-kde-colors Dark mode for KDE/Qt apps: copies a color scheme into
kdeglobals (docs/dark-mode.md)
/usr/local/bin/chandra-camera Wayland Camera app (libcamera / V4L2)
/usr/local/lib/chandra/chandra-camera-ui Native GTK3/Cairo Camera UI binary
/usr/share/applications/chandra-camera.desktop Camera app desktop entry
/usr/share/icons/hicolor/scalable/apps/chandra-camera.svg Camera app icon
/usr/local/share/color-schemes/Chandra{Dark,Light}.colors KDE color schemes, used when Breeze's
@@ -71,6 +72,7 @@ targets = [
"/usr/local/bin/chandra-auto-rotate",
"/usr/local/bin/chandra-kde-colors",
"/usr/local/bin/chandra-camera",
"/usr/local/lib/chandra/chandra-camera-ui",
"/usr/share/applications/chandra-camera.desktop",
"/usr/share/icons/hicolor/scalable/apps/chandra-camera.svg",
"/usr/local/share/color-schemes/ChandraDark.colors",
@@ -184,6 +186,17 @@ install(os.path.join(root, "session/chandra-ctl"), "/usr/local/bin/chandra-ctl")
install(os.path.join(root, "session/chandra-auto-rotate"), "/usr/local/bin/chandra-auto-rotate")
install(os.path.join(root, "session/chandra-kde-colors"), "/usr/local/bin/chandra-kde-colors")
install(os.path.join(root, "camera/chandra-camera"), "/usr/local/bin/chandra-camera")
cam_ui_src = os.path.join(root, "camera/chandra-camera-ui.c")
cam_ui_dst = "/usr/local/lib/chandra/chandra-camera-ui"
cc = shutil.which("cc") or shutil.which("gcc")
if not cc or not shutil.which("pkg-config"):
sys.exit("install.py: C compiler and pkg-config are needed to build chandra-camera-ui")
gtk_flags = subprocess.check_output(["pkg-config", "--cflags", "--libs", "gtk+-3.0"], text=True).split()
os.makedirs(os.path.dirname(cam_ui_dst), exist_ok=True)
subprocess.check_call([cc, "-O2", "-Wall", "-Wextra", "-o", cam_ui_dst + ".new", cam_ui_src] + gtk_flags + ["-lm"])
os.chmod(cam_ui_dst + ".new", 0o755)
os.replace(cam_ui_dst + ".new", cam_ui_dst)
print("installed", cam_ui_dst)
put(os.path.join(root, "camera/chandra-camera.desktop"), "/usr/share/applications/chandra-camera.desktop", 0o644)
put(os.path.join(root, "camera/chandra-camera.svg"), "/usr/share/icons/hicolor/scalable/apps/chandra-camera.svg", 0o644)
if shutil.which("gtk-update-icon-cache"):