# pdeljanov/symphonia architecture

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

- Interactive diagram: https://gitdiagram.com/pdeljanov/symphonia
- Repository: https://github.com/pdeljanov/symphonia

## Overview

##### Main Components Structure

A. Core Layer (symphonia-core)
- This at the center as it provides fundamental functionality
- Components for:
- Audio primitives
- I/O operations
- DSP operations
- Error handling
- Format/codec interfaces

B. Format Demuxers Layer
- Format-related crates (symphonia-format-*)
- Support for:
- AIFF/WAV (RIFF)
- CAF
- ISO/MP4
- MKV/WebM
- OGG
- To the core layer

C. Codec Decoders Layer
- Codec-related crates (symphonia-codec-*)
- Include:
- AAC
- ADPCM
- ALAC
- FLAC
- MP3 (including MP1, MP2)
- Opus
- PCM
- Vorbis
- Connections to the core layer

D. Metadata Layer (symphonia-metadata)
- Support for different tag formats:
- ID3v1/v2
- ISO/MP4
- RIFF
- Vorbis comments

##### Relationships and Data Flow
- Data flow from format demuxers to decoders
- Metadata extraction paths
- Core service utilization by both demuxers and decoders

##### Component Details
For each major component, show:
- Input/output formats
- Key features
- Dependencies on other components
- Optional feature flags

##### Implementation Notes
- Use standardized symbols for different component types
- Version compatibility requirements
- Default vs. optional components
- Optimization paths

##### Integration Points
Highlight:
- External API interfaces
- Plugin/extension points
- Inter-component communication paths
- Error handling flows

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core
        Core["Core Layer"]:::core
        AudioPrim["Audio Primitives"]:::core
        IO["I/O Operations"]:::core
        DSP["DSP Operations"]:::core
        ErrorH["Error Handling"]:::core
        Interfaces["Format/Codec Interfaces"]:::core

        Core --> AudioPrim
        Core --> IO
        Core --> DSP
        Core --> ErrorH
        Core --> Interfaces
    end

    subgraph Formats["Format Demuxers"]
        RIFF["AIFF/WAV (RIFF)"]:::format
        CAF["CAF"]:::format
        ISOMP4["ISO/MP4"]:::format
        MKV["MKV/WebM"]:::format
        OGG["OGG"]:::format
    end

    subgraph Codecs["Codec Decoders"]
        AAC["AAC"]:::codec
        ADPCM["ADPCM"]:::codec
        ALAC["ALAC"]:::codec
        FLAC["FLAC"]:::codec
        MP3["MP3"]:::codec
        OPUS["Opus"]:::codec
        PCM["PCM"]:::codec
        VORBIS["Vorbis"]:::codec
    end

    subgraph Metadata
        META["Metadata Handler"]:::meta
        ID3v1["ID3v1"]:::meta
        ID3v2["ID3v2"]:::meta
        RIFFMETA["RIFF Metadata"]:::meta
        VorbisMeta["Vorbis Comments"]:::meta

        META --> ID3v1
        META --> ID3v2
        META --> RIFFMETA
        META --> VorbisMeta
    end

    %% Connections to Core
    RIFF & CAF & ISOMP4 & MKV & OGG --> Core
    AAC & ADPCM & ALAC & FLAC & MP3 & OPUS & PCM & VORBIS --> Core
    META --> Core

    %% Format to Codec flows
    RIFF --> PCM
    ISOMP4 --> AAC
    ISOMP4 --> ALAC
    OGG --> VORBIS
    OGG --> OPUS
    MKV --> VORBIS
    MKV --> OPUS

    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef format fill:#2ecc71,stroke:#27ae60,color:white
    classDef codec fill:#e67e22,stroke:#d35400,color:white
    classDef meta fill:#9b59b6,stroke:#8e44ad,color:white

    %% Click events for components
    click Core "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-core"
    click AudioPrim "https://github.com/pdeljanov/Symphonia/blob/master/symphonia-core/src/audio.rs"
    click IO "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-core/src/io/"
    click DSP "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-core/src/dsp/"
    click ErrorH "https://github.com/pdeljanov/Symphonia/blob/master/symphonia-core/src/errors.rs"
    click Interfaces "https://github.com/pdeljanov/Symphonia/blob/master/symphonia-core/src/formats.rs"
    click RIFF "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-format-riff/"
    click CAF "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-format-caf/"
    click ISOMP4 "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-format-isomp4/"
    click MKV "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-format-mkv/"
    click OGG "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-format-ogg/"
    click AAC "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-codec-aac/"
    click ADPCM "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-codec-adpcm/"
    click ALAC "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-codec-alac/"
    click FLAC "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-bundle-flac/"
    click MP3 "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-bundle-mp3/"
    click OPUS "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-codec-opus/"
    click PCM "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-codec-pcm/"
    click VORBIS "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-codec-vorbis/"
    click META "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-metadata/"
    click ID3v1 "https://github.com/pdeljanov/Symphonia/blob/master/symphonia-metadata/src/id3v1.rs"
    click ID3v2 "https://github.com/pdeljanov/Symphonia/tree/master/symphonia-metadata/src/id3v2/"
    click RIFFMETA "https://github.com/pdeljanov/Symphonia/blob/master/symphonia-metadata/src/riff.rs"
    click VorbisMeta "https://github.com/pdeljanov/Symphonia/blob/master/symphonia-metadata/src/vorbis.rs"
```
