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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ cppclean_test
tags
.venv-style/
src/test/llm_testing
gstreamer_task/
node_modules/
yarn.*
out
Expand Down
101 changes: 101 additions & 0 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,102 @@ ARG OPENCV_VERSION=4.13.0
RUN OPENCV_VERSION=${OPENCV_VERSION} ./install_opencv.sh
####### End of OpenCV

################### GSTREAMER BUILD ##########################
# Build GStreamer from source so we control exact version and plugin set.
# Legal: gpl=disabled, ugly=disabled — no GPL/patent-risky plugins.
# Installed to /opt/gstreamer (self-contained, includes glib headers).
FROM base_build as gstreamer-builder
ARG GST_VERSION=1.26.2
ARG JOBS=8
ENV DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]

RUN apt-get update && apt-get install -y --no-install-recommends \
python3-pip \
python3-venv \
flex \
bison \
libglib2.0-dev \
libmount-dev \
libpcre2-dev \
libffi-dev \
libssl-dev \
libdrm-dev \
nasm \
yasm \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libswscale-dev \
git \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

RUN python3 -m venv /build_venv && \
/build_venv/bin/pip install --no-cache-dir meson==1.4.1 ninja==1.11.1.1

ENV PATH="/build_venv/bin:${PATH}"

WORKDIR /src
RUN git clone --depth 1 --branch ${GST_VERSION} \
https://gitlab.freedesktop.org/gstreamer/gstreamer.git

WORKDIR /src/gstreamer

# Install prefix: /opt/gstreamer
RUN meson setup \
-Dexamples=disabled \
-Dtests=disabled \
-Dgst-examples=disabled \
-Ddevtools=disabled \
-Dorc=disabled \
-Dgpl=disabled \
-Dpython=disabled \
-Dlibnice=disabled \
-Dugly=disabled \
-Dgst-plugins-bad:gpl=disabled \
-Dgst-plugins-bad:va=disabled \
-Dgst-plugins-bad:doc=disabled \
-Dgst-plugins-bad:nls=disabled \
-Dgst-plugins-bad:directfb=disabled \
-Dgst-plugins-bad:openni2=disabled \
-Dgst-plugins-bad:fdkaac=disabled \
-Dgst-plugins-bad:ladspa=disabled \
-Dgst-plugins-bad:assrender=disabled \
-Dgst-plugins-bad:bs2b=disabled \
-Dgst-plugins-bad:flite=disabled \
-Dgst-plugins-bad:rtmp=disabled \
-Dgst-plugins-bad:opencv=disabled \
-Dgst-plugins-bad:sbc=disabled \
-Dgst-plugins-bad:teletext=disabled \
-Dgst-plugins-bad:x265=disabled \
-Dgst-plugins-bad:webrtcdsp=disabled \
-Dgst-plugins-bad:dash=disabled \
-Dgst-plugins-bad:openjpeg=disabled \
-Dgst-plugins-bad:soundtouch=disabled \
-Dgst-plugins-bad:isac=disabled \
-Dgst-plugins-base:nls=disabled \
-Dgst-plugins-base:gl=disabled \
-Dgst-plugins-base:pango=disabled \
-Dgst-plugins-base:xvideo=disabled \
-Dgst-plugins-good:nls=disabled \
-Dgst-plugins-good:libcaca=disabled \
-Dgst-plugins-good:lame=disabled \
-Dgst-plugins-good:flac=disabled \
-Dgst-plugins-good:dv=disabled \
-Dgst-plugins-good:adaptivedemux2=disabled \
--buildtype=release \
--prefix=/opt/gstreamer \
--libdir=lib \
--libexecdir=bin \
build/

RUN ninja -C build/ -j${JOBS} && meson install -C build/

# Copy glib/glib-2.0 headers into the prefix so it is self-contained.
# glib is a build dependency; its headers live in the system include path.
RUN cp -r /usr/include/glib-2.0 /opt/gstreamer/include/glib-2.0 && \
cp -r /usr/lib/x86_64-linux-gnu/glib-2.0/include/. /opt/gstreamer/include/glib-2.0/

