# roleoroleo/yi-hack-allwinner architecture

> Architecture diagram of the GitHub repository roleoroleo/yi-hack-allwinner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/roleoroleo/yi-hack-allwinner
- Repository: https://github.com/roleoroleo/yi-hack-allwinner

## Overview

yi-hack-Allwinner is modified firmware for Allwinner-based Yi cameras. The principal user workflow is to connect to the camera’s web interface, configure camera features or inspect recordings, and access camera outputs such as snapshots and RTSP streams. The graph also preserves documented ONVIF, MQTT, timelapse, maintenance, and camera-control capabilities. The sampled source shows implementation details for IPC commands, snapshot conversion, MQTT transport, and RTSP session handling; several other documented subsystems are represented at their available directory or UI paths, with uncertain links omitted.

Main entry points: [`src/www/httpd/htdocs/js/app.js`](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/app.js) (Web Interface), [`src/snapshot/snapshot/imggrabber.c`](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/snapshot/snapshot/imggrabber.c) (Snapshot Service), [`src/mqtt-config/mqtt-config/mqtt_wolf.c`](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/mqtt-config/mqtt-config/mqtt_wolf.c) (MQTT Client), [`src/www/httpd/htdocs/js/modules/camera_settings.js`](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/camera_settings.js) (Camera Settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Interface"]
  node_webui["Web Interface<br/>[app.js]"]
  node_settings["Camera Settings<br/>[camera_settings.js]"]
  node_events["Motion Events<br/>[eventsdir.js]"]
  node_eventvideo["Recorded Video<br/>[eventsfile.js]"]
  node_ptzui["PTZ Controls<br/>[ptz.js]"]
  node_timelapse["Timelapse UI<br/>[timelapse.js]"]
  node_snapshotui["Snapshot UI<br/>[snapshot.js]"]
  node_configui["Configuration UI<br/>[configurations.js]"]
  node_websettings["Network Settings<br/>[wifi.js]"]
end

subgraph group_media["Media Services"]
  node_snapshot["Snapshot Service<br/>[imggrabber.c]"]
  node_jpeg["JPEG Conversion<br/>[convert2jpg.c]"]
  node_watermark["Watermarking<br/>[add_water.c]"]
  node_rtsp["RTSP Server<br/>[rRTSPServer.cpp]"]
  node_ondemand["RTSP Sessions"]
  node_h264["Video Sources"]
end

subgraph group_control["Camera Control"]
  node_ipc["IPC Commands<br/>[ipc_cmd.c]"]
  node_ptz["PTZ Commands<br/>[ptz.c]"]
end

subgraph group_integration["Integrations"]
  node_onvif["ONVIF Server"]
  node_mqttconfig["MQTT Configuration<br/>[config.c]"]
  node_mqtt["MQTT Client<br/>[mqtt_wolf.c]"]
end

subgraph group_system["Firmware Operations"]
  node_maintenance["Maintenance<br/>[maintenance.js]"]
end

node_operator(("Camera User"))
node_broker(("MQTT Broker"))
node_camera(("Camera Platform"))

node_operator -->|"opens"| node_webui
node_webui -.->|"offers"| node_settings
node_webui -.->|"offers"| node_events
node_webui -.->|"offers"| node_eventvideo
node_webui -.->|"offers"| node_ptzui
node_webui -.->|"offers"| node_maintenance
node_webui -.->|"offers"| node_timelapse
node_webui -.->|"offers"| node_snapshotui
node_webui -.->|"offers"| node_configui
node_webui -.->|"offers"| node_websettings
node_operator -->|"requests stream"| node_rtsp
node_operator -->|"requests image"| node_snapshot
node_snapshot -->|"converts frames"| node_jpeg
node_snapshot -->|"adds watermark"| node_watermark
node_rtsp -.->|"creates sessions"| node_ondemand
node_ondemand -.->|"dispatches video"| node_h264
node_operator -->|"uses services"| node_onvif
node_operator -->|"receives events"| node_mqtt
node_mqtt -.->|"publishes events"| node_broker
node_mqttconfig -.->|"configures client"| node_mqtt
node_settings -.->|"sets camera options"| node_ipc
node_ptzui -.->|"sends PTZ commands"| node_ptz
node_ipc -.->|"controls features"| node_camera
node_ptz -.->|"moves camera"| node_camera
node_operator -->|"operates camera"| node_camera

click node_webui "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/app.js"
click node_settings "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/camera_settings.js"
click node_events "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/eventsdir.js"
click node_eventvideo "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/eventsfile.js"
click node_ptzui "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/ptz.js"
click node_maintenance "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/maintenance.js"
click node_timelapse "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/timelapse.js"
click node_snapshotui "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/snapshot.js"
click node_snapshot "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/snapshot/snapshot/imggrabber.c"
click node_jpeg "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/snapshot/snapshot/convert2jpg.c"
click node_watermark "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/snapshot/snapshot/add_water.c"
click node_rtsp "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/rRTSPServer/src/rRTSPServer.cpp"
click node_ondemand "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/rRTSPServer/src/OnDemandServerMediaSubsession_BC.cpp"
click node_h264 "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/rRTSPServer/src/H264VideoFramedMemoryServerMediaSubsession.cpp"
click node_ipc "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/ipc_cmd/ipc_cmd/ipc_cmd.c"
click node_ptz "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/ipc_cmd/ipc_cmd/ptz.c"
click node_onvif "https://github.com/roleoroleo/yi-hack-allwinner/tree/master/src/onvif_simple_server"
click node_mqttconfig "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/mqtt-config/mqtt-config/config.c"
click node_mqtt "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/mqtt-config/mqtt-config/mqtt_wolf.c"
click node_configui "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/configurations.js"
click node_websettings "https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/wifi.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webui,node_settings,node_events,node_eventvideo,node_ptzui,node_timelapse,node_snapshotui,node_configui,node_websettings,node_operator toneBlue
class node_snapshot,node_jpeg,node_watermark,node_rtsp,node_ondemand,node_h264 toneAmber
class node_ipc,node_ptz toneMint
class node_onvif,node_mqttconfig,node_mqtt toneRose
class node_maintenance,node_broker,node_camera toneIndigo
```

## Components

### Web Interface

- [Web Interface](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/app.js): `src/www/httpd/htdocs/js/app.js`
- [Camera Settings](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/camera_settings.js): `src/www/httpd/htdocs/js/modules/camera_settings.js`
- [Motion Events](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/eventsdir.js): `src/www/httpd/htdocs/js/modules/eventsdir.js`
- [Recorded Video](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/eventsfile.js): `src/www/httpd/htdocs/js/modules/eventsfile.js`
- [PTZ Controls](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/ptz.js): `src/www/httpd/htdocs/js/modules/ptz.js`
- [Timelapse UI](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/timelapse.js): `src/www/httpd/htdocs/js/modules/timelapse.js`
- [Snapshot UI](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/snapshot.js): `src/www/httpd/htdocs/js/modules/snapshot.js`
- [Configuration UI](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/configurations.js): `src/www/httpd/htdocs/js/modules/configurations.js`
- [Network Settings](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/wifi.js): `src/www/httpd/htdocs/js/modules/wifi.js`

### Media Services

- [Snapshot Service](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/snapshot/snapshot/imggrabber.c): `src/snapshot/snapshot/imggrabber.c`
- [JPEG Conversion](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/snapshot/snapshot/convert2jpg.c): `src/snapshot/snapshot/convert2jpg.c`
- [Watermarking](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/snapshot/snapshot/add_water.c): `src/snapshot/snapshot/add_water.c`
- [RTSP Server](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/rRTSPServer/src/rRTSPServer.cpp): `src/rRTSPServer/src/rRTSPServer.cpp`
- [RTSP Sessions](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/rRTSPServer/src/OnDemandServerMediaSubsession_BC.cpp): `src/rRTSPServer/src/OnDemandServerMediaSubsession_BC.cpp`
- [Video Sources](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/rRTSPServer/src/H264VideoFramedMemoryServerMediaSubsession.cpp): `src/rRTSPServer/src/H264VideoFramedMemoryServerMediaSubsession.cpp`

### Camera Control

- [IPC Commands](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/ipc_cmd/ipc_cmd/ipc_cmd.c): `src/ipc_cmd/ipc_cmd/ipc_cmd.c`
- [PTZ Commands](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/ipc_cmd/ipc_cmd/ptz.c): `src/ipc_cmd/ipc_cmd/ptz.c`

### Integrations

- [ONVIF Server](https://github.com/roleoroleo/yi-hack-allwinner/tree/master/src/onvif_simple_server): `src/onvif_simple_server`
- [MQTT Configuration](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/mqtt-config/mqtt-config/config.c): `src/mqtt-config/mqtt-config/config.c`
- [MQTT Client](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/mqtt-config/mqtt-config/mqtt_wolf.c): `src/mqtt-config/mqtt-config/mqtt_wolf.c`

### Firmware Operations

- [Maintenance](https://github.com/roleoroleo/yi-hack-allwinner/blob/master/src/www/httpd/htdocs/js/modules/maintenance.js): `src/www/httpd/htdocs/js/modules/maintenance.js`

### Other components

- **Camera User**
- **MQTT Broker**
- **Camera Platform**

## Connections

- Camera User → Web Interface: opens
- Web Interface → Camera Settings: offers
- Web Interface → Motion Events: offers
- Web Interface → Recorded Video: offers
- Web Interface → PTZ Controls: offers
- Web Interface → Maintenance: offers
- Web Interface → Timelapse UI: offers
- Web Interface → Snapshot UI: offers
- Web Interface → Configuration UI: offers
- Web Interface → Network Settings: offers
- Camera User → RTSP Server: requests stream
- Camera User → Snapshot Service: requests image
- Snapshot Service → JPEG Conversion: converts frames (evidence: `src/snapshot/snapshot/imggrabber.c`)
- Snapshot Service → Watermarking: adds watermark (evidence: `src/snapshot/snapshot/imggrabber.c`)
- RTSP Server → RTSP Sessions: creates sessions
- RTSP Sessions → Video Sources: dispatches video
- Camera User → ONVIF Server: uses services
- Camera User → MQTT Client: receives events
- MQTT Client → MQTT Broker: publishes events
- MQTT Configuration → MQTT Client: configures client
- Camera Settings → IPC Commands: sets camera options
- PTZ Controls → PTZ Commands: sends PTZ commands
- IPC Commands → Camera Platform: controls features
- PTZ Commands → Camera Platform: moves camera
- Camera User → Camera Platform: operates camera
