# tjoppen/mxflib architecture

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

- Interactive diagram: https://gitdiagram.com/tjoppen/mxflib
- Repository: https://github.com/tjoppen/mxflib

## Overview

##### Project type and purpose
- MXFlib is an open-source C++ library implementing support for the Material Exchange Format (MXF).
- It also packages a set of simple command-line utilities (mxfdump, mxfwrap, mxfsplit, mxfcrypt, dictconvert, simplewrap) to demonstrate and exercise the library API.
- Platform-abstraction is factored into libprocesswrap and utility modules; documentation is generated by Doxygen; a test suite validates functionality.

##### File structure
- Top-level modules:
- mxflib/         ← core MXF parsing, metadata, essence, indexing, KLV, partitions, XML, crypto interfaces
- libprocesswrap/ ← cross-platform process and charset wrappers
- utility/        ← simple UTF-8 helpers
- mxfwrap/, mxfdump/, mxfsplit/, mxfcrypt/, dictconvert/, simplewrap/ ← sample CLI applications linking against mxflib & libprocesswrap
- docs/           ← Doxygen configuration and documentation source
- tests/          ← automated tests (.at scripts, sample MXF, WAV files)
- build/          ← MSVC project files for VS8/VS9
- autotools files (configure.ac, Makefile.am, bootstrap.sh) for Unix builds
- Notice the modular separation: core library, platform/foundation layer, example front-ends, build system, docs, and tests.

##### README highlights
- Describes how to build on Windows (MSVC) and Unix (./configure && make), how to run make check (test suite).
- Mentions external dependencies: Doxygen (docs), e2fsprogs’ uuid_generate on Linux, native CoCreateGuid on Windows, fallback random UUID generator.
- Demonstrates example workflows: dumping an MXF, wrapping MPEG-2 into MXF.

