# mplakalovi1/pyhas architecture

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

- Interactive diagram: https://gitdiagram.com/mplakalovi1/pyhas
- Repository: https://github.com/mplakalovi1/pyhas

## Overview

PyHAS is a command-line HTTP adaptive-streaming emulation client. Its main workflow reads configuration, fetches and parses an MPD manifest, downloads initialization data, then selects and downloads media segments while tracking bandwidth and buffer state. The player coordinates these stages and chooses either Lsrb or Osrb adaptation. The README provides only the product name; the graph’s implementation links are based on the sampled source, so undocumented capabilities are not inferred.

Main entry points: [`player.py`](https://github.com/mplakalovi1/pyhas/blob/master/player.py) (Playback controller), [`HTTP.py`](https://github.com/mplakalovi1/pyhas/blob/master/HTTP.py) (HTTP client), [`xmlparser.py`](https://github.com/mplakalovi1/pyhas/blob/master/xmlparser.py) (MPD parser), [`algorithm.py`](https://github.com/mplakalovi1/pyhas/blob/master/algorithm.py) (Lsrb selector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Playback orchestration"]
  node_config["Stream configuration<br/>[config.ini]"]
  node_player["Playback controller<br/>[player.py]"]
end

subgraph group_streaming["Manifest and transport"]
  node_manifest["MPD parser<br/>[xmlparser.py]"]
  node_http["HTTP client<br/>[HTTP.py]"]
end

subgraph group_adaptation["Adaptive selection"]
  node_lsrb["Lsrb selector<br/>[algorithm.py]"]
  node_osrb["Osrb selector<br/>[algorithm.py]"]
end

node_user(("Client operator"))
node_server(("Streaming server"))

node_user -->|"runs client"| node_player
node_player -->|"reads settings"| node_config
node_player -->|"requests manifest"| node_http
node_http -->|"fetches resources"| node_server
node_http -->|"returns response"| node_player
node_player -->|"parses manifest"| node_manifest
node_manifest -->|"provides stream metadata"| node_player
node_player -->|"selects when configured"| node_lsrb
node_player -->|"selects when configured"| node_osrb
node_player -->|"downloads initialization and segments"| node_http
node_player -->|"updates selection"| node_lsrb
node_player -->|"updates selection"| node_osrb

click node_config "https://github.com/mplakalovi1/pyhas/blob/master/config.ini"
click node_player "https://github.com/mplakalovi1/pyhas/blob/master/player.py"
click node_manifest "https://github.com/mplakalovi1/pyhas/blob/master/xmlparser.py"
click node_http "https://github.com/mplakalovi1/pyhas/blob/master/HTTP.py"
click node_lsrb "https://github.com/mplakalovi1/pyhas/blob/master/algorithm.py"
click node_osrb "https://github.com/mplakalovi1/pyhas/blob/master/algorithm.py"

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_config,node_player,node_user toneBlue
class node_manifest,node_http toneAmber
class node_lsrb,node_osrb,node_server toneMint
```

## Components

### Playback orchestration

- [Stream configuration](https://github.com/mplakalovi1/pyhas/blob/master/config.ini): `config.ini`
- [Playback controller](https://github.com/mplakalovi1/pyhas/blob/master/player.py): `player.py`

### Manifest and transport

- [MPD parser](https://github.com/mplakalovi1/pyhas/blob/master/xmlparser.py): `xmlparser.py`
- [HTTP client](https://github.com/mplakalovi1/pyhas/blob/master/HTTP.py): `HTTP.py`

### Adaptive selection

- [Lsrb selector](https://github.com/mplakalovi1/pyhas/blob/master/algorithm.py): `algorithm.py`
- [Osrb selector](https://github.com/mplakalovi1/pyhas/blob/master/algorithm.py): `algorithm.py`

### Other components

- **Client operator**
- **Streaming server**

## Connections

- Client operator → Playback controller: runs client
- Playback controller → Stream configuration: reads settings (evidence: `player.py`)
- Playback controller → HTTP client: requests manifest (evidence: `player.py`)
- HTTP client → Streaming server: fetches resources (evidence: `HTTP.py`)
- HTTP client → Playback controller: returns response (evidence: `HTTP.py`)
- Playback controller → MPD parser: parses manifest (evidence: `player.py`)
- MPD parser → Playback controller: provides stream metadata (evidence: `player.py`)
- Playback controller → Lsrb selector: selects when configured (evidence: `player.py`)
- Playback controller → Osrb selector: selects when configured (evidence: `player.py`)
- Playback controller → HTTP client: downloads initialization and segments (evidence: `player.py`)
- Playback controller → Lsrb selector: updates selection (evidence: `player.py`)
- Playback controller → Osrb selector: updates selection (evidence: `player.py`)
