#!/bin/bash

if [ $# -ne 1 ]; then
    echo $0: usage: autovideo [0-5] to open /dev/videoX
    exit 1
fi
dev=$(echo /dev/video$1)

WIDTH=3840
HEIGHT=2160
FPS=30

v4l2-ctl -d $dev -c delayed_start=0
v4l2-ctl -d $dev -c singleshot_mode=0

# Inspect the plugin. This will update the gst-registry recognize the elements in the plugin.
/home/ubuntu/gst_1.9.1/out/bin/gst-inspect-1.0  ./librxproc_plugin.0.5.arm64.so 

/home/ubuntu/gst_1.9.1/out/bin/gst-launch-1.0 --gst-disable-registry-fork --gst-plugin-path=. v4l2src device=$dev io-mode=GST_V4L2_IO_USERPTR ! 'video/x-bayer,width='$WIDTH',height='$HEIGHT',framerate='$FPS'/1,format=rggb' ! rxautoadapt device=$dev target=0.4 roix1=0.25 roix2=0.75 roiy1=0.25 roiy2=0.75 ! rxcudaupload  ! rxcudadebayer ! rxcudasink
