Summary
ZoneMinder 1.38 changed the SharedData struct layout in shared memory, adding new fields (image_count, latitude, longitude, capturing, analysing, recording, janus_pin, etc.) and renaming active → capturing. The struct size grew from 760 to 872 bytes.
Changes
- Replace inline Perl comment blocks with declarative
_LAYOUT_760 and _LAYOUT_872 tuple lists
- Add
_build_struct_info() helper to derive format string, field names, and string-field list from layouts
- Build a
_REGISTRY dict keyed by struct.calcsize() for automatic version detection
- Auto-detect ZM version by reading the
size field (first uint32) from shared memory and looking it up in the registry
- Extract TriggerData format to module-level constants
- Add backward-compatibility alias:
active ← capturing for ZM 1.38
Design
Adding support for a future ZM version requires only:
- Define a new
_LAYOUT_xxx list
- Append it to the registry loop
No if/else branches, no duplicate format strings.
Related: PR #58 by @jantman
Summary
ZoneMinder 1.38 changed the SharedData struct layout in shared memory, adding new fields (
image_count,latitude,longitude,capturing,analysing,recording,janus_pin, etc.) and renamingactive→capturing. The struct size grew from 760 to 872 bytes.Changes
_LAYOUT_760and_LAYOUT_872tuple lists_build_struct_info()helper to derive format string, field names, and string-field list from layouts_REGISTRYdict keyed bystruct.calcsize()for automatic version detectionsizefield (first uint32) from shared memory and looking it up in the registryactive←capturingfor ZM 1.38Design
Adding support for a future ZM version requires only:
_LAYOUT_xxxlistNo if/else branches, no duplicate format strings.
Related: PR #58 by @jantman