summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/test-pattern
diff options
context:
space:
mode:
authorGreg Frost <gregfrost1@bigpond.com>2010-04-18 05:17:18 (GMT)
committerGreg Frost <gregfrost1@bigpond.com>2010-04-18 05:17:18 (GMT)
commit5106977528d3d26919263bf62d504035a7720633 (patch)
tree81c3135c3b67a13426b41f4b4d0df0781ff0bcda /abs/core-testing/test-pattern
parentd6ad69f1880aa27c88fb8991cd06e749afefe1f1 (diff)
downloadlinhes_pkgbuild-5106977528d3d26919263bf62d504035a7720633.zip
linhes_pkgbuild-5106977528d3d26919263bf62d504035a7720633.tar.gz
linhes_pkgbuild-5106977528d3d26919263bf62d504035a7720633.tar.bz2
test-pattern: added command line argument control
Diffstat (limited to 'abs/core-testing/test-pattern')
-rw-r--r--abs/core-testing/test-pattern/PKGBUILD6
-rwxr-xr-xabs/core-testing/test-pattern/test_pattern.bash65
2 files changed, 57 insertions, 14 deletions
diff --git a/abs/core-testing/test-pattern/PKGBUILD b/abs/core-testing/test-pattern/PKGBUILD
index f79ae6a..3604a6f 100644
--- a/abs/core-testing/test-pattern/PKGBUILD
+++ b/abs/core-testing/test-pattern/PKGBUILD
@@ -1,10 +1,10 @@
pkgname=test-pattern
pkgver=1.0
-pkgrel=1
+pkgrel=3
arch=('i686')
pkgdesc="script to create test pattern videos"
depends=(imagemagick)
-
+license=('GPL')
source=(test_pattern.bash)
build() {
@@ -13,4 +13,4 @@ build() {
install -m755 -D test_pattern.bash $startdir/pkg/usr/bin/test_pattern.bash
}
-md5sums=('a6b424b0ebc07574fa5716eced807127')
+md5sums=('67359cc8826c99ac09e8a1d0d87fc381')
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