- 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
+193
-907
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user