#!/bin/sh 
# wrapper for qvplay(1) to get a specific picture from a QV-10
# assumes that qvplay is configured correctly and that 'mid' spped is OK

SPEED=mid
PORT=/dev/cua0
VERBOSE=-v
FORMAT=jpeg
WIDTH=320
HEIGHT=240

prog=`basename $0`

usage() {
	echo "Usage: $prog num" >&2
	echo "Reads num'th picture from the Casio QV-10 digital camera to stdout" >&2
	exit 1;
}

#Check at least one parameter
if [ "X$1" = "X" ]
then
	usage
fi

qvplay -S $SPEED -D $PORT -F $FORMAT $VERBOSE -g $1 | djpeg | pnmscale -xsize $WIDTH -ysize $HEIGHT | cjpeg
qvplay -r

