#!/bin/bash

systemctl stop weston

gst-launch-1.0 \
v4l2src device=/dev/video-ov5640-cam0 ! queue max-size-buffers=1 leaky=2 ! video/x-raw, width=$1,height=$2, format=YUY2 ! ticolorconvert ! queue ! mosaic.sink_0 \
v4l2src device=/dev/video-ov5640-cam1 ! queue max-size-buffers=1 leaky=2 ! video/x-raw, width=$1,height=$2, format=YUY2 ! ticolorconvert ! queue ! mosaic.sink_1 \
v4l2src device=/dev/video-ov5640-cam2 ! queue max-size-buffers=1 leaky=2 ! video/x-raw, width=$1,height=$2, format=YUY2 ! ticolorconvert ! queue ! mosaic.sink_2 \
v4l2src device=/dev/video-ov5640-cam3 ! queue max-size-buffers=1 leaky=2 ! video/x-raw, width=$1,height=$2, format=YUY2 ! ticolorconvert ! queue ! mosaic.sink_3 \
timosaic name=mosaic \
sink_0::startx=300 sink_0::starty=0 sink_0::width=640 sink_0::height=480 \
sink_1::startx=980 sink_1::starty=0 sink_1::width=640 sink_1::height=480  \
sink_2::startx=300 sink_2::starty=500 sink_2::width=640 sink_2::height=480 \
sink_3::startx=980 sink_3::starty=500 sink_3::width=640 sink_3::height=480 ! \
video/x-raw, width=1920, height=1080, format=NV12 ! queue ! kmssink driver-name=tidss sync=false force-modesetting=true
