- 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:
1 parent
1c954aa657
commit
de39b74282
4 files changed
+175
-889
No files matched your search
+158
-886
File diff suppressed because it is too large.
Load diff
@@ -254,6 +254,7 @@ static void load_gallery_image(CameraApp *app) {
|
||||
g_object_unref(raw);
|
||||
}
|
||||
struct stat st;
|
||||
memset(&st, 0, sizeof(st));
|
||||
long kb = (stat(path, &st) == 0) ? (long)(st.st_size / 1024) : 0;
|
||||
if (kb < 1 && st.st_size > 0) kb = 1;
|
||||
if (app->gallery_pb) {
|
||||
@@ -423,7 +424,7 @@ static gboolean draw_viewfinder(GtkWidget *widget, cairo_t *cr, gpointer data) {
|
||||
cairo_set_font_size(cr, 16.0);
|
||||
cairo_text_extents_t ext;
|
||||
cairo_text_extents(cr, msg, &ext);
|
||||
cairo_move_to((w - ext.width) / 2.0, h / 2.0 - 30.0);
|
||||
cairo_move_to(cr, (w - ext.width) / 2.0, h / 2.0 - 30.0);
|
||||
cairo_show_text(cr, msg);
|
||||
}
|
||||
|
||||
@@ -1027,7 +1028,7 @@ static void shutdown_app(CameraApp *app) {
|
||||
reaped = TRUE;
|
||||
break;
|
||||
}
|
||||
usleep(50000);
|
||||
g_usleep(50000);
|
||||
}
|
||||
if (!reaped) {
|
||||
kill(app->worker_pid, SIGTERM);
|
||||
|
||||
+1
-1
@@ -48,5 +48,5 @@ Chandra includes KMS/libinput/compositor adaptations tailored for mainline Linux
|
||||
|
||||
## Camera App (`chandra-camera`)
|
||||
|
||||
- [`camera/chandra-camera`](../camera/chandra-camera) provides a native GTK3/Cairo Wayland camera app installed via [`session/install.py`](../session/install.py) with its desktop launcher and icon (`Camera`).
|
||||
- [`camera/chandra-camera`](../camera/chandra-camera) and [`camera/chandra-camera-ui.c`](../camera/chandra-camera-ui.c) provide a native GTK3/Cairo Wayland camera app (no extra Python GI packages required) installed via [`session/install.py`](../session/install.py) with its desktop launcher and icon (`Camera`).
|
||||
- Supports multi-sensor `libcamera` discovery and live switching (`Back · imx519`, `Front · imx371`, `Back 2 · imx376` on OnePlus 6T, with automatic V4L2 fallback on desktops), sensor orientation transform + front-camera mirror preview, Photo mode (`HD` instant / `Full` high-resolution `StillCapture`, `0`/`3s`/`10s` self-timer, 3×3 rule-of-thirds grid) saving JPEGs to `~/Pictures/Camera`, Video mode recording H.264 MP4s via `ffmpeg` to `~/Videos/Camera`, an in-app photo gallery viewer, rear flash/torch LED control (`/sys/class/leds/white:flash`) through `org.freedesktop.login1.Session.SetBrightness`, and hardware volume-button or `Space`/`Return` shutter control.
|
||||
@@ -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"):
|
||||
|
||||
Reference in new issue
Block a user