Skip to content
Open
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ setup/input/
setup/output/
**/validation_results.txt
**/openssl_onvif_log.txt

player/build/
deb/build/
flatpak/build/
103 changes: 103 additions & 0 deletions deb/build-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/bin/bash

# Exit on error
set -e

# Function to check Ubuntu version
check_ubuntu_version() {
if [[ $(lsb_release -rs) != "24.04" || $(lsb_release -is) != "Ubuntu" ]]; then
echo "Error: This script is only for Ubuntu 24.04."
exit 1
fi
}

# Check the system is Ubuntu 24.04
check_ubuntu_version

# Install required packages
sudo apt update -y && sudo apt install -y libssl-dev cmake build-essential qtbase5-dev qt5-qmake libqt5multimedia5-plugins qtmultimedia5-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

# Parse arguments
if [[ $# -ne 4 ]]; then
echo "Usage: $0 <Release|Debug> <threaded-signing|unthreaded-signing> <FFMPEG_PATH> <VERSION>"
exit 1
fi

BUILD_TYPE=$1
SIGNING_TYPE=$2
FFMPEG_PATH=$3
VERSION=$4

TEMPLATE_PACKAGE_NAME=onvif-player_ubuntu24.04-amd64
PACKAGE_NAME=onvif-player-${VERSION}_ubuntu24.04-amd64

# Validate BUILD_TYPE
if [[ $BUILD_TYPE != "Release" && $BUILD_TYPE != "Debug" ]]; then
echo "Error: BUILD_TYPE must be 'Release' or 'Debug'."
exit 1
fi

# Validate SIGNING_TYPE
if [[ $SIGNING_TYPE != "threaded-signing" && $SIGNING_TYPE != "unthreaded-signing" ]]; then
echo "Error: SIGNING_TYPE must be 'threaded-signing' or 'unthreaded-signing'."
exit 1
fi

# Validate FFMPEG_PATH
if [[ ! -d $FFMPEG_PATH ]]; then
echo "Error: FFMPEG_PATH does not exist or is not a directory."
exit 1
fi

# Step 6: Remove and recreate 'build' directory
rm -rf build
mkdir build

# Prepare build folder
cp -r $TEMPLATE_PACKAGE_NAME build/$PACKAGE_NAME
ln -s -r ../player build/player

cd build

# Prepare postinst file
chmod 775 $PACKAGE_NAME/DEBIAN/postinst

# Replace $VERSION in control file
sed -i "s/\$VERSION/$VERSION/g" $PACKAGE_NAME/DEBIAN/control

# Replace $VERSION in desktop file
mkdir -p $PACKAGE_NAME/usr/share/applications
sed -i "s/\$VERSION/$VERSION/g" $PACKAGE_NAME/usr/share/applications/OnvifPlayer.desktop

cd player

# Create build folder
mkdir -p build
cd build

# Run cmake
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLUGIN_NAME=$SIGNING_TYPE -DFFMPEG_PATH=$FFMPEG_PATH ..

# Build the project
cmake --build . -j $(nproc)

cd ../..

# Copy ONVIFPlayer binary
mkdir -p $PACKAGE_NAME/usr/local/bin
cp player/build/bin/${BUILD_TYPE}/ONVIFPlayer $PACKAGE_NAME/usr/local/bin/onvif-player
chmod 775 $PACKAGE_NAME/usr/local/bin/onvif-player

# Copy FFmpeg shared libraries
mkdir -p $PACKAGE_NAME/usr/local/lib
cp -r $FFMPEG_PATH/lib $PACKAGE_NAME/usr/local/lib/onvif-player
rm -rf $PACKAGE_NAME/usr/local/lib/onvif-player/libavdevice.*
rm -rf $PACKAGE_NAME/usr/local/lib/onvif-player/libavfilter.*
rm -rf $PACKAGE_NAME/usr/local/lib/onvif-player/libpostproc.*
rm -rf $PACKAGE_NAME/usr/local/lib/onvif-player/pkgconfig

# Step 20: Build Debian package
dpkg-deb --build $PACKAGE_NAME

echo "Debian package built successfully: $PACKAGE_NAME"

25 changes: 25 additions & 0 deletions deb/onvif-player_ubuntu24.04-amd64/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Package: onvif-player
Version: $VERSION
Maintainer: Vladimir Dergachyov <vladimir.dergachyov@grse.de>
Architecture: amd64
Description: Onvif Player $VERSION
Depends: libssl3t64,
libqt5core5t64,
libqt5gui5t64,
libqt5network5t64,
libqt5widgets5t64,
libqt5multimedia5-plugins,
libgstreamer1.0-0,
gstreamer1.0-plugins-base,
gstreamer1.0-plugins-good,
gstreamer1.0-plugins-bad,
gstreamer1.0-plugins-ugly,
gstreamer1.0-libav,
gstreamer1.0-tools,
gstreamer1.0-x,
gstreamer1.0-alsa,
gstreamer1.0-gl,
gstreamer1.0-gtk3,
gstreamer1.0-qt5,
gstreamer1.0-pulseaudio

5 changes: 5 additions & 0 deletions deb/onvif-player_ubuntu24.04-amd64/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

echo "/usr/local/lib/onvif-player" > /etc/ld.so.conf.d/onvif-player.conf
ldconfig

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Onvif Player
Comment=Onvif Player $VERSION
Exec=/usr/local/bin/onvif-player
Icon=/usr/share/icons/onvif-player.png
Terminal=false
Type=Application
Categories=AudioVideo;

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 81 additions & 0 deletions flatpak/build-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash

# Exit immediately if a command exits with a non-zero status
set -e

# Validate arguments
if [ "$#" -ne 4 ]; then
echo "Usage: $0 <Release|Debug> <threaded-signing|unthreaded-signing> <ffmpeg_dir> <version>"
exit 1
fi

BUILD_TYPE=$1
SIGNING_TYPE=$2
FFMPEG_PATH=$3
VERSION=$4

# Check if the first argument is Release or Debug
if [[ "$BUILD_TYPE" != "Release" && "$BUILD_TYPE" != "Debug" ]]; then
echo "Error: First argument must be 'Release' or 'Debug'."
exit 1
fi

# Check if the second argument is threaded-signing or unthreaded-signing
if [[ "$SIGNING_TYPE" != "threaded-signing" && "$SIGNING_TYPE" != "unthreaded-signing" ]]; then
echo "Error: Second argument must be 'threaded-signing' or 'unthreaded-signing'."
exit 1
fi

# Check if the third argument is a valid directory
if [ ! -d "$FFMPEG_PATH" ]; then
echo "Error: Third argument must be a valid directory."
exit 1
fi

# Check if flatpak is installed and executable
if ! command -v flatpak &> /dev/null; then
echo "Error: 'flatpak' is not installed or not in PATH. Please install it and try again."
exit 1
fi

# Check if flatpak-builder is installed and executable
if ! command -v flatpak-builder &> /dev/null; then
echo "Error: 'flatpak-builder' is not installed or not in PATH. Please install it and try again."
exit 1
fi

# Remove 'build' directory if it exists and create a new one
rm -rf build
mkdir build

# Copy necessary files to the build directory
cp org.onvif.Player.yaml build/

# Create a symlink to the player folder in the build directory
ln -s -r "../player" build/player

# Create a symlink to the ffmpeg folder in the build directory
ln -s "$FFMPEG_PATH" build/ffmpeg

# Prepare share folder
cp -r ./share build/share

# Change to the build directory
cd build

# Replace placeholders
sed -i "s|\$VERSION|$VERSION|g" share/org.onvif.Player.desktop
sed -i "s|\$BUILD_TYPE|$BUILD_TYPE|g" org.onvif.Player.yaml
sed -i "s|\$SIGNING_TYPE|$SIGNING_TYPE|g" org.onvif.Player.yaml

# Add the Flathub repository if it doesn't exist
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo

# Build the Flatpak package
flatpak-builder --force-clean --user --install-deps-from=flathub --repo=repo builddir org.onvif.Player.yaml

# Create the Flatpak bundle
flatpak build-bundle repo onvif-player-$VERSION-x86_64.flatpak org.onvif.Player

echo "Build completed successfully. Output file: onvif-player-$VERSION-x86_64.flatpak"

48 changes: 48 additions & 0 deletions flatpak/org.onvif.Player.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
app-id: org.onvif.Player
runtime: org.kde.Platform
runtime-version: 5.15-24.08
sdk: org.kde.Sdk
command: onvif-player
finish-args:
- --socket=pulseaudio
- --device=all
- --filesystem=host
- --socket=x11
- --socket=fallback-x11
cleanup-commands:
- find /app/ffmpeg -mindepth 1 -maxdepth 1 ! -name 'lib' -exec rm -rf {} \;
- rm -rf /app/ffmpeg/lib/libavdevice.*
- rm -rf /app/ffmpeg/lib/libavfilter.*
- rm -rf /app/ffmpeg/lib/libpostproc.*
- rm -rf /app/ffmpeg/lib/pkgconfig
modules:
- name: ffmpeg
buildsystem: simple
build-commands:
- mkdir -p /app/ffmpeg
- cp -r ./* /app/ffmpeg
sources:
- type: dir
path: ffmpeg
- name: onvif-player
buildsystem: simple
builddir: true
build-commands:
- cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLUGIN_NAME=$SIGNING_TYPE -DFFMPEG_PATH=/app/ffmpeg .
- cmake --build . -j $(nproc)
- mkdir -p /app/bin
- mv bin/$BUILD_TYPE/ONVIFPlayer /app/bin/onvif-player
sources:
- type: dir
path: player
- name: share
buildsystem: simple
builddir: true
build-commands:
- mkdir -p /app/share/applications
- cp org.onvif.Player.desktop /app/share/applications/
- mkdir -p /app/share/icons/hicolor/32x32/apps
- cp org.onvif.Player.png /app/share/icons/hicolor/32x32/apps/
sources:
- type: dir
path: share
8 changes: 8 additions & 0 deletions flatpak/share/org.onvif.Player.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Name=Onvif Player
Comment=Onvif Player $VERSION
Exec=onvif-player
Icon=org.onvif.Player
Terminal=false
Type=Application
Categories=AudioVideo;
Binary file added flatpak/share/org.onvif.Player.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion player/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if(NOT LINUX)
message( FATAL_ERROR "Only for linux build" )
endif()

project(ONVIFPlayer VERSION 2.0.0 LANGUAGES CXX)
project(ONVIFPlayer VERSION 3.0.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -73,3 +73,4 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
add_subdirectory(src)