device: allow to use dummy as a way to test streamer
This adds loopback tests via `tests/`
This commit is contained in:
BIN
tests/capture.bg10p
Normal file
BIN
tests/capture.bg10p
Normal file
Binary file not shown.
BIN
tests/capture.h264
Normal file
BIN
tests/capture.h264
Normal file
Binary file not shown.
BIN
tests/capture.jpeg
Normal file
BIN
tests/capture.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 309 KiB |
13
tests/capture.sh
Executable file
13
tests/capture.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
set -xeo pipefail
|
||||
|
||||
[[ -e capture.jpeg ]] || libcamera-jpeg --timeout 1000 --output capture.jpeg --width 1920 --height 1080 --encoding jpg
|
||||
[[ -e capture.yuv420 ]] || libcamera-jpeg --timeout 1000 --output capture.yuv420 --width 1920 --height 1080 --encoding yuv420
|
||||
[[ -e capture.h264 ]] || libcamera-vid --frames 1 --output capture.h264 --width 1920 --height 1080 --codec h264 --profile main --level 4.2
|
||||
|
||||
# This is not ideal as `libcamera-raw` does not respect `--frames`
|
||||
[[ -e capture.bg10p ]] || libcamera-raw --frames 1 --timeout 300 --verbose 2 --flush --output capture.bg10p --width 2304 --height 1296
|
BIN
tests/capture.yuv420
Normal file
BIN
tests/capture.yuv420
Normal file
Binary file not shown.
49
tests/dummy.sh
Executable file
49
tests/dummy.sh
Executable file
@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "usage: $0 <input-file> [camera-streamer options]"
|
||||
echo
|
||||
echo "examples:"
|
||||
echo " $0 tests/capture.jpeg"
|
||||
echo " $0 tests/capture.jpeg --video-height=720"
|
||||
echo " $0 tests/capture.jpeg --snapshot-height=720 --video-height=480"
|
||||
echo " $0 tests/capture.h264"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
INPUT=$(realpath "$1")
|
||||
shift
|
||||
|
||||
case "$INPUT" in
|
||||
*.jpeg)
|
||||
set -- --camera-format=JPEG --camera-width=1920 --camera-height=1080 "$@"
|
||||
;;
|
||||
|
||||
*.yuv420)
|
||||
set -- --camera-format=YUV420 --camera-width=1920 --camera-height=1080 "$@"
|
||||
;;
|
||||
|
||||
*.h264)
|
||||
set -- --camera-format=H264 --camera-width=1920 --camera-height=1080 "$@"
|
||||
;;
|
||||
|
||||
*.bg10p)
|
||||
set -- --camera-format=BG10P --camera-width=2304 --camera-height=1296 "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "$0: undefined format for $INPUT."
|
||||
exit 1
|
||||
esac
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
cd "$SCRIPT_DIR/.."
|
||||
|
||||
set -xeo pipefail
|
||||
make -j$(nproc)
|
||||
|
||||
exec ./camera-streamer \
|
||||
--camera-type=dummy \
|
||||
--camera-path="$INPUT" \
|
||||
--camera.snapshot-height=1080 \
|
||||
"$@"
|
Reference in New Issue
Block a user