# t-richards/medialint architecture

> Architecture diagram of the GitHub repository t-richards/medialint, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/t-richards/medialint
- Repository: https://github.com/t-richards/medialint

## Overview

##### Core Components
- Input Handler (File System Traversal)
- Media Analysis Engine
- Reporting System
- Main Controller

##### External Dependencies
- FFmpeg Libraries (libavcodec, libavformat, libavutil)
- GLib 2.0
- File System Interface

##### Component Breakdown

a. Input Layer:
- Directory input
- To the file traversal system (nftw-based)

b. Processing Core (Center):
- Media Analyzer (linter.c/h) - Connect to FFmpeg libraries
- File Processor (main.c) - Show parallel processing capability
- Report Generator (report.c/h) - Results aggregation
- Use green for internal components

c. External Dependencies Layer:
- FFmpeg libraries at the bottom
- GLib 2.0 utilities
- Use yellow for external dependencies

##### Interaction Flows

Specific Implementation Details:

**[Directory Input] → [File Traversal System]**
- ↓
**[Parallel Processing Controller]**
- ↓
- ┌────┴────┐
- ↓         ↓
**[Media Analyzer] [File Processor]**
- ↓         ↓
- ┬────┘
- ↓
**[Report Generator]**
- ↓
**[Console Output]**

Important Elements to Highlight:

##### Parallel Processing
- Multiple analysis threads
- How files are distributed

##### Media Analysis
- To FFmpeg libraries
- Codec/container analysis flow
- Subtitle checking

##### Reporting
- Aggregation of results
- Error classification system

- Rectangles: Core components
- Hexagons: Input/Output points
- Blue: External interactions
- Green: Internal processes
- Yellow: Dependencies
- Red: Error handling paths

Annotations for:
- Parallel processing capabilities
- File system limitations (Unix-like platforms)
- Media format support through FFmpeg
- Performance characteristics

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Define styles
    classDef external fill:#ADD8E6,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef dependency fill:#FFE4B5,stroke:#333
    classDef input fill:#FFB6C1,stroke:#333
    classDef output fill:#DDA0DD,stroke:#333

    %% Input Layer
    Input[/"Directory Input"/]:::input
    FileSystem["File System Traversal"]:::external

    %% Main Controller
    MainController["Main Controller"]:::core
    click MainController "https://github.com/t-richards/medialint/blob/main/src/main.c"

    %% Processing Core
    subgraph ProcessingCore["Processing Core"]
        ParallelProcessor["Parallel Processing Controller"]:::core
        
        subgraph Analysis["Analysis Components"]
            MediaAnalyzer["Media Analyzer"]:::core
            click MediaAnalyzer "https://github.com/t-richards/medialint/blob/main/src/linter.c"
            FileProcessor["File Processor"]:::core
        end
        
        ReportGen["Report Generator"]:::core
        click ReportGen "https://github.com/t-richards/medialint/blob/main/src/report.c"
    end

    %% External Dependencies
    subgraph ExternalDeps["External Dependencies"]
        FFmpeg["FFmpeg Libraries"]:::dependency
        GLib["GLib 2.0"]:::dependency
    end

    %% Output
    Output[/"Console Output"/]:::output

    %% Build System
    BuildSystem["Build System"]:::external
    click BuildSystem "https://github.com/t-richards/medialint/tree/main/Makefile"

    %% CI/CD
    CICD["CI/CD Pipeline"]:::external
    click CICD "https://github.com/t-richards/medialint/blob/main/.github/workflows/build.yml"

    %% Connections
    Input --> FileSystem
    FileSystem --> MainController
    MainController --> ParallelProcessor
    ParallelProcessor --> MediaAnalyzer & FileProcessor
    MediaAnalyzer & FileProcessor --> ReportGen
    ReportGen --> Output
    
    %% Dependency Connections
    FFmpeg -.-> MediaAnalyzer
    GLib -.-> FileSystem
    BuildSystem -.-> MainController
    CICD -.-> BuildSystem

    %% Legend
    subgraph Legend
        L1[/"Input/Output"/]:::input
        L2["Core Components"]:::core
        L3["External Systems"]:::external
        L4["Dependencies"]:::dependency
    end
```
