# nullmagic2/chop-chop architecture

> Architecture diagram of the GitHub repository nullmagic2/chop-chop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nullmagic2/chop-chop
- Repository: https://github.com/nullmagic2/chop-chop

## Overview

Chop Chop Splitter is a desktop video cutter with GTK on Ubuntu and a native Win32 interface on Windows. Users open a video, select a time range or configure a batch split, preview the selection, and start video or audio export; the shared FFmpeg engine probes media and performs the cutting. The graph keeps the two front ends distinct while showing their shared engine and translation layer. Some detailed UI-to-engine links are supported by the source index or README rather than complete call-site excerpts.

Main entry points: [`src/splitter.rs`](https://github.com/nullmagic2/chop-chop/blob/main/src/splitter.rs) (Probe and cut), [`windows/src/main.rs`](https://github.com/nullmagic2/chop-chop/blob/main/windows/src/main.rs) (Win32 interface), [`src/main.rs`](https://github.com/nullmagic2/chop-chop/blob/main/src/main.rs) (GTK interface), [`windows/src/app.rs`](https://github.com/nullmagic2/chop-chop/blob/main/windows/src/app.rs) (UI behavior)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gtk["Ubuntu interface"]
  node_gtk_app["GTK interface<br/>[main.rs]"]
end

subgraph group_win["Windows interface"]
  node_win_app["Win32 interface<br/>[main.rs]"]
  node_win_state["UI behavior<br/>[app.rs]"]
  node_win_dialogs["File dialogs<br/>[dialogs.rs]"]
  node_win_images["Preview images<br/>[image.rs]"]
end

subgraph group_engine["Media processing"]
  node_engine_core["Probe and cut<br/>[splitter.rs]"]
  node_preview["Frame previews<br/>[splitter.rs]"]
  node_batch["Batch splitting<br/>[splitter.rs]"]
  node_audio["Audio export<br/>[splitter.rs]"]
end

subgraph group_locale["Localization"]
  node_translations["Translations<br/>[i18n.rs]"]
end

node_user(("User"))
node_ffmpeg["FFmpeg"]
node_ffprobe["FFprobe"]
node_outputs["Exported files"]

node_user -->|"selects and exports"| node_gtk_app
node_user -->|"selects and exports"| node_win_app
node_gtk_app -->|"requests cuts"| node_engine_core
node_gtk_app -->|"requests previews"| node_preview
node_win_app -->|"creates interface"| node_win_state
node_win_app -->|"uses dialogs"| node_win_dialogs
node_win_app -->|"uses image tools"| node_win_images
node_win_state -->|"starts jobs"| node_engine_core
node_win_state -->|"requests frames"| node_preview
node_win_images -.->|"displays thumbnails"| node_preview
node_engine_core -->|"probes media"| node_ffprobe
node_engine_core -->|"cuts and encodes"| node_ffmpeg
node_engine_core -->|"supports batch mode"| node_batch
node_engine_core -->|"exports audio"| node_audio
node_engine_core -->|"writes exports"| node_outputs
node_gtk_app -->|"uses strings"| node_translations
node_win_app -->|"uses strings"| node_translations

click node_gtk_app "https://github.com/nullmagic2/chop-chop/blob/main/src/main.rs"
click node_win_app "https://github.com/nullmagic2/chop-chop/blob/main/windows/src/main.rs"
click node_win_state "https://github.com/nullmagic2/chop-chop/blob/main/windows/src/app.rs"
click node_win_dialogs "https://github.com/nullmagic2/chop-chop/blob/main/windows/src/dialogs.rs"
click node_win_images "https://github.com/nullmagic2/chop-chop/blob/main/windows/src/image.rs"
click node_engine_core "https://github.com/nullmagic2/chop-chop/blob/main/src/splitter.rs"
click node_preview "https://github.com/nullmagic2/chop-chop/blob/main/src/splitter.rs"
click node_batch "https://github.com/nullmagic2/chop-chop/blob/main/src/splitter.rs"
click node_audio "https://github.com/nullmagic2/chop-chop/blob/main/src/splitter.rs"
click node_translations "https://github.com/nullmagic2/chop-chop/blob/main/src/i18n.rs"

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_gtk_app,node_user toneBlue
class node_win_app,node_win_state,node_win_dialogs,node_win_images toneAmber
class node_engine_core,node_preview,node_batch,node_audio toneMint
class node_translations toneRose
class node_ffmpeg,node_ffprobe,node_outputs toneIndigo
```

## Components

### Ubuntu interface

- [GTK interface](https://github.com/nullmagic2/chop-chop/blob/main/src/main.rs): `src/main.rs`

### Windows interface

- [Win32 interface](https://github.com/nullmagic2/chop-chop/blob/main/windows/src/main.rs): `windows/src/main.rs`
- [UI behavior](https://github.com/nullmagic2/chop-chop/blob/main/windows/src/app.rs): `windows/src/app.rs`
- [File dialogs](https://github.com/nullmagic2/chop-chop/blob/main/windows/src/dialogs.rs): `windows/src/dialogs.rs`
- [Preview images](https://github.com/nullmagic2/chop-chop/blob/main/windows/src/image.rs): `windows/src/image.rs`

### Media processing

- [Probe and cut](https://github.com/nullmagic2/chop-chop/blob/main/src/splitter.rs): `src/splitter.rs`
- [Frame previews](https://github.com/nullmagic2/chop-chop/blob/main/src/splitter.rs): `src/splitter.rs`
- [Batch splitting](https://github.com/nullmagic2/chop-chop/blob/main/src/splitter.rs): `src/splitter.rs`
- [Audio export](https://github.com/nullmagic2/chop-chop/blob/main/src/splitter.rs): `src/splitter.rs`

### Localization

- [Translations](https://github.com/nullmagic2/chop-chop/blob/main/src/i18n.rs): `src/i18n.rs`

### Other components

- **User**
- **FFmpeg**
- **FFprobe**
- **Exported files**

## Connections

- User → GTK interface: selects and exports (evidence: `README.md`)
- User → Win32 interface: selects and exports (evidence: `README.md`)
- GTK interface → Probe and cut: requests cuts (evidence: `src/main.rs`)
- GTK interface → Frame previews: requests previews (evidence: `src/main.rs`)
- Win32 interface → UI behavior: creates interface (evidence: `windows/src/main.rs`)
- Win32 interface → File dialogs: uses dialogs (evidence: `windows/src/main.rs`)
- Win32 interface → Preview images: uses image tools (evidence: `windows/src/main.rs`)
- UI behavior → Probe and cut: starts jobs (evidence: `windows/src/app.rs`)
- UI behavior → Frame previews: requests frames (evidence: `windows/src/app.rs`)
- Preview images → Frame previews: displays thumbnails
- Probe and cut → FFprobe: probes media (evidence: `src/splitter.rs`)
- Probe and cut → FFmpeg: cuts and encodes (evidence: `README.md`)
- Probe and cut → Batch splitting: supports batch mode (evidence: `README.md`)
- Probe and cut → Audio export: exports audio (evidence: `README.md`)
- Probe and cut → Exported files: writes exports (evidence: `README.md`)
- GTK interface → Translations: uses strings (evidence: `src/main.rs`)
- Win32 interface → Translations: uses strings (evidence: `windows/src/main.rs`)
