summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/test-pattern/test_pattern.bash
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core-testing/test-pattern/test_pattern.bash')
-rwxr-xr-xabs/core-testing/test-pattern/test_pattern.bash65
1 files changed, 54 insertions, 11 deletions
diff --git a/abs/core-testing/test-pattern/test_pattern.bash b/abs/core-testing/test-pattern/test_pattern.bash
index 9cf3228..c2af38e 100755
--- a/abs/core-testing/test-pattern/test_pattern.bash
+++ b/abs/core-testing/test-pattern/test_pattern.bash
@@ -1,13 +1,46 @@
#!/bin/bash
-w=1280
-h=1024
+# Set default options to be overriden by command line arguments.
-w=1920
-h=1080
+w=400
+h=325
+rate=50
+TEMPDIR=
+unset remove_tempdir
-w=640
-h=480
+while getopts ":w:h:t:r:" opt; do
+ case $opt in
+ w)
+ w=$OPTARG
+ ;;
+ h)
+ h=$OPTARG
+ ;;
+ t)
+ TEMPDIR=$OPTARG
+ ;;
+ r)
+ rate=$OPTARG
+ ;;
+ \?)
+ echo -n"\
+Error: Invalid option -$OPTARG
+
+Usage:
+ test_pattern.bash [options]
+ -w width
+ The width in pixels.
+ -h height
+ The height in pixels.
+ -t tempdir
+ Temporary directory for intermediate files. If no directory is specified, one is created and deleted at the end of processing.
+ -r framerate
+"
+ exit 1
+ esac
+done
+
+# Calculate some dimensions based on the requested size.
barw=$((w/32))
barstep=$((w/90))
@@ -29,12 +62,18 @@ echo nhgrid=$nhgrid
echo gridstartx=$gridstartx
echo gridstarty=$gridstarty
-TEMPDIR=./tmp
-if [ ! -d "$TEMPDIR" ] ; then
- mkdir $TEMPDIR
+echo parsed tempdir $TEMPDIR
+
+if [ -z "$TEMPDIR" ] ; then
+ TEMPDIR=$(mktemp -d --tmpdir=/tmp)
+ remove_tempdir=1
+else
+ if [ ! -d "$TEMPDIR" ] ; then
+ mkdir $TEMPDIR
+ fi
fi
-#TEMPDIR=$(mktemp -d --tmpdir=/tmp)
+echo parsed tempdir $TEMPDIR $remove_tempdir
unset checker
checker=( -fill "rgb(192,192,192)" )
@@ -217,4 +256,8 @@ for ((i=0; i < $frames; i++)) ; do
${image_name}
done
-ffmpeg -i ${TEMPDIR}/test%03d.jpg -y test.mpg
+ffmpeg -r ${rate} -i ${TEMPDIR}/test%03d.jpg -r ${rate} -y test.mpg
+
+if [ -n "$remove_tempdir" ] ; then
+ rm -Rf $TEMPDIR
+fi