Files
gx f8e27b9e85 Phase 10/11 WIP — pool + motion-mode + 8×8 templates (rolled back)
Объединённое состояние работ:
  - Phase 10: source pool, motion-driven layout, Frigate motion_pulse,
    zone-filter в pool, --source / --motion-mode CLI
  - Phase 11 Steps 1-3c: 8×8 микро-сетка, JSON templates с asymmetric
    layouts (tpl_1/3/4/5/6/7/8), reload через ZMQ, auto-labels per camera

В прод отдеплоено и откачено: используем gx/cuframes-composer:0.10 как
baseline. Phase 11 продолжится в branch phase11b-cpp как C++ refactor
с ООП-моделью Cell/Layout/Decoration.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-03 21:24:23 +01:00

58 lines
2.2 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* cuframes-composer — Frigate MQTT subscriber для detection overlay'ев.
*
* Subscribe на frigate/events topic, парсит JSON, lookup'ит overlay по
* camera_key, вызывает cfc_overlay_detbox_upsert / _end. Сам цикл и
* reconnect handle'ит mosquitto_loop_forever (паттерн отработан).
*
* Lifecycle:
* register_overlay(ov) для каждого CFC_OVERLAY_DETECTION_BOXES (composer
* map'ит camera_key → overlay внутри себя)
* create() → connect_async + loop_start → background thread
* destroy() → disconnect + loop_stop
*
* Лицензия: LGPL-2.1+
*/
#ifndef CUFRAMES_COMPOSER_FRIGATE_MQTT_H
#define CUFRAMES_COMPOSER_FRIGATE_MQTT_H
#include "composer.h"
#include "overlay.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct cfc_frigate_mqtt_config {
const char *host; /* "cctv-mosquitto" */
int port; /* 1883 */
const char *username; /* MQTT user — обычно тот же, что у health */
const char *password;
const char *topic; /* default "frigate/events" */
/* Если задан — каждое new/update event для любой камеры вызывает
* cfc_composer_motion_pulse(composer, after.camera). Это драйвер для
* motion-driven auto-layout (Phase 10). NULL = motion-pulse не шлём. */
cfc_composer_t *composer;
} cfc_frigate_mqtt_config_t;
typedef struct cfc_frigate_mqtt cfc_frigate_mqtt_t;
int cfc_frigate_mqtt_create(const cfc_frigate_mqtt_config_t *cfg,
cfc_frigate_mqtt_t **out);
/* Зарегистрировать overlay для определённой камеры. Composer вызывает это
* для каждого CFC_OVERLAY_DETECTION_BOXES overlay'я до connect'а. */
int cfc_frigate_mqtt_register_overlay(cfc_frigate_mqtt_t *f,
cfc_overlay_t *ov);
/* Запустить connect + loop_start (вызывать ПОСЛЕ всех register_overlay'ев). */
int cfc_frigate_mqtt_start(cfc_frigate_mqtt_t *f);
int cfc_frigate_mqtt_destroy(cfc_frigate_mqtt_t *f);
#ifdef __cplusplus
}
#endif
#endif /* CUFRAMES_COMPOSER_FRIGATE_MQTT_H */