Files
Dmitry Baryshkov 90e9b0e496 fluster.sh: detect codecs
With the patchset to support VP8 and MPEG2 in Iris being around the
corner, add a way to detect the codecs supported by the M2M device
instead of relying on Venus vs Iris driver being a key decision point.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
2026-07-09 11:07:50 +03:00

114 lines
2.2 KiB
Bash
Executable File

#!/bin/sh
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause-Clear
if [ "$1" = "" ]
then
echo "Usage: $0 machine [decoder]..."
exit 1
fi
DEV=$(find /sys/bus/platform/devices/ -name "*.video-codec")
if [ ! -e "$DEV" ]
then
echo "$0: can't find videoc-codec device"
exit 2
fi
if [ ! -e "$DEV/driver" ]
then
echo "$0: can't detect video driver, check that the device is bound"
exit 2
fi
DRV=$(basename $(readlink "$DEV/driver") | sed -e 's/qcom-//')
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
elif [ -r $(dirname $0)/fluster/fluster.py ]
then
echo "Generating $SUMMARY using fluster from the current location"
FLUSTER=$(dirname $0)/fluster/fluster.py
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
if [ "$(which v4l2-ctl)" = "" ]
then
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
fi
DECODERS=""
for codec in ${CODECS}
do
DECODERS="${DECODERS} FFmpeg-${codec}-v4l2m2m GStreamer-${codec}-V4L2"
done
if [ "$1" = "+" ]
then
shift
DECODERS="${DECODERS} $@"
elif [ -n "$1" ]
then
DECODERS="$@"
fi
set -x
exec ${FLUSTER} r -j 1 -s -so "$(dirname $0)/${SUMMARY}" ${SKIPS} -d ${DECODERS}