################### BASE BUILD ##########################
FROM base_build as build
ARG BASE_IMAGE
Expand Down Expand Up @@ -125,6 +221,11 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
vim && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# GStreamer built from source — bring in the self-contained prefix.
# Runtime dlopen picks up /opt/gstreamer/lib at runtime via LD_LIBRARY_PATH or ldconfig.
COPY --from=gstreamer-builder /opt/gstreamer /opt/gstreamer
RUN echo /opt/gstreamer/lib > /etc/ld.so.conf.d/gstreamer.conf && ldconfig
# on ubuntu 24.04 python3.12 is used as default python for ovms build and release
# TF build needs python3.10 with numpy as it does not support python3.12
RUN python3.10 -m pip install "numpy<2.0.0" --no-cache-dir
Expand Down
16 changes: 16 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ new_local_repository(
build_file = "@//third_party/boringssl:BUILD",
)

# GStreamer — built from source in gstreamer-builder Docker stage.
# Installed to /opt/gstreamer (self-contained: GStreamer + glib headers).
# Linux: dlopen at runtime (no DT_NEEDED), headers-only for compile.
# Windows: pre-built installer from gstreamer.freedesktop.org/data/pkg/windows/.
new_local_repository(
name = "linux_gstreamer",
path = "/opt/gstreamer",
build_file = "@//third_party/gstreamer:gstreamer_linux.BUILD",
)

new_local_repository(
name = "windows_gstreamer",
path = "C:\\gstreamer\\1.0\\msvc_x86_64",
build_file = "@//third_party/gstreamer:gstreamer_windows.BUILD",
)

new_local_repository(
name = "linux_curl",
path = "/usr/",
Expand Down
100 changes: 100 additions & 0 deletions src/mpi/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#
# Copyright (c) 2025 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

load("//:common_settings.bzl", "COMMON_LOCAL_DEFINES", "ovms_cc_library")

package(default_visibility = ["//visibility:public"])

# Intel Media Processing Interface (Intel MPI) library
# Windows: direct GStreamer linking with D3D11 HW pipeline.
# Linux: GStreamer loaded at runtime via dlopen (gst_loader.cpp).
# CPU decode only; VA-API GPU path deferred.

cc_library(
name = "intel_mpi",
srcs = select({
"//src:windows": ["intel_mpi.cpp"],
"//conditions:default": ["intel_mpi.cpp", "gst_loader.cpp"],
}),
hdrs = select({
"//src:windows": [
"intel_mpi.h",
"imp_mpi_impl.h",
],
"//conditions:default": [
"intel_mpi.h",
"imp_mpi_impl.h",
"gst_loader.h",
],
}),
copts = select({
"//src:windows": [
"/std:c++17",
"/EHsc",
"/MD",
"/DGST_USE_UNSTABLE_API",
"/external:anglebrackets",
"/external:W0",
"/wd4005",
"/wd4100",
"/wd4267",
"/wd4244",
"/wd4996",
],
"//conditions:default": [
"-std=c++17",
],
}),
local_defines = COMMON_LOCAL_DEFINES + select({
"//src:windows": ["INTEL_MPI_AVAILABLE=1"],
"//conditions:default": ["INTEL_MPI_AVAILABLE=1"],
}),
linkopts = select({
"//src:windows": [],
"//conditions:default": ["-ldl"],
}),
deps = select({
"//src:windows": [
"//third_party:openvino",
"//third_party:gstreamer",
],
"//conditions:default": [
"//third_party:openvino",
"//third_party:gstreamer",
],
}),
visibility = ["//visibility:public"],
)

# Thin audio-decode/encode utilities that wrap Intel MPI for OVMS calculators.
# On Linux this is a stub (all functions return false → callers fall back to dr_libs).
ovms_cc_library(
name = "imp_audio_utils",
srcs = ["imp_audio_utils.cpp"],
hdrs = ["imp_audio_utils.hpp"],
local_defines = COMMON_LOCAL_DEFINES + select({
"//src:windows": ["INTEL_MPI_AVAILABLE=1"],
"//conditions:default": [],
}),
deps = select({
"//src:windows": [
":intel_mpi",
"//third_party:openvino",
],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
)
Loading