a. Main components
- Core MXFlib Library (mxflib/)
- Platform Abstraction Layer (libprocesswrap/ + utility/)
- CLI Tools (mxfwrap, mxfdump, mxfsplit, mxfcrypt, dictconvert, simplewrap)
- Build & Configuration (autotools, VS projects)
- Documentation Generator (Doxygen)
- Test Harness (tests/)
- External Dependencies (OS uuid APIs, e2fsprogs, Doxygen)
b. Relationships and interactions
- Each CLI tool → links against Core MXFlib + Platform layer → operates on input files → emits MXF or textual output
- Core MXFlib → invokes UUID APIs (OS or fallback)
- Build system → invokes compiler/linker to produce library and tools, runs Doxygen for docs, runs tests via “make check”
- Test harness → drives each CLI tool and core library functions on sample files
c. Architectural patterns
- Modular, layered design: separation of concerns between core protocol handling (MXF), platform abstractions, and user-facing tools
- Plugins/extensions style: each utility is a thin wrapper around core APIs
- Cross-platform build abstraction via autotools and VS project files
d. Key technologies
- C++11/98 (codebase)
- Autotools (configure.ac, Makefile.am)
- MSVC++ project files (build/vs8, build/vs9)
- Doxygen (docs/)
- e2fsprogs uuid library or Windows CoCreateGuid

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build & Configuration
    subgraph "Build & Configuration"
        direction TB
        Autotools["Autotools (configure.ac, Makefile.am, bootstrap.sh)"]:::build
        MSVC8["MSVC Projects VS8"]:::build
        MSVC9["MSVC Projects VS9"]:::build
    end

    %% Core Library
    subgraph "Core MXFlib Library" 
        direction TB
        Core["Core MXFlib\n(metadata, essence, indexing, KLV, I/O)"]:::core
    end

    %% Platform Abstraction Layer
    subgraph "Platform Abstraction Layer"
        direction TB
        PlatformWrap["libprocesswrap\n(process & charset wrappers)"]:::platform
        Utility["utility\n(UTF-8 helpers)"]:::platform
    end

    %% CLI Tools
    subgraph "CLI Tools"
        direction TB
        Dump["mxfdump"]:::tool
        Wrap["mxfwrap"]:::tool
        Split["mxfsplit"]:::tool
        Crypt["mxfcrypt"]:::tool
        Dict["dictconvert"]:::tool
        Simple["simplewrap"]:::tool
    end

    %% Documentation
    Docs["Doxygen Documentation"]:::docs

    %% Test Harness
    Tests["Test Harness"]:::tests

    %% External Dependencies
    subgraph "External Dependencies" 
        direction TB
        OSUUID["OS UUID APIs\n(CoCreateGuid)"]:::external
        E2FS["e2fsprogs uuid_generate"]:::external
        DoxyExt["Doxygen"]:::external
    end

    %% Connections
    Autotools -->|builds| Core
    Autotools -->|builds| Dump
    Autotools -->|builds| Wrap
    Autotools -->|builds| Split
    Autotools -->|builds| Crypt
    Autotools -->|builds| Dict
    Autotools -->|builds| Simple
    Autotools -->|generates| Docs
    Autotools -->|runs| Tests

    MSVC8 -->|builds| Core
    MSVC8 -->|builds| Dump
    MSVC8 -->|builds| Wrap
    MSVC8 -->|builds| Split
    MSVC8 -->|builds| Crypt
    MSVC8 -->|builds| Dict
    MSVC8 -->|builds| Simple

    MSVC9 -->|builds| Core
    MSVC9 -->|builds| Dump
    MSVC9 -->|builds| Wrap
    MSVC9 -->|builds| Split
    MSVC9 -->|builds| Crypt
    MSVC9 -->|builds| Dict
    MSVC9 -->|builds| Simple

    Dump -->|calls| Core
    Wrap -->|calls| Core
    Split -->|calls| Core
    Crypt -->|calls| Core
    Dict -->|calls| Core
    Simple -->|calls| Core

    Core -->|uses| PlatformWrap
    Core -->|uses| Utility

    PlatformWrap -->|invokes| OSUUID
    PlatformWrap -->|invokes| E2FS

    Docs -->|powered by| DoxyExt

    Tests -->|executes| Dump
    Tests -->|executes| Wrap
    Tests -->|executes| Split
    Tests -->|executes| Crypt
    Tests -->|executes| Dict
    Tests -->|executes| Simple
    Tests -->|invokes| Core

    %% Click Events
    click Core "https://github.com/tjoppen/mxflib/tree/master/mxflib/"
    click PlatformWrap "https://github.com/tjoppen/mxflib/tree/master/libprocesswrap/"
    click Utility "https://github.com/tjoppen/mxflib/tree/master/utility/"
    click Dump "https://github.com/tjoppen/mxflib/tree/master/mxfdump/"
    click Wrap "https://github.com/tjoppen/mxflib/tree/master/mxfwrap/"
    click Split "https://github.com/tjoppen/mxflib/tree/master/mxfsplit/"
    click Crypt "https://github.com/tjoppen/mxflib/tree/master/mxfcrypt/"
    click Dict "https://github.com/tjoppen/mxflib/tree/master/dictconvert/"
    click Simple "https://github.com/tjoppen/mxflib/tree/master/simplewrap/"
    click Autotools "https://github.com/tjoppen/mxflib/blob/master/configure.ac"
    click MSVC8 "https://github.com/tjoppen/mxflib/tree/master/build/vs8/"
    click MSVC9 "https://github.com/tjoppen/mxflib/tree/master/build/vs9/"
    click Docs "https://github.com/tjoppen/mxflib/tree/master/docs/"
    click Tests "https://github.com/tjoppen/mxflib/tree/master/tests/"

    %% Styles
    classDef build fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef core fill:#9f6,stroke:#333,stroke-width:1px
    classDef platform fill:#6cf,stroke:#333,stroke-width:1px
    classDef tool fill:#ff9,stroke:#333,stroke-width:1px
    classDef docs fill:#f96,stroke:#333,stroke-width:1px
    classDef tests fill:#f66,stroke:#333,stroke-width:1px
    classDef external fill:none,stroke:#999,stroke-dasharray: 5 5,color:#999;padding:5px
```
