Skip to content

Commit

Permalink
Add live view for video test
Browse files Browse the repository at this point in the history
  • Loading branch information
RadxaYuntian committed Oct 11, 2023
1 parent df7c636 commit 8ae94ff
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/usr/lib/rsetup/tui/hardware/hardware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# shellcheck source=src/usr/lib/rsetup/mod/config.sh
source "/usr/lib/rsetup/mod/config.sh"

__hardware_gstreamer_test() {
__hardware_gstreamer_test_picture() {
local temp
temp="$(mktemp tmp.XXXXXXXXXX.jpg)"

if gst-launch-1.0 v4l2src "device=/dev/$RSETUP_MENU_SELECTED" io-mode=4 ! \
videoconvert ! \
autovideoconvert ! \
video/x-raw,format=UYVY,width=1920,height=1080 ! \
jpegenc ! \
multifilesink "location=$temp"
Expand All @@ -21,6 +21,25 @@ Please check if you have the required libraries installed."
fi
}

__hardware_gstreamer_test_live() {
gst-launch-1.0 v4l2src "device=/dev/$RSETUP_MENU_SELECTED" io-mode=4 ! \
autovideoconvert ! \
video/x-raw,format=UYVY,width=1920,height=1080,framerate=30/1 ! \
xvimagesink
}

__hardware_gstreamer_test() {

menu_init
if [[ -n "${DISPLAY:-}" ]]
then
menu_add __hardware_gstreamer_test_live "Show live video"
fi
menu_add __hardware_gstreamer_test_picture "Capture a picture"
menu_show "Please select the test case:"
__hardware_gstreamer_test_picture
}

__hardware_video() {
menu_init
for i in /dev/video*
Expand All @@ -30,7 +49,7 @@ __hardware_video() {
menu_emptymsg "No supported devices is detected.
Please make sure they are enabled first."
menu_show "Take a test image with the selected video capture device:"
menu_show "Select video capture device:"
}

__hardware_gpio_leds() {
Expand Down

0 comments on commit 8ae94ff

Please sign in to comment.