Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions examples/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
# SPDX-License-Identifier: Apache-2.0
FROM debian:trixie-slim AS base

RUN apt-get update && apt-get install -y \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-base \
curl zip unzip tar \
dumb-init \
&& rm -r /var/lib/apt/lists/*


RUN useradd -m mxl

FROM base AS builder

ARG CLANG_VERSION=19
RUN apt-get update && apt-get install -y \
build-essential bison flex \
cmake ninja-build \
pkg-config \
git \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev

USER mxl

WORKDIR /home/mxl

RUN git clone https://github.com/microsoft/vcpkg.git "${HOME}/vcpkg" \
&& cd "${HOME}/vcpkg" \
&& ./bootstrap-vcpkg.sh -disableMetrics

RUN mkdir mxl
COPY CMakeLists.txt mxl/CMakeLists.txt
COPY CMakePresets.json mxl/CMakePresets.json
COPY Doxyfile.in mxl/Doxyfile.in
COPY vcpkg.json mxl/vcpkg.json
COPY lib mxl/lib
COPY cmake mxl/cmake
COPY tools mxl/tools
COPY utils mxl/utils

RUN cmake -S "${HOME}/mxl" --preset Linux-GCC-Release -DCMAKE_INSTALL_PREFIX=/usr
RUN ninja -C "${HOME}/mxl/build/Linux-GCC-Release"

USER 0:0
RUN ninja -C "/home/mxl/mxl/build/Linux-GCC-Release" install

FROM base AS mxl
COPY --from=builder /usr/lib/x86_64-linux-gnu/libmxl* /usr/lib/x86_64-linux-gnu/
COPY --from=builder /usr/bin/mxl-* /usr/bin/
USER mxl
WORKDIR /home/mxl
ENTRYPOINT ["/bin/bash", "-c"]

FROM mxl AS mxl-info
ENTRYPOINT ["/usr/bin/mxl-info"]

FROM mxl AS mxl-gst-testsrc
ENTRYPOINT ["/usr/bin/mxl-gst-testsrc"]

FROM mxl AS mxl-fake-reader
COPY examples/scripts/fake-reader.sh /home/mxl/fake-reader.sh
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/home/mxl/fake-reader.sh"]
18 changes: 0 additions & 18 deletions examples/Dockerfile.reader.txt

This file was deleted.

30 changes: 0 additions & 30 deletions examples/Dockerfile.writer.audio.loop.txt

This file was deleted.

20 changes: 0 additions & 20 deletions examples/Dockerfile.writer.txt

This file was deleted.

30 changes: 0 additions & 30 deletions examples/Dockerfile.writer.video.loop.txt

This file was deleted.

118 changes: 66 additions & 52 deletions examples/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,69 +1,83 @@
# SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
# SPDX-FileCopyrightText: 2026 Contributors to the Media eXchange Layer project.
# SPDX-License-Identifier: Apache-2.0

name: mxl-example
volumes:
mxl-domain:
driver: local
driver_opts:
device: none
type: tmpfs
o: nosuid,strictatime,uid=1000,gid=1000,mode=0755
services:
init:
image: alpine
command: ["sh", "-c", "mkdir -p /dev/shm/mxl"]
# Writes a test video flow to the domain
video-flow-writer:
build:
dockerfile: examples/Dockerfile
context: ..
target: mxl-gst-testsrc
volumes:
- mxl-domain:/mxl-domain
- type: bind
source: /dev/shm
target: /dev/shm
restart: no

writer-media-function:
image: mxl-writer
profiles: [test-source]
depends_on:
- init
source: flow-configs
target: /home/mxl/flow-configs
command: -d /mxl-domain -v flow-configs/flow-video-v210.json
# Writes a test audio flow to the domain
audio-flow-writer:
build:
dockerfile: examples/Dockerfile
context: ..
dockerfile: examples/Dockerfile.writer.txt
restart: unless-stopped
target: mxl-gst-testsrc
volumes:
- type: volume
source: mxl-domain
target: /mxl-domain
- type: bind
source: /dev/shm/mxl
target: /domain

writer-looper-video-media-function:
image: mxl-writer-video-looper
profiles: [looping-file-source]
depends_on:
- init
source: flow-configs
target: /home/mxl/flow-configs
command: -d /mxl-domain -a flow-configs/flow-audio.json
# Simulates a video flow reader
video-fake-reader:
build:
dockerfile: examples/Dockerfile
context: ..
dockerfile: examples/Dockerfile.writer.video.loop.txt
restart: unless-stopped
target: mxl-fake-reader
volumes:
- type: bind
source: /dev/shm/mxl
target: /domain

writer-looper-audio-media-function:
image: mxl-writer-audio-looper
profiles: [looping-file-source]
depends_on:
- init
- type: volume
source: mxl-domain
target: /mxl-domain
command: --domain /mxl-domain --video-flow-id 5fbec3b1-1b0f-417d-9059-8b94a47197ed --interval 1
# Simulates an audio flow reader
audio-fake-reader:
build:
dockerfile: examples/Dockerfile
context: ..
dockerfile: examples/Dockerfile.writer.audio.loop.txt
restart: unless-stopped
target: mxl-fake-reader
volumes:
- type: bind
source: /dev/shm/mxl
target: /domain

reader-media-function:
image: mxl-reader
depends_on:
- init
- type: volume
source: mxl-domain
target: /mxl-domain
command: --domain /mxl-domain --audio-flow-id 5fbec3b1-1b0f-417d-9059-8b94a47197ed --interval 1
# Prints the video flow information every 5 seconds.
video-flow-info:
build:
dockerfile: examples/Dockerfile
context: ..
dockerfile: examples/Dockerfile.reader.txt
restart: unless-stopped
target: mxl-info
volumes:
- type: bind
source: /dev/shm/mxl
target: /domain
stdin_open: true
tty: true
- type: volume
source: mxl-domain
target: /mxl-domain
entrypoint: ["/usr/bin/dumb-init", "--"]
command: ["/bin/bash", "-c", "trap 'exit 0' SIGINT SIGTERM; while true; do mxl-info mxl:///mxl-domain?id=5fbec3b1-1b0f-417d-9059-8b94a47197ed; sleep 5; done"]
# Prints the audio flow information every 5 seconds.
audio-flow-info:
build:
dockerfile: examples/Dockerfile
context: ..
target: mxl-info
volumes:
- type: volume
source: mxl-domain
target: /mxl-domain
entrypoint: ["/usr/bin/dumb-init", "--"]
command: ["/bin/bash", "-c", "trap 'exit 0' SIGINT SIGTERM; while true; do mxl-info mxl:///mxl-domain?id=b3bb5be7-9fe9-4324-a5bb-4c70e1084449; sleep 5; done"]
23 changes: 23 additions & 0 deletions examples/flow-configs/flow-audio.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$copyright": "SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.",
"$license": "SPDX-License-Identifier: Apache-2.0",
"description": "MXL Audio Flow",
"format": "urn:x-nmos:format:audio",
"tags": {
"urn:x-nmos:tag:grouphint/v1.0": [
"Media Function XYZ:Audio"
]
},
"label": "MXL Audio Flow",
"version": "1441812152:154331951",
"id": "b3bb5be7-9fe9-4324-a5bb-4c70e1084449",
"media_type": "audio/float32",
"sample_rate": {
"numerator": 48000
},
"channel_count": 2,
"bit_depth": 32,
"parents": [],
"source_id": "2aa143ac-0ab7-4d75-bc32-5c00c13d186f",
"device_id": "169feb2c-3fae-42a5-ae2e-f6f8cbce29cf"
}
3 changes: 3 additions & 0 deletions examples/flow-configs/flow-audio.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.

SPDX-License-Identifier: Apache-2.0
43 changes: 43 additions & 0 deletions examples/flow-configs/flow-video-v210.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$copyright": "SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.",
"$license": "SPDX-License-Identifier: Apache-2.0",
"description": "MXL Test Flow, 1080p29",
"id": "5fbec3b1-1b0f-417d-9059-8b94a47197ed",
"tags": {
"urn:x-nmos:tag:grouphint/v1.0": [
"Media Function XYZ:Video"
]
},
"format": "urn:x-nmos:format:video",
"label": "MXL Test Flow, 1080p29",
"parents": [],
"media_type": "video/v210",
"grain_rate": {
"numerator": 30000,
"denominator": 1001
},
"frame_width": 1920,
"frame_height": 1080,
"interlace_mode": "progressive",
"colorspace": "BT709",
"components": [
{
"name": "Y",
"width": 1920,
"height": 1080,
"bit_depth": 10
},
{
"name": "Cb",
"width": 960,
"height": 1080,
"bit_depth": 10
},
{
"name": "Cr",
"width": 960,
"height": 1080,
"bit_depth": 10
}
]
}
3 changes: 3 additions & 0 deletions examples/flow-configs/flow-video-v210.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.

SPDX-License-Identifier: Apache-2.0
Loading
Loading