How nikola-ver/video-recording works
Project Type and Purpose
• This is a native Windows desktop application written in C++/Win32 (Visual Studio solution) for recording screen regions to GIFs.
• It uses OS‑level hotkeys, a custom UI overlay for zone selection, and delegates GIF encoding to the external ImageMagick CLI tool. Installer and autorun scripts (VBScript) simplify deployment.
Main Components
a. UI Layer
• Hotkey Manager: registers “Shift+Win+C”, “F2”, “Win+Esc”, “Shift+Win+O/V” via Win32 RegisterHotKey.
• Selection Overlay: full‑screen transparent window for mouse‐drag to select recording area.
b. Recording Engine
• Frame Capturer: uses BitBlt/GDI to grab the selected rectangle on each timer tick.
• Buffer Manager: holds raw bitmaps or writes temporary BMP files.
• Session Controller: start/stop logic driven by hotkeys.
c. Configuration Module
• Reads/writes options.dat to persist user settings.
d. External GIF Encoder
• Invokes ImageMagick’s “convert” (via shell command) to compress captured frames into an animated GIF.
e. Persistence & File System
• Manages output directory (“GIF” folder), temporary files, and final storage.
f. Deployment Scripts
• Setup.vbs: launches installer and ensures ImageMagick is installed.
• Autorun.vbs: places shortcut in user’s Startup folder for automatic launch.
Relationships & Data Flows
• UI Layer → Session Controller: “startRecording()” / “stopRecording()” signals
• Session Controller → Frame Capturer: on each timer tick, capture screen region → Buffer Manager
• After stop: Buffer Manager → External GIF Encoder (shell out) → writes GIF to disk
• Configuration Module ↔ Options Dialog: read/write user settings
• Deployment Scripts → OS Startup Folder & ImageMagick installation
Architectural Patterns & Principles
• Layered Design: clear separation between UI, core recording engine, and external service wrapper.
• Single Responsibility: each module (capture, config, encoding) handles a distinct concern.
• OS‑Integration Adapter: thin layer encapsulating Win32 APIs (hotkeys, GDI, file I/O).
• External Dependency Isolation: all calls to ImageMagick go through a single “ConvertLauncher” component.
Detailed Steps
– UI Layer (Hotkey Manager, Selection Overlay, Options Dialog)
– Recording Engine (Frame Capturer, Buffer Manager, Session Controller)
– Config Module (options.dat)
– GIF Encoder Adapter
– ImageMagick CLI (as external service)
– OS/Win32 APIs (hotkey registry, GDI, file I/O)
– File System (GIF output folder)
– Deployment Scripts (Setup.vbs, Autorun.vbs)
d. Connect:
– UI → Engine (control commands)
– Engine → OS/GDI (capture calls)
– Engine → Buffer Manager → GIF Encoder
– GIF Encoder → ImageMagick → File System
– UI ↔ Config Module (read/write settings)
– Deployment Scripts → OS Startup & Installer UI