Loading...
Searching...
No Matches
ai_cam_pipe.c
Go to the documentation of this file.
165 fprintf(stderr, "AI_CAM_PIPE:\tchild %ld has not exited; camera remains owned\n", (long)child_pid);
209 const int directory_length = snprintf(signal_directory, sizeof(signal_directory), "%s", directory);
223 const int result = posix_spawnp(&child_pid, USHER_AI_CAM_COMMAND, NULL, NULL, arguments, environ);
246 const int length = snprintf(pattern, sizeof(pattern), "%s/%s%%06d.jpg", directory, signal_prefix);
329 const int source_length = snprintf(source, sizeof(source), "%s/%s", signal_directory, event->name);
351 const int length = snprintf(source, sizeof(source), "%s/%s000000.jpg", directory, signal_prefix);
432 if (native_enabled) return imx500_pipe_shoot(&native_capture, filename, filename_size, image_number);
439 if (length < 0 || (size_t)length >= filename_size || usher_prepare_photo(filename, filename_size) != 0) {
464 if (timing_enabled) fprintf(stderr, "AI_CAM_PIPE TIMING:\tshot=%d capture_total_ms=%lld result=%d\n",
static bool zsl_enabled(void)
Check whether the next persistent child may use zero shutter lag.
Definition ai_cam_pipe.c:194
int ai_cam_pipe_init(const char *unused)
Validate storage and start the selected camera owner.
Definition ai_cam_pipe.c:398
static bool stop_child(void)
Request shutdown and escalate if the camera child does not exit.
Definition ai_cam_pipe.c:158
static bool persistent_stop(void)
Retire the subprocess and its directory watch.
Definition ai_cam_pipe.c:173
int ai_cam_pipe_shoot(char *filename, size_t filename_size, int image_number)
Capture one ordinary JPEG into private staging for metadata completion.
Definition ai_cam_pipe.c:430
static bool child_alive(int *status)
Poll the owned child and reap it if it exited.
Definition ai_cam_pipe.c:128
static bool new_session(const char *directory)
Reserve a private filename prefix for a camera child.
Definition ai_cam_pipe.c:205
void ai_cam_pipe_configure(const struct camera_backend_host *host)
Pass the shutdown flag to native worker supervision.
Definition ai_cam_pipe.c:393
static void wait_ms(int milliseconds)
Wait until a short polling interval elapses.
Definition ai_cam_pipe.c:114
static int persistent_start(const char *directory)
Start the signal-triggered camera application.
Definition ai_cam_pipe.c:237
void ai_cam_pipe_deinit(void)
Stop the native and system-camera subprocesses.
Definition ai_cam_pipe.c:470
static int oneshot_shoot(const char *directory, const char *destination)
Capture using a fresh camera subprocess.
Definition ai_cam_pipe.c:347
bool ai_cam_pipe_native(void)
Report whether the selected AIcam mode uses native photo-only capture.
Definition ai_cam_pipe.c:388
char ** environ
static bool persistent_enabled(void)
Resolve the default persistent capture policy against the one-shot override.
Definition ai_cam_pipe.c:184
void ai_cam_pipe_set_photo_directory(const char *directory)
Select a borrowed directory before initialization.
Definition ai_cam_pipe.c:376
int ai_cam_pipe_set_native(bool enabled)
Select native or system-camera capture before startup.
Definition ai_cam_pipe.c:381
static int spawn_camera(char *const arguments[])
Launch the configured camera application and record ownership.
Definition ai_cam_pipe.c:221
static enum capture_result persistent_shoot(const char *destination)
Request and collect one persistent-child capture.
Definition ai_cam_pipe.c:299
static bool wait_child(int milliseconds)
Give the owned child a bounded interval to exit.
Definition ai_cam_pipe.c:144
static int publish_image(const char *source, const char *destination)
Publish a completed private JPEG at the caller's staging path.
Definition ai_cam_pipe.c:283
Parent-side contract for stock and native Raspberry Pi camera capture.
Shared capability and lifecycle contract for USHER camera backends.
static uint64_t milliseconds(void)
Read elapsed-time evidence unaffected by changes to civil time.
Definition dipla_camera_backend.c:59
static bool enabled(void)
Report explicit opt-in independently of process or model readiness.
Definition dipla_camera_backend.c:75
void imx500_pipe_stop(struct imx500_pipe *pipe)
Close the channel, allow an exit grace period, then kill/reap if needed.
Definition imx500_pipe.c:132
int imx500_pipe_shoot(struct imx500_pipe *pipe, char *filename, size_t capacity, int number)
Request one saved photograph and qualify its acknowledgement/file.
Definition imx500_pipe.c:251
int imx500_pipe_start(struct imx500_pipe *pipe)
Replace any owned worker and require its exact READY response.
Definition imx500_pipe.c:149
READY/SHOT/OK process ownership without model-analysis semantics.
#define IMX500_PIPE_INITIALIZER
Safe empty lifecycle state: descriptor zero must never mean uninitialized.
Definition imx500_pipe.h:49
Small path and writable-directory helpers shared by USHER backends.
static int usher_prepare_photo(char *filename, size_t capacity)
Redirect an intended public photo into its same-filesystem private staging directory.
Definition path_utils.h:143
static const char * usher_resolve_path(const char *path, char *buffer, size_t buffer_size)
Expand a leading home-directory shorthand without allocating memory.
Definition path_utils.h:74
static int usher_ensure_directory(const char *path)
Create missing directory components and verify the final directory is writable.
Definition path_utils.h:97
Definition camera_backend.h:79
const volatile sig_atomic_t * running
Borrowed shutdown flag; backend workers must stop when it clears.
Definition camera_backend.h:81
One caller-serialized native worker and its borrowed configuration.
Definition imx500_pipe.h:35