# small-teton/mpeg-ts-analyzer architecture

> Architecture diagram of the GitHub repository small-teton/mpeg-ts-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/small-teton/mpeg-ts-analyzer
- Repository: https://github.com/small-teton/mpeg-ts-analyzer

## Overview

mpeg-ts-analyzer reads MPEG transport-stream files, analyzes a bounded range, and returns compliance findings and inspection data as text or JSON; its desktop GUI presents those results in linked views. The graph includes the documented timing, continuity, PSI/PES, synchronization, and reporting capabilities. The GUI-to-CLI workflow is visible in the excerpts and README; several analysis modules and GUI screens are represented from the tree and README, so their internal call relationships are not inferred.

Main entry points: [`gui/src/app.rs`](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/app.rs) (GUI shell), [`cmd/root.go`](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/cmd/root.go) (CLI command), [`gui/src/cli.rs`](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/cli.rs) (CLI subprocess), [`tsparser/mpeg_packet.go`](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/tsparser/mpeg_packet.go) (TS parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_cli["CLI command<br/>[root.go]"]
  node_output["Text and JSON<br/>[report.go]"]
end

subgraph group_engine["Analysis engine"]
  node_parser["TS parsing<br/>[mpeg_packet.go]"]
  node_timing["Timing checks<br/>[pcr.go]"]
  node_continuity["Continuity checks<br/>[continuity.go]"]
  node_psi["PSI health<br/>[psi_health.go]"]
  node_pes["PES health<br/>[pes.go]"]
  node_references["PID references<br/>[pid_references.go]"]
  node_sync["Synchronization<br/>[sync.go]"]
  node_gaps["Packet gaps<br/>[packet_gaps.go]"]
  node_mux["Mux lead<br/>[mux_lead.go]"]
end

subgraph group_desktop["Desktop GUI"]
  node_gui["GUI shell<br/>[app.rs]"]
  node_gui_cli["CLI subprocess<br/>[cli.rs]"]
  node_gui_report["Result models<br/>[report.rs]"]
  node_overview["Overview<br/>[overview.rs]"]
  node_timeline["Timeline<br/>[timeline.rs]"]
  node_bitrate["Bitrate<br/>[bitrate.rs]"]
  node_packets["Packet inspection<br/>[packets.rs]"]
  node_wire["Wire layout<br/>[wire_layout.rs]"]
  node_range["Range selection<br/>[range_bar.rs]"]
  node_settings["GUI settings<br/>[settings.rs]"]
end

subgraph group_integrations["External interfaces"]
  node_cli_process["Analyzer executable"]
end

node_user(("Analyst"))

node_user -->|"opens file"| node_gui
node_user -->|"runs analysis"| node_cli
node_cli -->|"uses parser"| node_parser
node_parser -->|"uses analysis"| node_timing
node_cli -.->|"emits results"| node_output
node_gui -->|"starts jobs"| node_gui_cli
node_gui_cli -->|"runs subprocess"| node_cli_process
node_gui_cli -->|"parses output"| node_gui_report
node_overview -->|"reads results"| node_gui_report
node_gui -->|"shows view"| node_overview
node_gui -->|"shows view"| node_timeline
node_gui -->|"shows view"| node_bitrate
node_gui -->|"shows view"| node_packets
node_packets -.->|"opens details"| node_wire
node_gui -->|"edits range"| node_range
node_gui -->|"uses settings"| node_settings

click node_cli "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/cmd/root.go"
click node_parser "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/tsparser/mpeg_packet.go"
click node_timing "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/pcr.go"
click node_continuity "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/continuity.go"
click node_psi "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/psi_health.go"
click node_pes "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/pes.go"
click node_references "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/pid_references.go"
click node_sync "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/sync.go"
click node_gaps "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/packet_gaps.go"
click node_mux "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/mux_lead.go"
click node_output "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/tsparser/report.go"
click node_gui "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/app.rs"
click node_gui_cli "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/cli.rs"
click node_gui_report "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/report.rs"
click node_overview "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/views/overview.rs"
click node_timeline "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/views/timeline.rs"
click node_bitrate "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/views/bitrate.rs"
click node_packets "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/views/packets.rs"
click node_wire "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/views/wire_layout.rs"
click node_range "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/range_bar.rs"
click node_settings "https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/settings.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_cli,node_output toneBlue
class node_parser,node_timing,node_continuity,node_psi,node_pes,node_references,node_sync,node_gaps,node_mux toneAmber
class node_gui,node_gui_cli,node_gui_report,node_overview,node_timeline,node_bitrate,node_packets,node_wire,node_range,node_settings toneMint
class node_cli_process toneRose
class node_user toneIndigo
```

## Components

### Entry points

- [CLI command](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/cmd/root.go): `cmd/root.go`
- [Text and JSON](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/tsparser/report.go): `tsparser/report.go`

### Analysis engine

- [TS parsing](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/tsparser/mpeg_packet.go): `tsparser/mpeg_packet.go`
- [Timing checks](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/pcr.go): `internal/analysis/pcr.go`
- [Continuity checks](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/continuity.go): `internal/analysis/continuity.go`
- [PSI health](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/psi_health.go): `internal/analysis/psi_health.go`
- [PES health](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/pes.go): `internal/analysis/pes.go`
- [PID references](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/pid_references.go): `internal/analysis/pid_references.go`
- [Synchronization](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/sync.go): `internal/analysis/sync.go`
- [Packet gaps](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/packet_gaps.go): `internal/analysis/packet_gaps.go`
- [Mux lead](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/internal/analysis/mux_lead.go): `internal/analysis/mux_lead.go`

### Desktop GUI

- [GUI shell](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/app.rs): `gui/src/app.rs`
- [CLI subprocess](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/cli.rs): `gui/src/cli.rs`
- [Result models](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/report.rs): `gui/src/report.rs`
- [Overview](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/views/overview.rs): `gui/src/views/overview.rs`
- [Timeline](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/views/timeline.rs): `gui/src/views/timeline.rs`
- [Bitrate](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/views/bitrate.rs): `gui/src/views/bitrate.rs`
- [Packet inspection](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/views/packets.rs): `gui/src/views/packets.rs`
- [Wire layout](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/views/wire_layout.rs): `gui/src/views/wire_layout.rs`
- [Range selection](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/range_bar.rs): `gui/src/range_bar.rs`
- [GUI settings](https://github.com/small-teton/mpeg-ts-analyzer/blob/master/gui/src/settings.rs): `gui/src/settings.rs`

### External interfaces

- **Analyzer executable**

### Other components

- **Analyst**

## Connections

- Analyst → GUI shell: opens file (evidence: `README.md`)
- Analyst → CLI command: runs analysis (evidence: `README.md`)
- CLI command → TS parsing: uses parser (evidence: `cmd/root.go`)
- TS parsing → Timing checks: uses analysis (evidence: `tsparser/mpeg_packet.go`)
- CLI command → Text and JSON: emits results
- GUI shell → CLI subprocess: starts jobs (evidence: `gui/src/app.rs`)
- CLI subprocess → Analyzer executable: runs subprocess (evidence: `README.md`)
- CLI subprocess → Result models: parses output (evidence: `gui/src/cli.rs`)
- Overview → Result models: reads results (evidence: `gui/src/views/overview.rs`)
- GUI shell → Overview: shows view (evidence: `gui/src/app.rs`)
- GUI shell → Timeline: shows view (evidence: `gui/src/app.rs`)
- GUI shell → Bitrate: shows view (evidence: `gui/src/app.rs`)
- GUI shell → Packet inspection: shows view (evidence: `gui/src/app.rs`)
- Packet inspection → Wire layout: opens details
- GUI shell → Range selection: edits range (evidence: `gui/src/app.rs`)
- GUI shell → GUI settings: uses settings (evidence: `gui/src/app.rs`)
