#!/bin/csh -f
#
# set the  $ACCOM device name to your device name...
#
# Note: we flip the image with fflip...
#
# for NTSC: default resolution is 720 x 486
# for PAL:  default resolution is 704 x 576
#           (set the ABEKAS_PAL environment variable to allow PAL 
#	     resolution.  For PAL resolution 720 x 576 or other
#            set the environment variables ABEKAS_PAL_XRES and
#            ABEKAS_PAL_YRES)
#

onintr cleanup

set ACCOM = accom
if ( $?TEMP ) then
	set TMP = $TEMP/$$.yuv
else
	set TMP = /usr/tmp/$$.yuv
endif

if ( $?ABEKAS_PAL ) then
	if ( $?ABEKAS_PAL_XRES ) then
	set HRES = $ABEKAS_PAL_XRES
	else
		set HRES = 704   # PAL Default
	endif
	if ( $?ABEKAS_PAL_XRES ) then
		set VRES = $ABEKAS_PAL_YRES
	else
		set VRES = 576   # PAL Default
	endif

else
	set HRES = 720       # NTSC defaults
	set VRES = 486
endif


icomposite -f -w $HRES -h $VRES  stdout = stdin | iflip -Y stdin $TMP

rcp $TMP ${ACCOM}:$1:r

cleanup:
rm -f $TMP 
