├── rust
├── flake.lock
├── Cargo.lock.license
├── mxl-sys
│ ├── .gitignore
│ ├── wrapper-with-version-h.h
│ ├── wrapper-without-version-h.h
│ ├── tests
│ │ └── simple_test.rs
│ ├── Cargo.toml
│ └── src
│ │ └── lib.rs
├── .gitattributes
├── .gitignore
├── mxl
│ ├── src
│ │ ├── grain.rs
│ │ ├── samples.rs
│ │ ├── api.rs
│ │ ├── lib.rs
│ │ ├── config.rs
│ │ ├── grain
│ │ │ ├── data.rs
│ │ │ └── writer.rs
│ │ ├── error.rs
│ │ └── samples
│ │ │ ├── writer.rs
│ │ │ └── data.rs
│ ├── examples
│ │ └── common
│ │ │ └── mod.rs
│ ├── Cargo.toml
│ └── build.rs
├── .config
│ └── nextest.toml
├── deny.toml
├── README.md
├── Cargo.toml
└── flake.nix
├── GOVERNANCE
├── .gitkeep
├── CHARTER.pdf
├── CHARTER.pdf.license
├── MXL-Requirement-Feature-Workflow-2025-10-09.png
├── MXL-Requirement-Feature-Workflow-2025-10-09.png.license
└── DoD.md
├── docs
├── Media eXchange Layer.png
├── fabrics
│ └── img
│ │ ├── mxl-fabrics-rma.png
│ │ ├── mxl-fabrics-overview.png
│ │ ├── mxl-fabrics-bouncebuffer.png
│ │ ├── mxl-fabrics-grain-layout.png
│ │ ├── mxl-fabrics-cont-flow-rma.png
│ │ ├── mxl-fabrics-rma-with-alpha.png
│ │ ├── mxl-fabrics-cont-flow-layout.png
│ │ ├── mxl-fabrics-rma.png.license
│ │ ├── mxl-fabrics-overview.png.license
│ │ ├── mxl-fabrics-bouncebuffer.png.license
│ │ ├── mxl-fabrics-cont-flow-rma.png.license
│ │ ├── mxl-fabrics-grain-layout.png.license
│ │ ├── mxl-fabrics-rma-with-alpha.png.license
│ │ └── mxl-fabrics-cont-flow-layout.png.license
├── logo
│ ├── png
│ │ ├── mxl-on-blue-square-128px.png
│ │ └── mxl-on-blue-square-128px.png.license
│ ├── mxl-on-blue-square.svg.license
│ ├── mxl-on-blue-rectangular.svg.license
│ ├── mxl-on-white-square.svg.license
│ ├── mxl-on-white-rectangular.svg.license
│ └── mxl-on-blue-rectangular-supporter.svg.license
├── assets
│ ├── continuous-flow-memory-layout.png
│ └── continuous-flow-memory-layout.png.license
├── Media eXchange Layer.png.license
├── The Media Exchange Layer, a crucial component in a Dynamic Media Facility.pdf
├── The Media Exchange Layer, a crucial component in a Dynamic Media Facility.pdf.license
├── Configuration.md
└── Addressability.md
├── lib
├── tests
│ ├── data
│ │ ├── ST2110-40-Closed_Captions.cap
│ │ ├── audio_flow.json.license
│ │ ├── data_flow.json.license
│ │ ├── v210_flow.json.license
│ │ ├── v210a_flow.json.license
│ │ ├── ST2110-40-Closed_Captions.cap.license
│ │ ├── data_flow.json
│ │ ├── audio_flow.json
│ │ ├── v210_flow.json
│ │ └── v210a_flow.json
│ ├── fabrics
│ │ ├── CMakeLists.txt
│ │ └── ofi
│ │ │ ├── test_Address.cpp
│ │ │ ├── test_Provider.cpp
│ │ │ ├── CMakeLists.txt
│ │ │ └── test_Region.cpp
│ ├── all_headers.c
│ ├── test_pkgconfig_c_link.sh
│ └── test_time.cpp
├── cmake
│ ├── libmxl.pc.in.license
│ ├── mxl-config.cmake.in
│ └── libmxl.pc.in
├── fabrics
│ ├── ofi
│ │ ├── cmake
│ │ │ ├── libmxl-fabrics.pc.in.license
│ │ │ ├── mxl-fabrics-config.cmake.in.license
│ │ │ ├── libmxl-fabrics.pc.in
│ │ │ └── mxl-fabrics-config.cmake.in
│ │ └── src
│ │ │ └── internal
│ │ │ ├── FabricVersion.hpp
│ │ │ ├── FabricVersion.cpp
│ │ │ ├── VariantUtils.hpp
│ │ │ ├── Provider.hpp
│ │ │ ├── RemoteRegion.cpp
│ │ │ ├── Exception.cpp
│ │ │ ├── LocalRegion.cpp
│ │ │ ├── RegisteredRegion.cpp
│ │ │ ├── Fabric.hpp
│ │ │ ├── Provider.cpp
│ │ │ ├── RegisteredRegion.hpp
│ │ │ ├── Fabric.cpp
│ │ │ ├── Address.hpp
│ │ │ ├── Format.hpp
│ │ │ ├── Address.cpp
│ │ │ ├── RemoteRegion.hpp
│ │ │ └── MemoryRegion.hpp
│ └── CMakeLists.txt
├── internal
│ ├── src
│ │ ├── Logging.cpp
│ │ ├── MediaUtils.cpp
│ │ ├── DynamicPointerCast.hpp
│ │ ├── FlowWriter.cpp
│ │ ├── FlowReader.cpp
│ │ ├── Timing.cpp
│ │ ├── Time.cpp
│ │ ├── Deferred.hpp
│ │ ├── PosixFlowIoFactory.cpp
│ │ ├── PathUtils.cpp
│ │ ├── FlowIoFactory.cpp
│ │ ├── Thread.cpp
│ │ ├── PosixDiscreteFlowWriter.hpp
│ │ └── FlowOptionsParser.cpp
│ ├── include
│ │ └── mxl-internal
│ │ │ ├── FlowInfo.hpp
│ │ │ ├── Time.hpp
│ │ │ ├── Rational.hpp
│ │ │ ├── FlowIoFactory.hpp
│ │ │ ├── MediaUtils.hpp
│ │ │ ├── DiscreteFlowWriter.hpp
│ │ │ ├── FlowReaderFactory.hpp
│ │ │ ├── FlowWriterFactory.hpp
│ │ │ ├── ContinuousFlowWriter.hpp
│ │ │ ├── detail
│ │ │ └── ClockHelpers.hpp
│ │ │ ├── PosixFlowIoFactory.hpp
│ │ │ ├── FlowState.hpp
│ │ │ ├── Sync.hpp
│ │ │ ├── Thread.hpp
│ │ │ ├── Flow.hpp
│ │ │ ├── FlowOptionsParser.hpp
│ │ │ ├── DiscreteFlowReader.hpp
│ │ │ ├── ContinuousFlowReader.hpp
│ │ │ └── FlowWriter.hpp
│ └── tests
│ │ └── CMakeLists.txt
├── include
│ └── mxl
│ │ ├── rational.h
│ │ ├── version.h.in
│ │ ├── platform.h
│ │ └── dataformat.h
└── src
│ ├── time.cpp
│ └── mxl.cpp
├── vcpkg.json.license
├── CMakePresets.json.license
├── utils
├── CMakeLists.txt
└── gst-looping-filesrc
│ ├── gst-looping-filesrc.h
│ ├── README.md
│ └── CMakeLists.txt
├── .github
└── ISSUE_TEMPLATE
│ ├── config.yml
│ ├── tsc-meeting-topic.md
│ ├── task.yml
│ ├── feature_request.md
│ ├── bug_report.md
│ └── feature.yml
├── .gitignore
├── tools
├── CMakeLists.txt
├── mxl-fabrics-demo
│ └── CMakeLists.txt
└── mxl-info
│ └── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── .clang-tidy
├── .clangd
├── .devcontainer
├── scripts
│ └── common
│ │ ├── libfabric
│ │ └── install.sh
│ │ └── rust
│ │ └── install-rust.sh
├── Dockerfile.amazonlinux
├── Dockerfile.almalinux
├── amazonlinux
│ └── devcontainer.json
├── almalinux
│ └── devcontainer.json
├── debiantrixie
│ └── devcontainer.json
├── ubuntu24
│ └── devcontainer.json
├── ubuntu26
│ └── devcontainer.json
├── ubuntu20
│ └── devcontainer.json
├── ubuntu22
│ └── devcontainer.json
├── Dockerfile.debiantrixie
└── Dockerfile
├── examples
├── Dockerfile.reader.txt
├── Dockerfile.writer.txt
├── docker-compose.yaml
├── kube-deployment.yaml
└── README.md
├── SECURITY.md
├── .vscode
├── tasks.json
├── launch.json
└── settings.json
├── cmake
└── modules
│ └── Findpicojson.cmake
├── vcpkg.json
├── LICENSES
└── MIT.txt
└── Doxyfile.in
/rust/flake.lock:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/GOVERNANCE/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/GOVERNANCE/CHARTER.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/GOVERNANCE/CHARTER.pdf
--------------------------------------------------------------------------------
/docs/Media eXchange Layer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/docs/Media eXchange Layer.png
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-rma.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/docs/fabrics/img/mxl-fabrics-rma.png
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/docs/fabrics/img/mxl-fabrics-overview.png
--------------------------------------------------------------------------------
/docs/logo/png/mxl-on-blue-square-128px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/docs/logo/png/mxl-on-blue-square-128px.png
--------------------------------------------------------------------------------
/docs/assets/continuous-flow-memory-layout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/docs/assets/continuous-flow-memory-layout.png
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-bouncebuffer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/docs/fabrics/img/mxl-fabrics-bouncebuffer.png
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-grain-layout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/docs/fabrics/img/mxl-fabrics-grain-layout.png
--------------------------------------------------------------------------------
/lib/tests/data/ST2110-40-Closed_Captions.cap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/lib/tests/data/ST2110-40-Closed_Captions.cap
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-cont-flow-rma.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/docs/fabrics/img/mxl-fabrics-cont-flow-rma.png
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-rma-with-alpha.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/docs/fabrics/img/mxl-fabrics-rma-with-alpha.png
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-cont-flow-layout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/docs/fabrics/img/mxl-fabrics-cont-flow-layout.png
--------------------------------------------------------------------------------
/vcpkg.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/CMakePresets.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/GOVERNANCE/CHARTER.pdf.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/lib/cmake/libmxl.pc.in.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/rust/Cargo.lock.license:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
--------------------------------------------------------------------------------
/GOVERNANCE/MXL-Requirement-Feature-Workflow-2025-10-09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/GOVERNANCE/MXL-Requirement-Feature-Workflow-2025-10-09.png
--------------------------------------------------------------------------------
/docs/logo/mxl-on-blue-square.svg.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | SPDX-License-Identifier: Apache-2.0
3 |
--------------------------------------------------------------------------------
/docs/Media eXchange Layer.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: CC-BY-4.0
4 |
--------------------------------------------------------------------------------
/docs/logo/mxl-on-blue-rectangular.svg.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | SPDX-License-Identifier: Apache-2.0
3 |
--------------------------------------------------------------------------------
/docs/logo/mxl-on-white-square.svg.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | SPDX-License-Identifier: Apache-2.0
3 |
--------------------------------------------------------------------------------
/lib/tests/data/audio_flow.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/lib/tests/data/data_flow.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/lib/tests/data/v210_flow.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/lib/tests/data/v210a_flow.json.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-rma.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: CC-BY-4.0
4 |
--------------------------------------------------------------------------------
/docs/logo/mxl-on-white-rectangular.svg.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | SPDX-License-Identifier: Apache-2.0
3 |
--------------------------------------------------------------------------------
/docs/logo/png/mxl-on-blue-square-128px.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | SPDX-License-Identifier: Apache-2.0
3 |
--------------------------------------------------------------------------------
/rust/mxl-sys/.gitignore:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | mxl/version.h
5 |
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-overview.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: CC-BY-4.0
4 |
--------------------------------------------------------------------------------
/docs/logo/mxl-on-blue-rectangular-supporter.svg.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | SPDX-License-Identifier: Apache-2.0
3 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/cmake/libmxl-fabrics.pc.in.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/rust/.gitattributes:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | Cargo.lock -diff
5 |
--------------------------------------------------------------------------------
/docs/assets/continuous-flow-memory-layout.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: CC-BY-4.0
4 |
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-bouncebuffer.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: CC-BY-4.0
4 |
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-cont-flow-rma.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: CC-BY-4.0
4 |
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-grain-layout.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: CC-BY-4.0
4 |
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-rma-with-alpha.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: CC-BY-4.0
4 |
--------------------------------------------------------------------------------
/lib/tests/data/ST2110-40-Closed_Captions.cap.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/docs/fabrics/img/mxl-fabrics-cont-flow-layout.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: CC-BY-4.0
4 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/cmake/mxl-fabrics-config.cmake.in.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: Apache-2.0
4 |
--------------------------------------------------------------------------------
/GOVERNANCE/MXL-Requirement-Feature-Workflow-2025-10-09.png.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: CC-BY-4.0
4 |
--------------------------------------------------------------------------------
/utils/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | add_subdirectory(gst-looping-filesrc)
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 |
3 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
4 | # SPDX-License-Identifier: Apache-2.0
5 |
--------------------------------------------------------------------------------
/lib/internal/src/Logging.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #include "mxl-internal/Logging.hpp"
5 |
--------------------------------------------------------------------------------
/rust/.gitignore:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | .DS_Store
5 | .idea
6 | .vscode
7 | target
8 |
--------------------------------------------------------------------------------
/docs/The Media Exchange Layer, a crucial component in a Dynamic Media Facility.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmf-mxl/mxl/HEAD/docs/The Media Exchange Layer, a crucial component in a Dynamic Media Facility.pdf
--------------------------------------------------------------------------------
/docs/The Media Exchange Layer, a crucial component in a Dynamic Media Facility.pdf.license:
--------------------------------------------------------------------------------
1 | SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 |
3 | SPDX-License-Identifier: CC-BY-4.0
4 |
--------------------------------------------------------------------------------
/lib/tests/fabrics/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | if (MXL_ENABLE_FABRICS_OFI)
5 | add_subdirectory(ofi)
6 | endif ()
7 |
--------------------------------------------------------------------------------
/rust/mxl-sys/wrapper-with-version-h.h:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #include "wrapper-without-version-h.h"
5 | #include "mxl/version.h"
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | build
5 | .cache
6 | install
7 |
8 | CMakeUserPresets.json
9 |
10 | .idea
11 | .vscode
12 |
--------------------------------------------------------------------------------
/rust/mxl/src/grain.rs:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | pub mod data;
5 | pub mod reader;
6 | pub mod write_access;
7 | pub mod writer;
8 |
--------------------------------------------------------------------------------
/rust/mxl/src/samples.rs:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | pub mod data;
5 | pub mod reader;
6 | pub mod write_access;
7 | pub mod writer;
8 |
--------------------------------------------------------------------------------
/rust/.config/nextest.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | [profile.ci]
5 | fail-fast = false
6 |
7 | [profile.ci.junit]
8 | path = "junit.xml"
9 |
--------------------------------------------------------------------------------
/lib/cmake/mxl-config.cmake.in:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | @PACKAGE_INIT@
5 |
6 | if(NOT TARGET mxl::mxl)
7 | include("${CMAKE_CURRENT_LIST_DIR}/mxl-targets.cmake")
8 | endif()
--------------------------------------------------------------------------------
/tools/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | add_subdirectory(mxl-info)
5 | add_subdirectory(mxl-gst)
6 |
7 | if (MXL_ENABLE_FABRICS_OFI)
8 | add_subdirectory(mxl-fabrics-demo)
9 | endif ()
10 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # Code of conduct
5 |
6 | The Linux Foundation Projects Code of Conduct listed at applies to all Collaborators in the MXL Project.
7 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/tsc-meeting-topic.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: TSC Meeting Topic
3 | about: Covers a topic discussed in the TSC weekly meeting
4 | title: "[TSC]"
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/lib/tests/all_headers.c:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | // Simple test to ensure all headers are valid according to the C17 standard
9 | int main(void)
10 | {
11 | return 0;
12 | }
13 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/FlowInfo.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | MXL_EXPORT
11 | std::ostream& operator<<(std::ostream& os, mxlFlowInfo const& obj);
12 |
--------------------------------------------------------------------------------
/rust/mxl-sys/wrapper-without-version-h.h:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #include "mxl/dataformat.h"
5 | #include "mxl/flow.h"
6 | #include "mxl/flowinfo.h"
7 | #include "mxl/mxl.h"
8 | #include "mxl/platform.h"
9 | #include "mxl/rational.h"
10 | #include "mxl/time.h"
11 |
--------------------------------------------------------------------------------
/lib/cmake/libmxl.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@MXL_PKGCONFIG_PREFIX@
2 | exec_prefix=${prefix}
3 | libdir=@MXL_PKGCONFIG_LIBDIR@
4 | includedir=@MXL_PKGCONFIG_INCLUDEDIR@
5 |
6 | Name: libmxl
7 | Version: @PROJECT_VERSION@
8 | Description: Media eXchange Layer SDK
9 | Libs: -L${libdir} -lmxl
10 | Requires.private: spdlog
11 | Libs.private: -pthread -lmxl-common -lstdc++ -lm
12 | Cflags: -I${includedir}
13 |
14 |
--------------------------------------------------------------------------------
/.clang-tidy:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | Checks: "-*,modernize-*,-modernize-use-trailing-return-type"
5 | HeaderFileExtensions: ["", "h", "hpp"]
6 | ImplementationFileExtensions: ["cpp"]
7 | CheckOptions:
8 | modernize-use-using.IgnoreExternC: "true"
9 | modernize-use-using.IgnoreMacros: "true"
10 |
--------------------------------------------------------------------------------
/.clangd:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | Diagnostics:
5 | UnusedIncludes: Strict
6 | MissingIncludes: None
7 | Index:
8 | StandardLibrary: Yes
9 | Hover:
10 | ShowAKA: Yes
11 | InlayHints:
12 | Designators: Yes
13 | Enabled: Yes
14 | ParameterNames: Yes
15 | DeducedTypes: Yes
16 | BlockEnd: Yes
17 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/src/internal/FabricVersion.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #pragma once
6 |
7 | #include
8 |
9 | namespace mxl::lib::fabrics::ofi
10 | {
11 | /** \brief Returns the libfabric version this library was compiled with.
12 | */
13 | std::uint32_t fiVersion() noexcept;
14 | }
15 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/src/internal/FabricVersion.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #include "FabricVersion.hpp"
6 | #include
7 |
8 | namespace mxl::lib::fabrics::ofi
9 | {
10 | std::uint32_t fiVersion() noexcept
11 | {
12 | return FI_VERSION(FI_MAJOR_VERSION, FI_MINOR_VERSION);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/cmake/libmxl-fabrics.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | exec_prefix=${prefix}
3 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@
4 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
5 |
6 | Name: libmxl-fabrics
7 | Version: @PROJECT_VERSION@
8 | Requires: libmxl libfabric
9 | Description: Media eXchange Layer SDK Fabrics library
10 | Libs: -L${libdir} -lmxl-fabrics
11 | Libs.private: -pthread
12 | Cflags: -I${includedir}
13 |
14 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/src/internal/VariantUtils.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #pragma once
6 |
7 | namespace mxl::lib::fabrics::ofi
8 | {
9 | // Allows us to use the visitor pattern with lambdas
10 | template
11 | struct overloaded : Ts...
12 | {
13 | using Ts::operator()...;
14 | };
15 | }
16 |
--------------------------------------------------------------------------------
/rust/mxl-sys/tests/simple_test.rs:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #[test]
5 | fn there_is_bindgen_generated_code() {
6 | let mxl_version = mxl_sys::VersionType {
7 | major: 3,
8 | minor: 2,
9 | bugfix: 1,
10 | ..Default::default()
11 | };
12 |
13 | println!("mxl_version: {:?}", mxl_version);
14 | }
15 |
--------------------------------------------------------------------------------
/rust/mxl/examples/common/mod.rs:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | pub fn setup_logging() {
5 | tracing_subscriber::fmt()
6 | .with_env_filter(
7 | tracing_subscriber::EnvFilter::builder()
8 | .with_default_directive(tracing::level_filters::LevelFilter::INFO.into())
9 | .from_env_lossy(),
10 | )
11 | .init();
12 | }
13 |
--------------------------------------------------------------------------------
/rust/mxl-sys/Cargo.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | [package]
5 | name = "mxl-sys"
6 | edition.workspace = true
7 | publish.workspace = true
8 | version.workspace = true
9 | license.workspace = true
10 |
11 | [dependencies]
12 | libloading.workspace = true
13 |
14 | [build-dependencies]
15 | bindgen.workspace = true
16 | cmake = "0.1.54"
17 |
18 | [features]
19 | mxl-not-built = []
20 |
--------------------------------------------------------------------------------
/.devcontainer/scripts/common/libfabric/install.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | set -e
6 | set -x
7 |
8 | git clone -b v2.2.0 https://github.com/ofiwg/libfabric.git
9 |
10 | cd libfabric
11 | ./autogen.sh
12 | ./configure \
13 | --prefix=/usr \
14 | --disable-kdreg2 \
15 | --disable-memhooks-monitor \
16 | --disable-uffd-monitor
17 |
18 | make install "-j$(nproc)"
19 |
--------------------------------------------------------------------------------
/rust/mxl/src/api.rs:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | use std::{path::Path, sync::Arc};
5 |
6 | use mxl_sys::libmxl;
7 |
8 | use crate::Result;
9 |
10 | pub type MxlApi = libmxl;
11 | pub type MxlApiHandle = Arc;
12 |
13 | pub fn load_api(path_to_so_file: impl AsRef) -> Result {
14 | Ok(Arc::new(unsafe {
15 | libmxl::new(path_to_so_file.as_ref().as_os_str())?
16 | }))
17 | }
18 |
--------------------------------------------------------------------------------
/lib/include/mxl/rational.h:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #ifdef __cplusplus
7 | # include
8 | #else
9 | # include
10 | #endif
11 |
12 | #ifdef __cplusplus
13 | extern "C"
14 | {
15 | #endif
16 |
17 | typedef struct mxlRational_t
18 | {
19 | int64_t numerator;
20 | int64_t denominator;
21 | } mxlRational;
22 |
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 |
--------------------------------------------------------------------------------
/lib/include/mxl/version.h.in:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #define MXL_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
7 | #define MXL_VERSION_MINOR @PROJECT_VERSION_MINOR@
8 | #define MXL_VERSION_PATCH @PROJECT_VERSION_PATCH@
9 | #define MXL_VERSION_BUILD @PROJECT_VERSION_TWEAK@
10 | #define MXL_VERSION_FULL "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@@MXL_BUILD_SUFFIX@+@PROJECT_VERSION_TWEAK@ g@GIT_HASH@"
11 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/task.yml:
--------------------------------------------------------------------------------
1 | name: Task
2 | description: Create a new task
3 | labels: [ Task ]
4 | assignees: []
5 | title: "[Task] "
6 |
7 | body:
8 | - type: textarea
9 | id: description
10 | attributes:
11 | label: Description
12 | description: A clear and concise description of the task
13 | placeholder: "Describe the task"
14 | validations:
15 | required: true
16 |
17 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
18 | # SPDX-License-Identifier: Apache-2.0
19 |
20 |
--------------------------------------------------------------------------------
/lib/internal/src/MediaUtils.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #include "mxl-internal/MediaUtils.hpp"
5 | #include
6 |
7 | MXL_EXPORT
8 | std::uint32_t mxl::lib::getV210LineLength(std::size_t width)
9 | {
10 | return static_cast((width + 47) / 48 * 128);
11 | }
12 |
13 | MXL_EXPORT
14 | std::uint32_t mxl::lib::get10BitAlphaLineLength(std::size_t width)
15 | {
16 | return static_cast((width + 2) / 3 * 4);
17 | }
18 |
--------------------------------------------------------------------------------
/examples/Dockerfile.reader.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | FROM debian:trixie-slim
5 |
6 | WORKDIR /app
7 |
8 | RUN apt update && apt-get -y install\
9 | procps \
10 | patchelf && rm -rf /var/lib/apt/lists/*
11 |
12 | COPY build/Linux-Clang-Release/lib/*.so* /app/
13 | COPY build/Linux-Clang-Release/tools/mxl-info/mxl-info /app/
14 |
15 | RUN patchelf --set-rpath /app mxl-info
16 |
17 | CMD["sh", "-c", "while true; do /app/mxl-info -d /domain -l || true; sleep 2; done"]
18 |
--------------------------------------------------------------------------------
/lib/internal/src/DynamicPointerCast.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 | #pragma once
4 |
5 | #include
6 |
7 | namespace mxl::lib
8 | {
9 | template
10 | std::unique_ptr dynamic_pointer_cast(std::unique_ptr&& source) noexcept
11 | {
12 | auto const p = dynamic_cast(source.get());
13 | if (p != nullptr)
14 | {
15 | source.release();
16 | }
17 | return std::unique_ptr{p};
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/lib/include/mxl/platform.h:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #if defined(__GNUC__) || defined(__clang__)
7 | # define MXL_EXPORT __attribute__((visibility("default")))
8 | #else
9 | # define MXL_EXPORT
10 | #endif
11 |
12 | // TODO: Tailor these more to specific language statdard levels
13 | #ifdef __cplusplus
14 | # define MXL_NODISCARD [[nodiscard]]
15 | # define MXL_CONSTEXPR constexpr
16 | #else
17 | # define MXL_NODISCARD
18 | # define MXL_CONSTEXPR inline
19 | #endif
20 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/Time.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include
7 |
8 | bool operator==(timespec const& lhs, timespec const& rhs);
9 |
10 | bool operator!=(timespec const& lhs, timespec const& rhs);
11 |
12 | bool operator<(timespec const& lhs, timespec const& rhs);
13 |
14 | bool operator<=(timespec const& lhs, timespec const& rhs);
15 |
16 | bool operator>(timespec const& lhs, timespec const& rhs);
17 |
18 | bool operator>=(timespec const& lhs, timespec const& rhs);
19 |
--------------------------------------------------------------------------------
/lib/internal/src/FlowWriter.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #include "mxl-internal/FlowWriter.hpp"
5 | #include
6 |
7 | namespace mxl::lib
8 | {
9 | FlowWriter::FlowWriter(uuids::uuid&& flowId)
10 | : _flowId{std::move(flowId)}
11 | {}
12 |
13 | FlowWriter::FlowWriter(uuids::uuid const& flowId)
14 | : _flowId{flowId}
15 | {}
16 |
17 | FlowWriter::FlowWriter::~FlowWriter() = default;
18 |
19 | uuids::uuid const& FlowWriter::getId() const
20 | {
21 | return _flowId;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/rust/mxl/Cargo.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | [package]
5 | name = "mxl"
6 | edition.workspace = true
7 | publish.workspace = true
8 | version.workspace = true
9 | license.workspace = true
10 |
11 | [dependencies]
12 | mxl-sys = { path = "../mxl-sys" }
13 |
14 | libloading.workspace = true
15 | thiserror.workspace = true
16 | tracing.workspace = true
17 | uuid.workspace = true
18 |
19 | [dev-dependencies]
20 | clap.workspace = true
21 | tracing-subscriber.workspace = true
22 |
23 | [features]
24 | mxl-not-built = ["mxl-sys/mxl-not-built"]
25 |
--------------------------------------------------------------------------------
/rust/deny.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | # This section is considered when running `cargo deny check licenses`
5 | # More documentation for the licenses section can be found here:
6 | # https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
7 | [licenses]
8 | # List of explicitly allowed licenses
9 | # See https://spdx.org/licenses/ for list of possible licenses
10 | # [possible values: any SPDX 3.11 short identifier (+ optional exception)].
11 | allow = [
12 | "MIT",
13 | "Apache-2.0",
14 | "Unicode-3.0",
15 | "BSD-3-Clause",
16 | "ISC"
17 | ]
18 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/Rational.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include
7 |
8 | constexpr bool isValid(mxlRational const& rational) noexcept
9 | {
10 | return (rational.denominator != 0);
11 | }
12 |
13 | constexpr bool operator==(mxlRational const& lhs, mxlRational const& rhs) noexcept
14 | {
15 | return (lhs.numerator * rhs.denominator) == (lhs.denominator * rhs.numerator);
16 | }
17 |
18 | constexpr bool operator!=(mxlRational const& lhs, mxlRational const& rhs) noexcept
19 | {
20 | return !(lhs == rhs);
21 | }
22 |
--------------------------------------------------------------------------------
/rust/mxl/src/lib.rs:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | mod api;
5 | mod error;
6 | mod flow;
7 | mod grain;
8 | mod instance;
9 | mod samples;
10 |
11 | pub mod config;
12 |
13 | pub use api::{MxlApi, load_api};
14 | pub use error::{Error, Result};
15 | pub use flow::{reader::FlowReader, writer::FlowWriter, *};
16 | pub use grain::{
17 | data::*, reader::GrainReader, write_access::GrainWriteAccess, writer::GrainWriter,
18 | };
19 | pub use instance::MxlInstance;
20 | pub use samples::{
21 | data::*, reader::SamplesReader, write_access::SamplesWriteAccess, writer::SamplesWriter,
22 | };
23 |
--------------------------------------------------------------------------------
/rust/mxl-sys/src/lib.rs:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | // Suppress expected warnings from bindgen-generated code.
5 | // See https://github.com/rust-lang/rust-bindgen/issues/1651.
6 |
7 | #![allow(non_upper_case_globals)]
8 | #![allow(non_camel_case_types)]
9 | #![allow(non_snake_case)]
10 | #![allow(missing_docs)]
11 | #![allow(rustdoc::broken_intra_doc_links)]
12 | #![allow(rustdoc::invalid_html_tags)]
13 | #![allow(unsafe_op_in_unsafe_fn)]
14 | #![allow(deref_nullptr)]
15 | #![allow(clippy::missing_safety_doc)]
16 |
17 | extern crate libloading;
18 |
19 | include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
20 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # Security Policy
5 |
6 | ## Reporting a Vulnerability
7 |
8 | To report vulnerabilities, you can privately report a potential security issue via the GitHub security vulnerabilities feature. This can be done here:
9 |
10 |
11 | Please do not open a public issue about a potential security vulnerability.
12 | You can find more details on the security vulnerability feature in the GitHub documentation here:
13 |
14 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project https://github.com/dmf-mxl/mxl/contributors.md
2 | // SPDX-License-Identifier: Apache-2.0
3 | {
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "type": "cmake",
8 | "label": "CMake: build",
9 | "command": "build",
10 | "targets": [
11 | "all"
12 | ],
13 | "preset": "${command:cmake.activeBuildPresetName}",
14 | "group": "build",
15 | "problemMatcher": [],
16 | "detail": "CMake template build task"
17 | },
18 | {
19 | "type": "cmake",
20 | "label": "CMake: clean",
21 | "command": "clean",
22 | "preset": "${command:cmake.activeBuildPresetName}",
23 | "problemMatcher": [],
24 | "detail": "CMake template clean task"
25 | }
26 | ]
27 | }
--------------------------------------------------------------------------------
/lib/tests/data/data_flow.json:
--------------------------------------------------------------------------------
1 | {
2 | "$copyright": "SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.",
3 | "$license": "SPDX-License-Identifier: Apache-2.0",
4 | "description": "MXL VANC Data",
5 | "tags": {
6 | "urn:x-nmos:tag:grouphint/v1.0": [
7 | "Media Function XYZ:Ancillary Data"
8 | ]
9 | },
10 | "format": "urn:x-nmos:format:data",
11 | "label": "MXL VANC Data",
12 | "version": "1453880607:123995943",
13 | "parents": [],
14 | "source_id": "0e635152-e501-4d4e-bb87-9f3fe05eb79a",
15 | "device_id": "9126cc2f-4c26-4c9b-a6cd-93c4381c9be5",
16 | "id": "db3bd465-2772-484f-8fac-830b0471258b",
17 | "media_type": "video/smpte291",
18 | "grain_rate": {
19 | "numerator": 30000,
20 | "denominator": 1001
21 | }
22 | }
--------------------------------------------------------------------------------
/examples/Dockerfile.writer.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | FROM debian:trixie-slim
5 |
6 | WORKDIR /app
7 |
8 | RUN apt update && apt-get -y install\
9 | gstreamer1.0-plugins-good\
10 | gstreamer1.0-x \
11 | patchelf && rm -rf /var/lib/apt/lists/*
12 |
13 | COPY build/Linux-Clang-Release/lib/*.so* /app/
14 | COPY build/Linux-Clang-Release/lib/internal/*.so* /app/
15 | COPY build/Linux-Clang-Release/lib/tests/data/*.json /app/
16 | COPY build/Linux-Clang-Release/tools/mxl-gst/mxl-gst-testsrc /app/
17 |
18 | RUN patchelf --set-rpath /app mxl-gst-testsrc
19 |
20 | CMD ["/app/mxl-gst-testsrc", "-d", "/domain", "-v", "/app/v210_flow.json", "-a", "/app/audio_flow.json"]
21 |
--------------------------------------------------------------------------------
/lib/tests/data/audio_flow.json:
--------------------------------------------------------------------------------
1 | {
2 | "$copyright": "SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.",
3 | "$license": "SPDX-License-Identifier: Apache-2.0",
4 | "description": "MXL Audio Flow",
5 | "format": "urn:x-nmos:format:audio",
6 | "tags": {
7 | "urn:x-nmos:tag:grouphint/v1.0": [
8 | "Media Function XYZ:Audio"
9 | ]
10 | },
11 | "label": "MXL Audio Flow",
12 | "version": "1441812152:154331951",
13 | "id": "b3bb5be7-9fe9-4324-a5bb-4c70e1084449",
14 | "media_type": "audio/float32",
15 | "sample_rate": {
16 | "numerator": 48000
17 | },
18 | "channel_count": 2,
19 | "bit_depth": 32,
20 | "parents": [],
21 | "source_id": "2aa143ac-0ab7-4d75-bc32-5c00c13d186f",
22 | "device_id": "169feb2c-3fae-42a5-ae2e-f6f8cbce29cf"
23 | }
24 |
--------------------------------------------------------------------------------
/cmake/modules/Findpicojson.cmake:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | find_path(picojson_INCLUDE_DIR NAMES picojson/picojson.h DOC "The picojson include directory")
5 | mark_as_advanced(picojson_INCLUDE_DIR)
6 |
7 | include(FindPackageHandleStandardArgs)
8 | find_package_handle_standard_args(picojson
9 | FOUND_VAR picojson_FOUND
10 | REQUIRED_VARS picojson_INCLUDE_DIR
11 | )
12 |
13 | if(picojson_FOUND)
14 | set(picojson_INCLUDE_DIRS ${picojson_INCLUDE_DIR})
15 | if(NOT TARGET picojson::picojson)
16 | add_library(picojson::picojson INTERFACE IMPORTED)
17 | set_target_properties(picojson::picojson PROPERTIES
18 | INTERFACE_INCLUDE_DIRECTORIES "${picojson_INCLUDE_DIRS}"
19 | )
20 | endif()
21 | endif()
22 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/FlowIoFactory.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include "FlowReaderFactory.hpp"
7 | #include "FlowWriterFactory.hpp"
8 |
9 | namespace mxl::lib
10 | {
11 | class MXL_EXPORT FlowIoFactory
12 | : public FlowReaderFactory
13 | , public FlowWriterFactory
14 | {
15 | public:
16 | std::unique_ptr createFlowReader(FlowManager const& manager, uuids::uuid const& flowId, std::unique_ptr&& data);
17 | std::unique_ptr createFlowWriter(FlowManager const& manager, uuids::uuid const& flowId, std::unique_ptr&& data);
18 |
19 | virtual ~FlowIoFactory();
20 |
21 | protected:
22 | FlowIoFactory();
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/lib/fabrics/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | include(GNUInstallDirs)
5 |
6 | add_library(mxl-fabrics-headers INTERFACE)
7 |
8 | target_include_directories(mxl-fabrics-headers
9 | INTERFACE
10 | $
11 | $
12 | )
13 |
14 | install(TARGETS mxl-fabrics-headers EXPORT ${PROJECT_NAME}-targets
15 | COMPONENT ${PROJECT_NAME}-dev
16 | )
17 |
18 | install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
19 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
20 | COMPONENT ${PROJECT_NAME}-dev
21 | FILES_MATCHING
22 | PATTERN "*.h"
23 | )
24 |
25 | if (MXL_ENABLE_FABRICS_OFI)
26 | add_subdirectory(ofi)
27 | endif ()
28 |
29 |
--------------------------------------------------------------------------------
/lib/internal/src/FlowReader.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #include "mxl-internal/FlowReader.hpp"
5 | #include
6 |
7 | namespace mxl::lib
8 | {
9 | FlowReader::FlowReader(uuids::uuid&& flowId, std::filesystem::path const& domain)
10 | : _flowId{std::move(flowId)}
11 | , _domain{domain}
12 | {}
13 |
14 | FlowReader::FlowReader(uuids::uuid const& flowId, std::filesystem::path const& domain)
15 | : _flowId{flowId}
16 | , _domain{domain}
17 | {}
18 |
19 | FlowReader::FlowReader::~FlowReader() = default;
20 |
21 | uuids::uuid const& FlowReader::getId() const
22 | {
23 | return _flowId;
24 | }
25 |
26 | std::filesystem::path const& FlowReader::getDomain() const
27 | {
28 | return _domain;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/GOVERNANCE/DoD.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # MXL Definition of Done (DoD)
5 |
6 | DONE Feature or Bug fix
7 |
8 | 1. PR has been reviewed by at least 2 reviewers from the TSC
9 | - Has been code peer reviewed
10 | - Included in the release note
11 | - Has just enough documentation to understand what it is doing and how this should be used
12 | - Has been seen working in a simple scenario
13 | - Include most relevant unit automated tests
14 |
15 | 2. (Feature only) Implemented Feature has been reviewed by at least two members of the Requirement Council
16 | - Feature demonstrated or tried out
17 | - Feature is accepted as adressing the corresponding Requirement
18 | - Documentation is clear enough for the users
19 | - Requirement is closed
20 |
21 | 3. PR has been merged in the main branch by a Maintainer
22 |
--------------------------------------------------------------------------------
/vcpkg.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
3 | "dependencies": [
4 | {
5 | "name": "catch2",
6 | "version>=": "3.11.0#0"
7 | },
8 | {
9 | "name": "stduuid",
10 | "version>=": "1.2.3",
11 | "features": [
12 | "system-gen",
13 | "gsl-span"
14 | ]
15 | },
16 | {
17 | "name": "spdlog",
18 | "version>=": "1.16.0#0"
19 | },
20 | {
21 | "name": "fmt",
22 | "version>=": "12.1.0#0"
23 | },
24 | {
25 | "name": "picojson",
26 | "version>=": "1.3.0#3"
27 | },
28 | {
29 | "name": "cli11",
30 | "version>=": "2.6.1#0"
31 | },
32 | {
33 | "name": "pcapplusplus",
34 | "version>=": "25.5#0",
35 | "platform": "linux"
36 | }
37 | ],
38 | "builtin-baseline": "4002e3abc6d3e468c73d2d9777a7dd96af5dc224"
39 | }
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/MediaUtils.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include
7 | #include
8 |
9 | namespace mxl::lib
10 | {
11 | /**
12 | * Length in bytes of a line in the V210 video format.
13 | * @param width The width of the video frame in pixels.
14 | * @return The line length in bytes for the V210 format, including padding.
15 | */
16 | std::uint32_t getV210LineLength(std::size_t width);
17 |
18 | /**
19 | * Length in bytes of a line in the 10-bit alpha video format (3x10-bit samples per 32 bit word).
20 | * @param width The width of the video frame in pixels.
21 | * @return The line length in bytes for the 10-bit Alpha format, including padding.
22 | */
23 | std::uint32_t get10BitAlphaLineLength(std::size_t width);
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/docs/Configuration.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # Configuration
5 |
6 | ## Domain level configuration
7 |
8 | Domain level configuration is stored in an optional 'options.json' files stored at the root of the MXL domain. If present, the MXL SDK will look for specific options defined in the table below and configure itself accordingly.
9 |
10 | | Option | Description | Default Value |
11 | |----------------|---------------------------|---------------|
12 | | `urn:x-mxl:option:history_duration/v1.0"` | Depth, in nanoseconds, of a ringbuffer | 200'000'000ns |
13 |
14 | ### Example 'options.json' file
15 |
16 | This options file will configure the depth of the ringbuffers to 500'000'000ns (500ms)
17 |
18 | ```json
19 | {
20 | "urn:x-mxl:option:history_duration/v1.0": 500000000
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/DiscreteFlowWriter.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include "FlowWriter.hpp"
7 |
8 | namespace mxl::lib
9 | {
10 | class MXL_EXPORT DiscreteFlowWriter : public FlowWriter
11 | {
12 | public:
13 | /**
14 | * Get the grain info for a specific grain index without opening the grain for mutation.
15 | */
16 | [[nodiscard]]
17 | virtual mxlGrainInfo getGrainInfo(std::uint64_t in_index) const = 0;
18 |
19 | virtual mxlStatus openGrain(std::uint64_t in_index, mxlGrainInfo* out_grainInfo, std::uint8_t** out_payload) = 0;
20 |
21 | virtual mxlStatus commit(mxlGrainInfo const& mxlGrainInfo) = 0;
22 |
23 | virtual mxlStatus cancel() = 0;
24 |
25 | protected:
26 | using FlowWriter::FlowWriter;
27 | };
28 | }
29 |
--------------------------------------------------------------------------------
/rust/mxl/src/config.rs:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | use std::str::FromStr;
5 |
6 | include!(concat!(env!("OUT_DIR"), "/constants.rs"));
7 |
8 | #[cfg(not(feature = "mxl-not-built"))]
9 | pub fn get_mxl_so_path() -> std::path::PathBuf {
10 | // The mxl-sys build script ensures that the build directory is in the library path
11 | // so we can just return the library name here.
12 | "libmxl.so".into()
13 | }
14 |
15 | #[cfg(feature = "mxl-not-built")]
16 | pub fn get_mxl_so_path() -> std::path::PathBuf {
17 | std::path::PathBuf::from_str(MXL_BUILD_DIR)
18 | .expect("build error: 'MXL_BUILD_DIR' is invalid")
19 | .join("lib")
20 | .join("libmxl.so")
21 | }
22 |
23 | pub fn get_mxl_repo_root() -> std::path::PathBuf {
24 | std::path::PathBuf::from_str(MXL_REPO_ROOT).expect("build error: 'MXL_REPO_ROOT' is invalid")
25 | }
26 |
--------------------------------------------------------------------------------
/lib/internal/src/Timing.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #include "mxl-internal/Timing.hpp"
5 | #include
6 | #include "mxl-internal/detail/ClockHelpers.hpp"
7 |
8 | namespace mxl::lib
9 | {
10 | MXL_EXPORT
11 | Timepoint currentTime(Clock clock) noexcept
12 | {
13 | auto result = Timepoint{};
14 |
15 | std::timespec ts;
16 | if (::clock_gettime(detail::clockToId(clock), &ts) == 0)
17 | {
18 | result = asTimepoint(ts) + detail::getClockOffset(clock);
19 | }
20 | return result;
21 | }
22 |
23 | Timepoint currentTimeUTC() noexcept
24 | {
25 | auto result = Timepoint{};
26 |
27 | std::timespec ts;
28 | if (::timespec_get(&ts, TIME_UTC) != 0)
29 | {
30 | result = asTimepoint(ts);
31 | }
32 | return result;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/FlowReaderFactory.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include
7 | #include "ContinuousFlowData.hpp"
8 | #include "ContinuousFlowReader.hpp"
9 | #include "DiscreteFlowData.hpp"
10 | #include "DiscreteFlowReader.hpp"
11 |
12 | namespace mxl::lib
13 | {
14 | class FlowManager;
15 |
16 | class FlowReaderFactory
17 | {
18 | public:
19 | virtual std::unique_ptr createDiscreteFlowReader(FlowManager const& manager, uuids::uuid const& flowId,
20 | std::unique_ptr&& data) const = 0;
21 | virtual std::unique_ptr createContinuousFlowReader(FlowManager const& manager, uuids::uuid const& flowId,
22 | std::unique_ptr&& data) const = 0;
23 |
24 | protected:
25 | ~FlowReaderFactory() = default;
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/rust/README.md:
--------------------------------------------------------------------------------
1 |
5 |
6 | # Rust bindings for DMF MXL
7 |
8 | ## Goals
9 |
10 | - Hide all the unsafe stuff inside these bindings.
11 | - Provide more Rust-native like experience (async API based on `futures::stream` and
12 | `futures::sink`?).
13 |
14 | ## Code Guidelines
15 |
16 | - Use `rustfmt` in it's default settings for code formatting.
17 | - The `cargo clippy` should be always clean.
18 | - Try to avoid adding more dependencies, unless really necessary.
19 | - Never use `unwrap`, `expect`, or a similar construct that causes a panic. Always return errors. Tests are an exception.
20 |
21 | ## Building
22 |
23 | - `cargo build`
24 |
25 | ## TODO
26 |
27 | - Get rid of the headers copy. Use the main headers as part of the build process.
28 | - Change the tests so they can use libraries build from the main repo.
29 | - Setup CI/CD.
30 | - Extend the functionality.
31 |
--------------------------------------------------------------------------------
/.devcontainer/scripts/common/rust/install-rust.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
4 | # SPDX-License-Identifier: Apache-2.0
5 |
6 | set -eu
7 |
8 | RUST_VERSION=1.90.0
9 |
10 | if command -v rustup >/dev/null 2>&1; then
11 | rustup default $RUST_VERSION
12 | else
13 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=$RUST_VERSION
14 | . "$HOME/.cargo/env"
15 | fi
16 |
17 | # Install cargo binstall
18 | curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
19 |
20 | cargo binstall cargo-audit@0.22.0 --locked
21 | cargo binstall cargo-outdated --locked
22 |
23 | # udeps requires the nightly compiler, so using machete (at least for now)
24 | # cargo binstall cargo-udeps --locked
25 | cargo binstall cargo-machete --locked
26 |
27 | cargo binstall cargo-deny --locked
28 | cargo binstall cargo-nextest --locked
29 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/FlowWriterFactory.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include
7 | #include
8 | #include "ContinuousFlowData.hpp"
9 | #include "ContinuousFlowWriter.hpp"
10 | #include "DiscreteFlowData.hpp"
11 | #include "DiscreteFlowWriter.hpp"
12 |
13 | namespace mxl::lib
14 | {
15 | class FlowManager;
16 |
17 | class FlowWriterFactory
18 | {
19 | public:
20 | virtual std::unique_ptr createDiscreteFlowWriter(FlowManager const& manager, uuids::uuid const& flowId,
21 | std::unique_ptr&& data) const = 0;
22 | virtual std::unique_ptr createContinuousFlowWriter(FlowManager const& manager, uuids::uuid const& flowId,
23 | std::unique_ptr&& data) const = 0;
24 |
25 | protected:
26 | ~FlowWriterFactory() = default;
27 | };
28 | }
29 |
--------------------------------------------------------------------------------
/tools/mxl-fabrics-demo/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | find_package(CLI11 CONFIG REQUIRED)
6 | find_package(stduuid CONFIG REQUIRED)
7 | find_package(spdlog CONFIG REQUIRED)
8 |
9 | # Add the test executable
10 | add_executable(mxl-fabrics-demo)
11 | target_compile_features(mxl-fabrics-demo
12 | PRIVATE
13 | cxx_std_20
14 | )
15 | target_sources(mxl-fabrics-demo
16 | PRIVATE
17 | demo.cpp
18 | )
19 | target_link_libraries(mxl-fabrics-demo
20 | PRIVATE
21 | mxl
22 | mxl-fabrics
23 | mxl-internal-headers
24 | mxl-common
25 | stduuid
26 | CLI11::CLI11
27 | spdlog::spdlog
28 | )
29 | set_target_properties(mxl-fabrics-demo PROPERTIES
30 | INSTALL_RPATH "$ORIGIN/../lib"
31 | )
32 |
33 | # Install targets
34 | install(TARGETS mxl-fabrics-demo
35 | RUNTIME DESTINATION bin
36 | )
37 |
--------------------------------------------------------------------------------
/examples/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | services:
5 | init:
6 | image: alpine
7 | command: ["sh", "-c", "mkdir -p /dev/shm/mxl"]
8 | volumes:
9 | - type: bind
10 | source: /dev/shm
11 | target: /dev/shm
12 | restart: "no"
13 |
14 | writer-media-function:
15 | image: mxl-writer
16 | depends_on:
17 | - init
18 | build:
19 | context: ..
20 | dockerfile: examples/Dockerfile.writer.txt
21 | restart: unless-stopped
22 | volumes:
23 | - type: bind
24 | source: /dev/shm/mxl
25 | target: /domain
26 |
27 | reader-media-function:
28 | image: mxl-reader
29 | depends_on:
30 | - init
31 | build:
32 | context: ..
33 | dockerfile: examples/Dockerfile.reader.txt
34 | restart: unless-stopped
35 | volumes:
36 | - type: bind
37 | source: /dev/shm/mxl
38 | target: /domain
39 | stdin_open: true
40 | tty: true
41 |
--------------------------------------------------------------------------------
/rust/Cargo.toml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | [workspace]
5 | members = ["mxl", "mxl-sys"]
6 |
7 | resolver = "2"
8 |
9 | [workspace.package]
10 | edition = "2024"
11 | publish = false
12 | version = "0.1.0"
13 | license = "Apache-2.0"
14 | license-file = "../LICENSE.txt"
15 |
16 | [workspace.dependencies]
17 | bindgen = { version = "0.72", features = ["experimental"] }
18 | # Will be used later, when we get to higher level streams based interfaces.
19 | futures = "0.3"
20 | libloading = { version = "0.8.9" }
21 | thiserror = "2.0.12"
22 | tracing = { version = "0.1", features = ["log"] }
23 | tracing-subscriber = { version = "0.3.20", features = ["env-filter", "std"] }
24 | uuid = { version = "1.17", features = ["v4"] }
25 |
26 | [workspace.dependencies.clap]
27 | version = "4.1.4"
28 | default-features = false
29 | features = ["std", "derive", "cargo", "env", "help", "usage", "error-context"]
30 |
31 | [profile.release-with-debug]
32 | debug = true
33 | inherits = "release"
34 |
--------------------------------------------------------------------------------
/lib/internal/src/Time.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #include "mxl-internal/Time.hpp"
5 | #include
6 |
7 | bool operator==(timespec const& lhs, timespec const& rhs)
8 | {
9 | return (lhs.tv_sec == rhs.tv_sec) && (lhs.tv_nsec == rhs.tv_nsec);
10 | }
11 |
12 | bool operator!=(timespec const& lhs, timespec const& rhs)
13 | {
14 | return !(lhs == rhs);
15 | }
16 |
17 | bool operator<(timespec const& lhs, timespec const& rhs)
18 | {
19 | if (lhs.tv_sec < rhs.tv_sec)
20 | {
21 | return true;
22 | }
23 | if (lhs.tv_sec > rhs.tv_sec)
24 | {
25 | return false;
26 | }
27 | return lhs.tv_nsec < rhs.tv_nsec;
28 | }
29 |
30 | bool operator<=(timespec const& lhs, timespec const& rhs)
31 | {
32 | return (lhs < rhs) || (lhs == rhs);
33 | }
34 |
35 | bool operator>(timespec const& lhs, timespec const& rhs)
36 | {
37 | return !(lhs <= rhs);
38 | }
39 |
40 | bool operator>=(timespec const& lhs, timespec const& rhs)
41 | {
42 | return !(lhs < rhs);
43 | }
44 |
--------------------------------------------------------------------------------
/rust/mxl/build.rs:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | use std::env;
5 | use std::path::PathBuf;
6 |
7 | #[cfg(debug_assertions)]
8 | const BUILD_VARIANT: &str = "Linux-Clang-Debug";
9 | #[cfg(not(debug_assertions))]
10 | const BUILD_VARIANT: &str = "Linux-Clang-Release";
11 |
12 | fn main() {
13 | let manifest_dir =
14 | PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("failed to get current directory"));
15 | let repo_root = manifest_dir.parent().unwrap().parent().unwrap();
16 | let build_dir = repo_root.join("build").join(BUILD_VARIANT);
17 |
18 | let out_path = PathBuf::from(env::var("OUT_DIR").expect("failed to get output directory"))
19 | .join("constants.rs");
20 |
21 | let data = format!(
22 | "pub const MXL_REPO_ROOT: &str = \"{}\";\n\
23 | pub const MXL_BUILD_DIR: &str = \"{}\";\n",
24 | repo_root.to_string_lossy(),
25 | build_dir.to_string_lossy()
26 | );
27 | std::fs::write(out_path, data).expect("Unable to write file");
28 | }
29 |
--------------------------------------------------------------------------------
/LICENSES/MIT.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6 | associated documentation files (the "Software"), to deal in the Software without restriction, including
7 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
9 | following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all copies or substantial
12 | portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
16 | EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
18 | USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
--------------------------------------------------------------------------------
/lib/tests/data/v210_flow.json:
--------------------------------------------------------------------------------
1 | {
2 | "$copyright": "SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.",
3 | "$license": "SPDX-License-Identifier: Apache-2.0",
4 | "description": "MXL Test Flow, 1080p29",
5 | "id": "5fbec3b1-1b0f-417d-9059-8b94a47197ed",
6 | "tags": {
7 | "urn:x-nmos:tag:grouphint/v1.0": [
8 | "Media Function XYZ:Video"
9 | ]
10 | },
11 | "format": "urn:x-nmos:format:video",
12 | "label": "MXL Test Flow, 1080p29",
13 | "parents": [],
14 | "media_type": "video/v210",
15 | "grain_rate": {
16 | "numerator": 30000,
17 | "denominator": 1001
18 | },
19 | "frame_width": 1920,
20 | "frame_height": 1080,
21 | "interlace_mode": "progressive",
22 | "colorspace": "BT709",
23 | "components": [
24 | {
25 | "name": "Y",
26 | "width": 1920,
27 | "height": 1080,
28 | "bit_depth": 10
29 | },
30 | {
31 | "name": "Cb",
32 | "width": 960,
33 | "height": 1080,
34 | "bit_depth": 10
35 | },
36 | {
37 | "name": "Cr",
38 | "width": 960,
39 | "height": 1080,
40 | "bit_depth": 10
41 | }
42 | ]
43 | }
--------------------------------------------------------------------------------
/lib/fabrics/ofi/src/internal/Provider.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #pragma once
6 |
7 | #include
8 | #include
9 | #include "mxl/fabrics.h"
10 |
11 | namespace mxl::lib::fabrics::ofi
12 | {
13 |
14 | /** \brief Internal representation of supported libfabric providers.
15 | */
16 | enum class Provider
17 | {
18 | TCP,
19 | VERBS,
20 | EFA,
21 | SHM,
22 | };
23 |
24 | /** \brief Convert between external and internal versions of this type
25 | */
26 | mxlFabricsProvider providerToAPI(Provider provider) noexcept;
27 |
28 | /** \brief Convert between external and internal versions of this type
29 | */
30 | std::optional providerFromAPI(mxlFabricsProvider api) noexcept;
31 |
32 | /** \brief Parse a provider name string, and return the enum value.
33 | *
34 | * Returns std::nullopt if the string passed was not a valid provider name.
35 | */
36 | std::optional providerFromString(std::string const& s) noexcept;
37 | }
38 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/lib/tests/data/v210a_flow.json:
--------------------------------------------------------------------------------
1 | {
2 | "$copyright": "SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.",
3 | "$license": "SPDX-License-Identifier: Apache-2.0",
4 | "description": "MXL Test Flow, 1080p29 with alpha",
5 | "id": "5fbec3b1-1b0f-417d-9059-8b94a47197ed",
6 | "tags": {
7 | "urn:x-nmos:tag:grouphint/v1.0": [
8 | "Media Function XYZ:Video"
9 | ]
10 | },
11 | "format": "urn:x-nmos:format:video",
12 | "label": "MXL Test Flow, 1080p29 with alpha",
13 | "parents": [],
14 | "media_type": "video/v210a",
15 | "grain_rate": {
16 | "numerator": 30000,
17 | "denominator": 1001
18 | },
19 | "frame_width": 1920,
20 | "frame_height": 1080,
21 | "interlace_mode": "progressive",
22 | "colorspace": "BT709",
23 | "components": [
24 | {
25 | "name": "Y",
26 | "width": 1920,
27 | "height": 1080,
28 | "bit_depth": 10
29 | },
30 | {
31 | "name": "Cb",
32 | "width": 960,
33 | "height": 1080,
34 | "bit_depth": 10
35 | },
36 | {
37 | "name": "Cr",
38 | "width": 960,
39 | "height": 1080,
40 | "bit_depth": 10
41 | }
42 | ]
43 | }
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature.yml:
--------------------------------------------------------------------------------
1 | name: Feature
2 | description: Feature from MXL Requirement
3 | labels: []
4 | assignees: []
5 | title: "[Feature] "
6 |
7 | body:
8 | - type: input
9 | id: requirement_link
10 | attributes:
11 | label: Requirement Link
12 | description: Link to the related issue in MXL Requirements repo (e.g., `dmf-mxl/mxl-requirements#99999` or full URL)
13 | placeholder: "dmf-mxl/mxl-requirements#99999"
14 | validations:
15 | required: true
16 |
17 | - type: textarea
18 | id: description
19 | attributes:
20 | label: Description
21 | description: A clear and concise description of the feature
22 | placeholder: "Describe the feature"
23 | validations:
24 | required: true
25 |
26 | - type: textarea
27 | id: additional_context
28 | attributes:
29 | label: Additional context
30 | description: Add any other context or screenshots about the feature request here.
31 | placeholder: "Include any relevant background, links, or images."
32 | validations:
33 | required: false
34 |
35 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
36 | # SPDX-License-Identifier: Apache-2.0
37 |
38 |
--------------------------------------------------------------------------------
/lib/tests/fabrics/ofi/test_Address.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #include
6 | #include "Address.hpp"
7 |
8 | using namespace mxl::lib::fabrics::ofi;
9 |
10 | TEST_CASE("FabricAddress default construction", "[FabricAddress]")
11 | {
12 | FabricAddress empty;
13 | REQUIRE(empty.size() == 0);
14 | REQUIRE(empty.raw() == nullptr);
15 | REQUIRE(empty.raw() == static_cast(nullptr));
16 | REQUIRE(empty.toBase64().empty());
17 | }
18 |
19 | TEST_CASE("FabricAddress base64 decode", "[FabricAddress]")
20 | {
21 | FabricAddress addr = FabricAddress::fromBase64("AQIDBAU="); // base64 for {1,2,3,4,5}
22 | auto* addrInner = static_cast(addr.raw());
23 |
24 | REQUIRE(addr.size() == 5);
25 |
26 | // Simulate a FabricAddress with some data
27 | std::vector expected = {1, 2, 3, 4, 5};
28 | for (size_t i = 0; i < addr.size(); i++)
29 | {
30 | REQUIRE(addrInner[i] == expected[i]);
31 | }
32 |
33 | // Encode again and validate we get the same string
34 | std::string b64 = addr.toBase64();
35 | REQUIRE(b64 == "AQIDBAU=");
36 | }
37 |
--------------------------------------------------------------------------------
/rust/mxl/src/grain/data.rs:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | pub struct GrainData<'a> {
5 | /// The grain payload. This may be a partial payload if the grain is not complete.
6 | /// The length of this slice is given by `commitedSize` in `mxlGrainInfo`.
7 | pub payload: &'a [u8],
8 |
9 | /// The total size of the grain payload, which may be larger than `payload.len()` if the grain is partial.
10 | pub total_size: usize,
11 | }
12 |
13 | impl<'a> GrainData<'a> {
14 | pub fn to_owned(&self) -> OwnedGrainData {
15 | self.into()
16 | }
17 | }
18 |
19 | impl<'a> AsRef> for GrainData<'a> {
20 | fn as_ref(&self) -> &GrainData<'a> {
21 | self
22 | }
23 | }
24 |
25 | pub struct OwnedGrainData {
26 | pub payload: Vec,
27 | }
28 |
29 | impl<'a> From<&GrainData<'a>> for OwnedGrainData {
30 | fn from(value: &GrainData<'a>) -> Self {
31 | Self {
32 | payload: value.payload.to_vec(),
33 | }
34 | }
35 | }
36 |
37 | impl<'a> From> for OwnedGrainData {
38 | fn from(value: GrainData<'a>) -> Self {
39 | value.as_ref().into()
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/src/internal/RemoteRegion.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #include "RemoteRegion.hpp"
6 | #include
7 |
8 | namespace mxl::lib::fabrics::ofi
9 | {
10 |
11 | ::fi_rma_iov RemoteRegion::toRmaIov() const noexcept
12 | {
13 | return ::fi_rma_iov{.addr = addr, .len = len, .key = rkey};
14 | }
15 |
16 | bool RemoteRegion::operator==(RemoteRegion const& other) const noexcept
17 | {
18 | return addr == other.addr && len == other.len && rkey == other.rkey;
19 | }
20 |
21 | ::fi_rma_iov const* RemoteRegionGroup::asRmaIovs() const noexcept
22 | {
23 | return _rmaIovs.data();
24 | }
25 |
26 | bool RemoteRegionGroup::operator==(RemoteRegionGroup const& other) const noexcept
27 | {
28 | return _inner == other._inner;
29 | }
30 |
31 | std::vector<::fi_rma_iov> RemoteRegionGroup::rmaIovsFromGroup(std::vector group) noexcept
32 | {
33 | std::vector<::fi_rma_iov> rmaIovs;
34 | std::ranges::transform(group, std::back_inserter(rmaIovs), [](RemoteRegion const& reg) { return reg.toRmaIov(); });
35 | return rmaIovs;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/src/internal/Exception.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #include "Exception.hpp"
6 | #include
7 | #include "mxl/mxl.h"
8 |
9 | namespace mxl::lib::fabrics::ofi
10 | {
11 | Exception::Exception(std::string msg, mxlStatus status)
12 | : _msg(std::move(msg))
13 | , _status(status)
14 | {}
15 |
16 | mxlStatus Exception::status() const noexcept
17 | {
18 | return _status;
19 | }
20 |
21 | char const* Exception::what() const noexcept
22 | {
23 | return _msg.c_str();
24 | }
25 |
26 | FabricException::FabricException(std::string msg, mxlStatus status, int fiErrno)
27 | : Exception(std::move(msg), status)
28 | , _fiErrno(fiErrno)
29 | {}
30 |
31 | int FabricException::fiErrno() const noexcept
32 | {
33 | return _fiErrno;
34 | }
35 |
36 | mxlStatus mxlStatusFromFiErrno(int fiErrno)
37 | {
38 | switch (fiErrno)
39 | {
40 | case -FI_EINTR: return MXL_ERR_INTERRUPTED;
41 | case -FI_EAGAIN: return MXL_ERR_NOT_READY;
42 | default: return MXL_ERR_UNKNOWN;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/ContinuousFlowWriter.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include "FlowWriter.hpp"
7 |
8 | namespace mxl::lib
9 | {
10 | class MXL_EXPORT ContinuousFlowWriter : public FlowWriter
11 | {
12 | public:
13 | /**
14 | * Accessor for a specific set of mutable samples across all
15 | * channels ending at a specific index (`count` samples up to
16 | * `index`).
17 | *
18 | * \param[in] index The starting index of the samples to obtain.
19 | * \param[in] count The number of samples to obtain.
20 | * \param[out] payloadBuffersSlices A reference to a mutable
21 | * wrapped multi buffer slice that represents the requested
22 | * range across all channel buffers
23 | *
24 | * \return A status code describing the outcome of the call.
25 | */
26 | virtual mxlStatus openSamples(std::uint64_t index, std::size_t count, mxlMutableWrappedMultiBufferSlice& payloadBufferSlices) = 0;
27 |
28 | virtual mxlStatus commit() = 0;
29 |
30 | virtual mxlStatus cancel() = 0;
31 |
32 | protected:
33 | using FlowWriter::FlowWriter;
34 | };
35 | }
36 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/src/internal/LocalRegion.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #include "LocalRegion.hpp"
6 | #include
7 |
8 | namespace mxl::lib::fabrics::ofi
9 | {
10 | ::iovec LocalRegion::toIovec() const noexcept
11 | {
12 | return ::iovec{.iov_base = reinterpret_cast(addr), .iov_len = len};
13 | }
14 |
15 | ::iovec const* LocalRegionGroup::asIovec() const noexcept
16 | {
17 | return _iovs.data();
18 | }
19 |
20 | void* const* LocalRegionGroup::desc() const noexcept
21 | {
22 | return _descs.data();
23 | }
24 |
25 | std::vector<::iovec> LocalRegionGroup::iovFromGroup(std::vector group) noexcept
26 | {
27 | std::vector<::iovec> iovs;
28 | std::ranges::transform(group, std::back_inserter(iovs), [](LocalRegion const& reg) { return reg.toIovec(); });
29 | return iovs;
30 | }
31 |
32 | std::vector LocalRegionGroup::descFromGroup(std::vector group) noexcept
33 | {
34 | std::vector descs;
35 | std::ranges::transform(group, std::back_inserter(descs), [](LocalRegion& reg) { return reg.desc; });
36 | return descs;
37 | }
38 | } // namespace mxl::lib::fabrics::ofi
39 |
--------------------------------------------------------------------------------
/utils/gst-looping-filesrc/gst-looping-filesrc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 | * SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
4 | * SPDX-License-Identifier: Apache-2.0
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | #pragma once
20 |
21 | #include
22 | #include
23 | #include
24 |
25 | G_BEGIN_DECLS
26 |
27 | #define GST_TYPE_LOOPING_FILESRC (gst_looping_filesrc_get_type())
28 | G_DECLARE_FINAL_TYPE(GstLoopingFileSrc, gst_looping_filesrc, GST, LOOPING_FILESRC, GstBaseSrc)
29 |
30 | struct _GstLoopingFileSrc
31 | {
32 | GstBaseSrc basesrc;
33 | gchar* location;
34 | bool loop;
35 | FILE* file;
36 | guint64 file_size;
37 | };
38 |
39 | void gst_looping_filesrc_register_static();
40 |
41 | G_END_DECLS
42 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/detail/ClockHelpers.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include
7 | #include "../Timing.hpp"
8 |
9 | namespace mxl::lib::detail
10 | {
11 | constexpr clockid_t clockToId(Clock clock) noexcept
12 | {
13 | switch (clock)
14 | {
15 | case Clock::Monotonic:
16 | #if defined(CLOCK_MONOTONIC_RAW)
17 | return CLOCK_MONOTONIC_RAW;
18 | #else
19 | return CLOCK_MONOTONIC;
20 | #endif
21 |
22 | #if defined(CLOCK_TAI)
23 | case Clock::TAI: return CLOCK_TAI;
24 | #endif
25 | case Clock::ProcessCPUTime: return CLOCK_PROCESS_CPUTIME_ID;
26 |
27 | case Clock::ThreadCPUTime: return CLOCK_THREAD_CPUTIME_ID;
28 |
29 | default: return CLOCK_REALTIME;
30 | }
31 | }
32 |
33 | constexpr Duration getClockOffset(Clock clock) noexcept
34 | {
35 | [[maybe_unused]]
36 | constexpr auto const ZERO_SECONDS = fromSeconds(0.0);
37 | [[maybe_unused]]
38 | constexpr auto const TAI_LEAP_SECONDS = fromSeconds(37.0);
39 |
40 | switch (clock)
41 | {
42 | #if !defined(CLOCK_TAI)
43 | case Clock::TAI: return TAI_LEAP_SECONDS;
44 | #endif
45 | default: return ZERO_SECONDS;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project https://github.com/dmf-mxl/mxl/contributors.md
2 | // SPDX-License-Identifier: Apache-2.0
3 | {
4 | "configurations": [
5 | {
6 | "name": "(gdb) Current cmake debug target",
7 | "type": "cppdbg",
8 | "request": "launch",
9 | "program": "${command:cmake.launchTargetPath}",
10 | "args": [
11 | "-d",
12 | "~/mxl_domain",
13 | "-f",
14 | "5fbec3b1-1b0f-417d-9059-8b94a47197ed"
15 | ],
16 | "stopAtEntry": false,
17 | "cwd": "${fileDirname}",
18 | "environment": [
19 | {
20 | "name": "MXL_LOG_LEVEL",
21 | "value": "debug"
22 | }
23 | ],
24 | "externalConsole": false,
25 | "MIMode": "gdb",
26 | "setupCommands": [
27 | {
28 | "description": "Enable pretty-printing for gdb",
29 | "text": "-enable-pretty-printing",
30 | "ignoreFailures": true
31 | },
32 | {
33 | "description": "Set Disassembly Flavor to Intel",
34 | "text": "-gdb-set disassembly-flavor intel",
35 | "ignoreFailures": true
36 | }
37 | ]
38 | }
39 | ]
40 | }
--------------------------------------------------------------------------------
/lib/fabrics/ofi/cmake/mxl-fabrics-config.cmake.in:
--------------------------------------------------------------------------------
1 | @PACKAGE_INIT@
2 |
3 | # Include PkgConfig as a dependency, because we need it to check for
4 | # transitive dependencies
5 | include(CMakeFindDependencyMacro)
6 | find_dependency(PkgConfig)
7 |
8 | # An adaption of CMakeFindDependencyMacro that applies the same logic
9 | # to pkg_check_modules.
10 | #
11 | # This has to be a macro because the call to return is used to end the
12 | # script execution entirely.
13 | macro(find_pkg_config_dependencies prefix)
14 | set(cmake_fpcd_required_arg)
15 | if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
16 | set(cmake_fpcd_required_arg REQUIRED)
17 | endif()
18 |
19 | set(cmake_fpcd_quiet_arg)
20 | if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
21 | set(cmake_fpcd_quiet_arg QUIET)
22 | endif()
23 |
24 | pkg_check_modules(${prefix}
25 | ${cmake_fpcd_required_arg} ${cmake_fpcd_quiet_arg} IMPORTED_TARGET
26 | ${ARGN}
27 | )
28 |
29 | set(cmake_fpcd_required_arg)
30 | set(cmake_fpcd_quiet_arg)
31 |
32 | if (NOT ${prefix}_FOUND)
33 | set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because at least of the following pkg-config dependencies could not be found: ${ARGN}")
34 | set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
35 | return()
36 | endif()
37 | endmacro()
38 |
39 | find_pkg_config_dependencies(libfabric libfabric)
40 |
41 | include("${CMAKE_CURRENT_LIST_DIR}/libmxl-fabrics-targets.cmake")
42 |
43 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/PosixFlowIoFactory.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include "mxl-internal/FlowIoFactory.hpp"
7 |
8 | namespace mxl::lib
9 | {
10 | struct MXL_EXPORT PosixFlowIoFactory : FlowIoFactory
11 | {
12 | /** \see FlowReaderFactory::createDiscreteFlowReader() */
13 | virtual std::unique_ptr createDiscreteFlowReader(FlowManager const& manager, uuids::uuid const& flowId,
14 | std::unique_ptr&& data) const override;
15 | /** \see FlowReaderFactory::createContinuousFlowReader() */
16 | virtual std::unique_ptr createContinuousFlowReader(FlowManager const& manager, uuids::uuid const& flowId,
17 | std::unique_ptr&& data) const override;
18 | /** \see FlowWriterFactory::createDiscreteFlowWriter() */
19 | virtual std::unique_ptr createDiscreteFlowWriter(FlowManager const& manager, uuids::uuid const& flowId,
20 | std::unique_ptr&& data) const override;
21 | /** \see FlowWriterFactory::createContinuousFlowWriter() */
22 | virtual std::unique_ptr createContinuousFlowWriter(FlowManager const& manager, uuids::uuid const& flowId,
23 | std::unique_ptr&& data) const override;
24 |
25 | ~PosixFlowIoFactory();
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/src/internal/RegisteredRegion.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #include "RegisteredRegion.hpp"
6 | #include "LocalRegion.hpp"
7 | #include "RemoteRegion.hpp"
8 |
9 | namespace mxl::lib::fabrics::ofi
10 | {
11 |
12 | RemoteRegion RegisteredRegion::toRemote(bool useVirtualAddress) const noexcept
13 | {
14 | auto addr = useVirtualAddress ? _region.base : 0;
15 |
16 | return RemoteRegion{.addr = addr, .len = _region.size, .rkey = _mr.rkey()};
17 | }
18 |
19 | LocalRegion RegisteredRegion::toLocal() const noexcept
20 | {
21 | return LocalRegion{.addr = _region.base, .len = _region.size, .desc = _mr.desc()};
22 | }
23 |
24 | std::vector toRemote(std::vector const& groups, bool useVirtualAddress) noexcept
25 | {
26 | std::vector remoteGroups;
27 | std::ranges::transform(
28 | groups, std::back_inserter(remoteGroups), [&](RegisteredRegion const& reg) { return reg.toRemote(useVirtualAddress); });
29 | return remoteGroups;
30 | }
31 |
32 | std::vector toLocal(std::vector const& groups) noexcept
33 | {
34 | std::vector localGroups;
35 | std::ranges::transform(groups, std::back_inserter(localGroups), [](RegisteredRegion const& reg) { return reg.toLocal(); });
36 | return localGroups;
37 | }
38 |
39 | } // namespace mxl::lib::fabrics::ofi
40 |
--------------------------------------------------------------------------------
/lib/tests/fabrics/ofi/test_Provider.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #include
6 | #include "Provider.hpp"
7 |
8 | using namespace mxl::lib::fabrics::ofi;
9 |
10 | TEST_CASE("ofi: Provider enum to API conversion", "[ofi][Provider]")
11 | {
12 | REQUIRE(providerToAPI(Provider::TCP) == MXL_SHARING_PROVIDER_TCP);
13 | REQUIRE(providerToAPI(Provider::VERBS) == MXL_SHARING_PROVIDER_VERBS);
14 | REQUIRE(providerToAPI(Provider::EFA) == MXL_SHARING_PROVIDER_EFA);
15 | REQUIRE(providerToAPI(Provider::SHM) == MXL_SHARING_PROVIDER_SHM);
16 | }
17 |
18 | TEST_CASE("ofi: Provider enum from API conversion", "[ofi][Provider]")
19 | {
20 | REQUIRE(providerFromAPI(MXL_SHARING_PROVIDER_TCP) == Provider::TCP);
21 | REQUIRE(providerFromAPI(MXL_SHARING_PROVIDER_VERBS) == Provider::VERBS);
22 | REQUIRE(providerFromAPI(MXL_SHARING_PROVIDER_EFA) == Provider::EFA);
23 | REQUIRE(providerFromAPI(MXL_SHARING_PROVIDER_SHM) == Provider::SHM);
24 | REQUIRE_FALSE(providerFromAPI(static_cast(999)).has_value());
25 | }
26 |
27 | TEST_CASE("ofi: Provider from string", "[ofi][Provider]")
28 | {
29 | REQUIRE(providerFromString("tcp") == Provider::TCP);
30 | REQUIRE(providerFromString("verbs") == Provider::VERBS);
31 | REQUIRE(providerFromString("efa") == Provider::EFA);
32 | REQUIRE(providerFromString("shm") == Provider::SHM);
33 |
34 | REQUIRE_FALSE(providerFromString("invalid").has_value());
35 | REQUIRE_FALSE(providerFromString("foo").has_value());
36 | }
37 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/FlowState.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include
7 | #include
8 |
9 | namespace mxl::lib
10 | {
11 | /**
12 | * Internal data relevant to the current state of an active flow.
13 | * This data is shared among media functions for inter process communication
14 | * and synchronization.
15 | */
16 | struct FlowState
17 | {
18 | /**
19 | * The flow data inode. Used to detect if the flow was recreated and
20 | * the current in-memory mapping of the flow has become stale as a
21 | * result.
22 | */
23 | ino_t inode;
24 |
25 | /**
26 | * 32 bit word used synchronization between a writer and multiple readers.
27 | * This value can be used by futexes. When a FlowWriter commits some
28 | * data (a grain, a slice, etc) it will increment this value and then
29 | * wake all FlowReaders waiting on this memory address.
30 | */
31 | std::uint32_t syncCounter;
32 |
33 | /**
34 | * Default constructor that value initializes all members.
35 | */
36 | constexpr FlowState() noexcept;
37 | };
38 |
39 | /**************************************************************************/
40 | /* Inline implementatiom. */
41 | /**************************************************************************/
42 |
43 | constexpr FlowState::FlowState() noexcept
44 | : inode{}
45 | , syncCounter{}
46 | {}
47 | }
48 |
--------------------------------------------------------------------------------
/lib/internal/src/Deferred.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include
7 |
8 | namespace mxl::lib
9 | {
10 | /** \brief Helper class that is created by a call to \see defer().
11 | * When a object created from this class goes out of scope, the function passed to defer() is run.
12 | * This class should never be used directly.
13 | */
14 | template
15 | class Deferred
16 | {
17 | public:
18 | Deferred(Deferred const&) = delete;
19 | Deferred(Deferred&&) = delete;
20 | Deferred& operator=(Deferred const&) = delete;
21 | Deferred& operator=(Deferred&&) = delete;
22 |
23 | /** \brief Calls the deferred function
24 | */
25 | constexpr ~Deferred() noexcept(std::is_nothrow_invocable_v)
26 | {
27 | _f();
28 | }
29 |
30 | private:
31 | /** \brief The construtor is private, an can only be called from defer()
32 | */
33 | constexpr Deferred(F&& f)
34 | : _f(std::forward(f))
35 | {}
36 |
37 | /** \brief Allow Deferred to be constructed from defer()
38 | */
39 | template
40 | friend constexpr Deferred defer(N&& f) noexcept;
41 |
42 | private:
43 | F _f;
44 | };
45 |
46 | template
47 | [[nodiscard("The value returned from defer() must not be discarded. Discarding it calls the function passed to defer() right away.")]]
48 | constexpr Deferred defer(F&& f) noexcept
49 | {
50 | return Deferred{std::forward(f)};
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/src/internal/Fabric.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #pragma once
6 |
7 | #include
8 | #include
9 | #include "FabricInfo.hpp"
10 |
11 | namespace mxl::lib::fabrics::ofi
12 | {
13 |
14 | /** \brief RAIII wrapper around a libfabric fabric object (`fid_fabric`).
15 | */
16 | class Fabric
17 | {
18 | public:
19 | ~Fabric();
20 |
21 | Fabric(Fabric const&) = delete;
22 | void operator=(Fabric const&) = delete;
23 |
24 | Fabric(Fabric&&) noexcept;
25 | Fabric& operator=(Fabric&&);
26 |
27 | /** \brief Mutable accessor for the underlying raw libfabric fabric object.
28 | */
29 | [[nodiscard]]
30 | ::fid_fabric* raw() noexcept;
31 | /** \brief Immutable accessor for the underlying raw libfabric fabric object.
32 | */
33 | [[nodiscard]]
34 | ::fid_fabric const* raw() const noexcept;
35 |
36 | /** \brief Open a fabric object based on the provided FabricInfoView.
37 | *
38 | * \param info The fabric info to use when opening the fabric.
39 | * \return A shared pointer to the opened Fabric object.
40 | */
41 | static std::shared_ptr open(FabricInfoView info);
42 |
43 | /** \brief Get a view on the libfabric info used to open this fabric.
44 | */
45 | [[nodiscard]]
46 | FabricInfoView info() const noexcept;
47 |
48 | private:
49 | void close();
50 |
51 | Fabric(::fid_fabric* raw, FabricInfoView info);
52 |
53 | private:
54 | ::fid_fabric* _raw;
55 | FabricInfo _info;
56 | };
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/lib/tests/fabrics/ofi/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | #
3 | # SPDX-License-Identifier: Apache-2.0
4 |
5 | if (NOT TARGET Catch2::Catch2WithMain)
6 | find_package(Catch2 REQUIRED)
7 | endif()
8 |
9 | add_executable(mxl-fabrics-ofi-tests)
10 |
11 | target_compile_features(mxl-fabrics-ofi-tests
12 | PRIVATE
13 | cxx_std_20
14 | )
15 |
16 | set_target_properties(mxl-fabrics-ofi-tests
17 | PROPERTIES
18 | POSITION_INDEPENDENT_CODE ON
19 | VISIBILITY_INLINES_HIDDEN ON
20 | C_VISIBILITY_PRESET hidden
21 | CXX_VISIBILITY_PRESET hidden
22 | C_EXTENSIONS OFF
23 | CXX_EXTENSIONS OFF
24 | )
25 |
26 | target_sources(mxl-fabrics-ofi-tests
27 | PRIVATE
28 | test_Address.cpp
29 | test_Domain.cpp
30 | test_Provider.cpp
31 | test_Region.cpp
32 | )
33 |
34 | target_link_libraries(mxl-fabrics-ofi-tests
35 | PRIVATE
36 | mxl
37 | mxl-internal-headers
38 | mxl-fabrics
39 | mxl-fabrics-objects
40 | Catch2::Catch2WithMain
41 | stduuid
42 | )
43 |
44 | target_include_directories(mxl-fabrics-ofi-tests
45 | PRIVATE
46 | "${CMAKE_CURRENT_SOURCE_DIR}/../../../fabrics/ofi/src/internal"
47 | )
48 |
49 | # Enable LTO/IPO on target if enabled and supported
50 | # This is necessary here, because the tests directly link the OBJECTS library
51 | # that has LTO/IPO enabled.
52 | mxl_enable_target_ipo(mxl-fabrics-ofi-tests)
53 |
54 | include(CTest)
55 | include(Catch)
56 | catch_discover_tests(mxl-fabrics-ofi-tests)
57 |
58 |
59 |
--------------------------------------------------------------------------------
/lib/internal/include/mxl-internal/Sync.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #pragma once
5 |
6 | #include
7 | #include "Timing.hpp"
8 |
9 | namespace mxl::lib
10 | {
11 | /**
12 | * Wait until *in_addr changes or timeout expires.
13 | *
14 | * \param in_addr The memory address to monitor. Must refer to a 32 bit value.
15 | * \param in_expected The initial value expected at in_addr
16 | * \param in_deadline Until when to wait. Timepoint is expected to come from Clock::Realtime.
17 | * \return true if value changed, false if timeout expired
18 | */
19 | template
20 | bool waitUntilChanged(T const* in_addr, T in_expected, Timepoint in_deadline);
21 |
22 | /**
23 | * Wait until *in_addr changes or timeout expires.
24 | *
25 | * \param in_addr The memory address to monitor. Must refer to a 32 bit value.
26 | * \param in_expected The initial value expected at in_addr
27 | * \param in_timeout How long to wait.
28 | * \return true if value changed, false if timeout expired
29 | */
30 | template
31 | bool waitUntilChanged(T const* in_addr, T in_expected, Duration in_timeout);
32 |
33 | /**
34 | * Wake a single waiter waiting on in_addr
35 | *
36 | * \param in_addr The memory address to signal. Must refer to a 32 bit value.
37 | */
38 | template
39 | void wakeOne(T const* in_addr);
40 |
41 | /**
42 | * Wake all waiters waiting on in_addr
43 | *
44 | * \param in_addr The memory address to signal. Must refer to a 32 bit value.
45 | */
46 | template
47 | void wakeAll(T const* in_addr);
48 | }
49 |
--------------------------------------------------------------------------------
/lib/internal/src/PosixFlowIoFactory.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | // SPDX-License-Identifier: Apache-2.0
3 |
4 | #include "mxl-internal/PosixFlowIoFactory.hpp"
5 | #include "PosixContinuousFlowReader.hpp"
6 | #include "PosixContinuousFlowWriter.hpp"
7 | #include "PosixDiscreteFlowReader.hpp"
8 | #include "PosixDiscreteFlowWriter.hpp"
9 |
10 | namespace mxl::lib
11 | {
12 | PosixFlowIoFactory::~PosixFlowIoFactory() = default;
13 |
14 | std::unique_ptr PosixFlowIoFactory::createDiscreteFlowReader(FlowManager const& manager, uuids::uuid const& flowId,
15 | std::unique_ptr&& data) const
16 | {
17 | return std::make_unique(manager, flowId, std::move(data));
18 | }
19 |
20 | std::unique_ptr PosixFlowIoFactory::createContinuousFlowReader(FlowManager const& manager, uuids::uuid const& flowId,
21 | std::unique_ptr&& data) const
22 | {
23 | return std::make_unique(manager, flowId, std::move(data));
24 | }
25 |
26 | std::unique_ptr PosixFlowIoFactory::createDiscreteFlowWriter(FlowManager const& manager, uuids::uuid const& flowId,
27 | std::unique_ptr&& data) const
28 | {
29 | return std::make_unique(manager, flowId, std::move(data));
30 | }
31 |
32 | std::unique_ptr PosixFlowIoFactory::createContinuousFlowWriter(FlowManager const& manager, uuids::uuid const& flowId,
33 | std::unique_ptr&& data) const
34 | {
35 | return std::make_unique(manager, flowId, std::move(data));
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Doxyfile.in:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | # SPDX-License-Identifier: Apache-2.0
3 |
4 | # Doxyfile configuration for generating documentation for C, C++, and .h files
5 | # located in the lib/ and mxlapp/ subdirectories.
6 |
7 | # Project settings
8 | PROJECT_NAME = "MXL : Media eXchange Layer"
9 | PROJECT_BRIEF = "MXL"
10 | OUTPUT_DIRECTORY = docs
11 | OUTPUT_LANGUAGE = English
12 |
13 | # Input settings
14 | INPUT = @CMAKE_CURRENT_SOURCE_DIR@/README.md @CMAKE_CURRENT_SOURCE_DIR@/lib
15 | FILE_PATTERNS = *.c *.cpp *.h *.hpp *.md
16 | RECURSIVE = YES
17 | USE_MDFILE_AS_MAINPAGE = README.md
18 |
19 | # Build settings
20 | EXTRACT_ALL = YES
21 | EXTRACT_PRIVATE = YES
22 | EXTRACT_STATIC = YES
23 | EXTRACT_LOCAL_CLASSES = YES
24 | EXTRACT_LOCAL_METHODS = YES
25 |
26 | # Source browsing settings
27 | SOURCE_BROWSER = YES
28 | INLINE_SOURCES = YES
29 |
30 | # Documentation generation format (HTML enabled by default)
31 | GENERATE_HTML = YES
32 | HTML_OUTPUT = html
33 |
34 | # Optional: Enable LaTeX or other formats as needed
35 | GENERATE_LATEX = NO
36 | GENERATE_XML = NO
37 | GENERATE_MAN = NO
38 | GENERATE_RTF = NO
39 |
40 | # Warnings and diagnostics
41 | WARNINGS = YES
42 | WARN_IF_UNDOCUMENTED = YES
43 | WARN_NO_PARAMDOC = YES
44 |
45 | # Additional options (optional)
46 | SHOW_USED_FILES = YES
47 | SHOW_FILES = YES
48 | SORT_MEMBER_DOCS = YES
49 | SORT_BRIEF_DOCS = YES
50 | SORT_BY_SCOPE_NAME = YES
51 |
52 | GENERATE_TREEVIEW = YES
53 | DISABLE_INDEX = NO
54 | FULL_SIDEBAR = NO
55 | HTML_EXTRA_STYLESHEET = @AWESOME_CSS_DIR@/doxygen-awesome.css
56 | HTML_COLORSTYLE = LIGHT
57 | GENERATE_TODOLIST = YES
58 |
--------------------------------------------------------------------------------
/lib/fabrics/ofi/src/internal/Provider.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2 | //
3 | // SPDX-License-Identifier: Apache-2.0
4 |
5 | #include "Provider.hpp"
6 | #include