mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-07-13 14:42:27 -04:00
Replace the single alarm_image slot with an analysis_image_buffer ring of image_buffer_count Images living in the already-reserved alarm_images SHM region. Successive WriteAlarmImage calls rotate through the ring and publish last_analysis_index last (after the bytes and per-slot format), so a reader sampling last_analysis_index always sees a fully written slot. GetAlarmImage returns that slot, syncing its AVPixelFormat from the per-slot analysis_image_pixelformats array. SharedData gains last_analysis_index and analysis_image_count (plus 8 bytes of padding to keep the 16-byte-multiple layout), making it 888 bytes. The Perl (Memory.pm) and PHP (Monitor.php) SHM readers are updated in lockstep, and a static_assert(sizeof(SharedData)==888) in zm_monitor.h guards the layout against silent drift. This lets multiple in-flight analysis/annotated frames be buffered and streamed in sync rather than always overwriting one slot, and gives the AI object-detection work a place to publish annotated frames. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>