Files

114 lines
2.2 KiB
Bash
Raw Permalink Normal View History

2026-03-02 09:19:50 +02:00
#!/bin/sh
2026-05-07 05:24:23 +03:00
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause-Clear
2026-03-02 09:19:50 +02:00
if [ "$1" = "" ]
then
echo "Usage: $0 machine [decoder]..."
exit 1
fi
2026-07-09 11:06:34 +03:00
DEV=$(find /sys/bus/platform/devices/ -name "*.video-codec")
if [ ! -e "$DEV" ]
2026-03-02 09:19:50 +02:00
then
2026-07-09 11:06:34 +03:00
echo "$0: can't find videoc-codec device"
exit 2
fi
if [ ! -e "$DEV/driver" ]
2026-03-02 09:19:50 +02:00
then
echo "$0: can't detect video driver, check that the device is bound"
exit 2
fi
2026-07-09 11:06:34 +03:00
DRV=$(basename $(readlink "$DEV/driver") | sed -e 's/qcom-//')
2026-03-02 09:19:50 +02:00
MACHINE="$1"
SKIPFILE="$(dirname $0)/${DRV}-${MACHINE}-skip.txt"
if [ -r "${SKIPFILE}" ]
then
SKIPS="-sv $(cat "${SKIPFILE}")"
else
SKIPS=""
fi
SUMMARY="$DRV-$MACHINE.md"
# Default to system locaion
if [ -r fluster.py ]
then
echo "Generating $SUMMARY using fluster from the current location"
FLUSTER=./fluster.py
2026-03-11 10:04:12 +02:00
elif [ -r $(dirname $0)/fluster/fluster.py ]
then
echo "Generating $SUMMARY using fluster from the current location"
FLUSTER=$(dirname $0)/fluster/fluster.py
2026-03-02 09:19:50 +02:00
elif [ "$(which fluster)" != "" ]
then
echo "Generating $SUMMARY using system-wide fluster"
FLUSTER=fluster
else
echo "Couldn't find fluster"
exit 3
fi
# Skip the machine
shift
2026-07-09 11:06:34 +03:00
if [ "$(which v4l2-ctl)" = "" ]
2026-05-07 05:24:23 +03:00
then
2026-07-09 11:06:34 +03:00
echo "$0: v4l2-ctl not found, please install v4l-utils"
exit 3
fi
fourcc_to_codec() {
case "$1" in
H264) echo "H.264" ;;
HEVC) echo "H.265" ;;
VP80) echo "VP8" ;;
VP90) echo "VP9" ;;
MPG2) echo "MPEG2_VIDEO" ;;
*) ;;
esac
}
CODECS=""
for vid in "$DEV"/video4linux/video*
do
for fourcc in $(v4l2-ctl -d "/dev/$(basename "$vid")" --list-formats-out 2>/dev/null | \
sed -n "s/.*'\(....\)'.*compressed.*/\1/p")
do
codec=$(fourcc_to_codec "$fourcc")
[ -n "$codec" ] || continue
case " $CODECS " in
*" $codec "*) ;;
*) CODECS="${CODECS:+$CODECS }$codec" ;;
esac
done
done
if [ -z "$CODECS" ]
then
echo "$0: no supported compressed formats found for $DEV"
exit 2
2026-05-07 05:24:23 +03:00
fi
DECODERS=""
2026-05-07 05:24:23 +03:00
for codec in ${CODECS}
do
DECODERS="${DECODERS} FFmpeg-${codec}-v4l2m2m GStreamer-${codec}-V4L2"
done
2026-03-02 09:19:50 +02:00
if [ "$1" = "+" ]
then
shift
DECODERS="${DECODERS} $@"
elif [ -n "$1" ]
then
DECODERS="$@"
fi
set -x
2026-04-26 00:50:16 +03:00
exec ${FLUSTER} r -j 1 -s -so "$(dirname $0)/${SUMMARY}" ${SKIPS} -d ${DECODERS}