How gtxaspec/prudynt-t works
Project type and purpose
• prudynt-t is an embedded video server daemon for Ingenic-based cameras (e.g., Wyze v3 and Thingino hardware).
• It captures raw video and audio from the camera SoC, encodes streams (H264/H265 for video, AAC/PCMU for audio), and exposes them over RTSP (for video+audio playback) and a WebSocket backchannel (for two-way audio/control).
File structure
• Top-level build and CI: Dockerfile, Makefile, build scripts (build.sh, buildroot_dev.sh), .github/workflows/pru.yaml.
• Resources and patches: res/ directory contains library patches and logos.
• Dependency builders: scripts/ for building libhelixaac, libwebsockets, opus, etc.
• Core code in src/: organized into
• Hardware abstraction & system init: IMPSystem, Config, ConfigWatcher
• Media sources: IMPDeviceSource, IMPFrameSource, AudioReframer
• Encoders & formats: AACEncoder, Opus, JPEGWorker, Motion (on-the-fly motion detection)
• Worker threads: VideoWorker, AudioWorker, BackchannelWorker, each using a RingBuffer and WorkerUtils
• Sinks and RTSP glue: AACSink, BackchannelSink, BackchannelServerMediaSubsession, IMP*ServerMediaSubsession, RTSP
• Networking & control: WS (WebSocket handling), MsgChannel
• Utilities: Logger, OSD (on-screen display overlays)
• Entry point: main.cpp
Extract architectural insights from README
• Describes two-way audio, video codecs, Thingino integration
• Build instructions show dependency on Buildroot or Docker isolation
a. Main components
1. Hardware & ISA: Ingenic SoC running Linux + libimp_control
2. Device Source Layer: IMPDeviceSource / IMPFramesource
3. Processing Pipelines:
• Video Pipeline: VideoWorker → Motion & JPEGWorker (optional) → H264/H265 encoder (via internal IMPEncoder)
• Audio Pipeline: AudioWorker → AudioReframer → AACEncoder / Opus
4. Buffering: RingBuffer between producers and consumers
5. Sink & Streaming Layer:
• AACSink / BackchannelSink → RTSP Server subsessions (ServerMediaSubsession)
• Backchannel (two-way): WebSocket server (WS) + BackchannelServerMediaSubsession
6. Control & Config: ConfigWatcher / Config reloads settings at runtime, WS for control messages
7. Utilities: Logging, OSD
8. External Clients: RTSP clients (VLC, etc.), WebSocket clients (mobile/JS UIs)
b. Relationships and interactions
• Device Source → ring buffers → Worker threads
• Workers invoke encoders, feed encoded frames to sinks
• Sinks push to RTSP server subsessions (video+audio multiplexed) or to WebSocket stream
• ConfigWatcher notifies workers and sinks on config changes
• Logger is invoked by every layer for debug/status output
c. Architectural patterns & principles
• Modular pipeline stages connected by thread-safe queues (producer/consumer)
• Separation of concerns: sources, processing, sinks, network layers
• Plugin-like subsessions for RTSP streaming (Live555)
• Hot-reloadable config via watcher
• Hardware abstraction (IMPSystem, libimp_control)
d. Key technologies & libraries
• Live555 (RTSP stack)
• libimp_control (Ingenic hardware interface)
• AAC (libhelix-aac), Opus, WebSockets (libwebsockets)
• Buildroot/Docker for cross-compilation
Detail
• Shared resources (e.g., ring buffers) explicitly.
• Third-party libraries at their integration points.