# eyevinn/hls-vodtolive architecture

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

- Interactive diagram: https://gitdiagram.com/eyevinn/hls-vodtolive
- Repository: https://github.com/eyevinn/hls-vodtolive

## Overview

##### Main Components Identification
The system should be represented with these key components:

a) Core Components:
- HLS VOD Parser
- Live Manifest Generator
- Media Sequence Manager
- Subtitle Handler
- VOD Concatenation Engine

b) External Interfaces:
- Input: HLS VOD Sources
- Output: Live HLS Streams
- Subtitle Services (dummy and slice endpoints)

**[Input Sources] → [Core Processing] → [Output Streams]**

##### Component Relationships

Key flows:

**[HLS VOD Sources] →**
- [VOD Parser] →
- [Media Sequence Manager] ↔ [VOD Concatenation Engine]
- ↓
- [Live Manifest Generator]
- ↓
**[Live HLS Output]**

**[Subtitle Services] - - → [Subtitle Handler] - - → [Media Sequence Manager]**

##### Important Elements

a) Data Flow Annotations:
- VOD manifest ingestion
- Media sequence generation
- Discontinuity handling
- Subtitle track management

b) Key Processing Points:
- Media sequence calculation
- Discontinuity sequence handling
- Bitrate adaptation
- Timeline management

##### Implementation Details to Highlight

Crucial aspects:
- Multiple bitrate handling
- Discontinuity boundary management
- Subtitle track integration
- VOD concatenation points

##### The concatenation mechanism for multiple VODs

Use standardized symbols:
- Rectangles: Processing components
- Double lines: API boundaries

- How VOD content is processed
- Where transformations occur
- How multiple VODs are concatenated
- How the live output is generated
- Where subtitle handling fits in
- The overall data flow through the system

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        VOD[HLS VOD Sources]:::input
        SUBS[Subtitle Services]:::external
    end

    subgraph Core
        PARSER[HLS VOD Parser]:::core
        MSM[Media Sequence Manager]:::core
        CONCAT[VOD Concatenation Engine]:::core
        LIVE_GEN[Live Manifest Generator]:::core
        SUBH[Subtitle Handler]:::optional
    end

    subgraph Output
        LIVE[Live HLS Output]:::output
    end

    %% Main Flow
    VOD --> PARSER
    PARSER --> MSM
    MSM <--> CONCAT
    MSM --> LIVE_GEN
    LIVE_GEN --> LIVE

    %% Subtitle Flow
    SUBS -.-> SUBH
    SUBH -.-> MSM

    %% Component Annotations
    VOD -- "Multiple VOD Sources<br/>Multiple Bitrates" --> PARSER
    PARSER -- "Manifest Parsing<br/>Timeline Analysis" --> MSM
    MSM -- "Sequence Management<br/>Discontinuity Handling" --> LIVE_GEN
    CONCAT -- "Seamless VOD<br/>Concatenation" --> MSM
    LIVE_GEN -- "Live Stream Generation<br/>Bitrate Adaptation" --> LIVE

    %% Click Events
    click PARSER "https://github.com/Eyevinn/hls-vodtolive/blob/master/index.js"
    click SUBH "https://github.com/Eyevinn/hls-vodtolive/tree/master/testvectors/hls_subs/"
    click MSM "https://github.com/Eyevinn/hls-vodtolive/blob/master/utils.js"
    click VOD "https://github.com/Eyevinn/hls-vodtolive/tree/master/testvectors/hls_abr3/"

    %% Styles
    classDef input fill:#2374f7,stroke:#000,stroke-width:2px,color:#fff
    classDef output fill:#2374f7,stroke:#000,stroke-width:2px,color:#fff
    classDef core fill:#47d147,stroke:#000,stroke-width:2px
    classDef external fill:#ffd700,stroke:#000,stroke-width:2px
    classDef optional fill:#808080,stroke:#000,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Input/Output]:::input
        L2[Core Components]:::core
        L3[External Services]:::external
        L4[Optional Components]:::optional
    end
```
