Live video on the AT Protocol
1#!/bin/bash
2
3# Test that we can combine then split segments and get the same files
4
5set -euo pipefail
6
7SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
8
9# Detect platform/arch for correct build dir
10UNAME_S=$(uname -s | tr '[:upper:]' '[:lower:]')
11UNAME_M=$(uname -m)
12if [[ "$UNAME_S" == "darwin" && "$UNAME_M" == "arm64" ]]; then
13 BUILD_DIR="build-darwin-arm64"
14elif [[ "$UNAME_S" == "linux" && "$UNAME_M" == "x86_64" ]]; then
15 BUILD_DIR="build-linux-amd64"
16else
17 echo "Unsupported platform: $UNAME_S/$UNAME_M"
18 exit 1
19fi
20
21DEBUG_DIR="$(mktemp -d)"
22set +e
23$SCRIPT_DIR/../$BUILD_DIR/streamplace combine --debug-dir="$DEBUG_DIR/segments-1" "$DEBUG_DIR/combined.mp4" $(find "$@" -name '*.mp4' | sort)
24$SCRIPT_DIR/../$BUILD_DIR/streamplace combine --debug-dir="$DEBUG_DIR/segments-2" "$DEBUG_DIR/combined2.mp4" $(find "$DEBUG_DIR/segments-1" -name '*.mp4' | sort)
25EXIT_CODE=$?
26set -e
27if [ $EXIT_CODE -ne 0 ]; then
28 $SCRIPT_DIR/compare-hash.sh "$DEBUG_DIR/segments-1" "$DEBUG_DIR/segments-2"
29 exit $EXIT_CODE
30fi
31echo "Success"