#!/bin/bash

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

WIDTH=3840
HEIGHT=2160
FPS=30
PIPE=pipe$1

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

# 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'  ! rxvideogate pipename=$PIPE opmode=1 !  rxcudaupload drop-corrupted=true ! rxcudadebayer ! rxcudasink







