diff options
author | Greg Frost <gregfrost1@bigpond.com> | 2010-04-18 05:17:18 (GMT) |
---|---|---|
committer | Greg Frost <gregfrost1@bigpond.com> | 2010-04-18 05:17:18 (GMT) |
commit | 5106977528d3d26919263bf62d504035a7720633 (patch) | |
tree | 81c3135c3b67a13426b41f4b4d0df0781ff0bcda /abs/core-testing/test-pattern/test_pattern.bash | |
parent | d6ad69f1880aa27c88fb8991cd06e749afefe1f1 (diff) | |
download | linhes_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/test_pattern.bash')
-rwxr-xr-x | abs/core-testing/test-pattern/test_pattern.bash | 65 |
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 |