From 0ae98257528ba40e34a0a88c812d0f3e26950133 Mon Sep 17 00:00:00 2001 From: Reed Wade Date: Mon, 2 Nov 2020 21:44:34 +0100 Subject: [PATCH] Replace the camera script with the Megapixel app Signed-off-by: Reed Wade Signed-off-by: Anjandev Momi --- scripts/core/sxmo_appmenu.sh | 22 +++++----- scripts/core/sxmo_camera.sh | 80 ------------------------------------ 2 files changed, 11 insertions(+), 91 deletions(-) delete mode 100755 scripts/core/sxmo_camera.sh diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index 9b0d13d..6dd9fbe 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -361,17 +361,17 @@ programchoicesinit() { else # Default system menu (no matches) CHOICES=" - Scripts ^ 0 ^ sxmo_appmenu.sh scripts - Apps ^ 0 ^ sxmo_appmenu.sh applications - Files ^ 0 ^ sxmo_files.sh - $(command -v foxtrotgps >/dev/null && echo 'Maps ^ 0 ^ foxtrotgps') - Dialer ^ 0 ^ sxmo_modemdial.sh - Texts ^ 0 ^ sxmo_modemtext.sh - Camera ^ 0 ^ sxmo_camera.sh - Networks ^ 0 ^ sxmo_networks.sh - Audio ^ 0 ^ sxmo_appmenu.sh audioout - Config ^ 0 ^ sxmo_appmenu.sh config - Power ^ 0 ^ sxmo_appmenu.sh power + Scripts ^ 0 ^ sxmo_appmenu.sh scripts + Apps ^ 0 ^ sxmo_appmenu.sh applications + Files ^ 0 ^ sxmo_files.sh + $(command -v foxtrotgps >/dev/null && echo 'Maps ^ 0 ^ foxtrotgps') + Dialer ^ 0 ^ sxmo_modemdial.sh + Texts ^ 0 ^ sxmo_modemtext.sh + $(command -v megapixels >/dev/null && echo 'Camera ^ 0 ^ megapixels') + Networks ^ 0 ^ sxmo_networks.sh + Audio ^ 0 ^ sxmo_appmenu.sh audioout + Config ^ 0 ^ sxmo_appmenu.sh config + Power ^ 0 ^ sxmo_appmenu.sh power " WINNAME=Sys fi diff --git a/scripts/core/sxmo_camera.sh b/scripts/core/sxmo_camera.sh deleted file mode 100755 index 984a40e..0000000 --- a/scripts/core/sxmo_camera.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env sh -REAR_NODE="ov5640 4-004c" -REAR_LINK='"gc2145 4-003c":0->"sun6i-csi":0' -REAR_MODE="1920x1080@20" -FRONT_NODE="gc2145 4-003c" -FRONT_LINK='"ov5640 4-004c":0->"sun6i-csi":0' -FRONT_MODE="1600x1200@15" -FMTPIX='UYVY' -FMTBUS='UYVY8_2X8' - -err() { - printf %b "$1" | dmenu -fn Terminus-20 -c -l 10 - exit 1 -} -setupmediactllinks() { - media-ctl -d /dev/media1 --links "$1" - media-ctl -d /dev/media1 --links "$2" -} -setupv4l2() { - MODE="$1" - NODE="$2" - RES="${MODE%%@*}" - SPEED="${MODE##*@}" - HEIGHT="${RES%%x*}" - WIDTH="${RES##*x}" - eval "media-ctl -d /dev/media1 --set-v4l2 '\"$NODE\":0[fmt:$FMTBUS/$RES@1/$SPEED]'" - v4l2-ctl --device /dev/video1 --set-fmt-video="width=$WIDTH,height=$HEIGHT,pixelformat=$FMTPIX" || - err "Couldnt set up camera\n Is killswitch in right position?" -} -startmpv() { - MODE="$1" - TRANSPOSE="$2" - RES="${MODE%%@*}" - SPEED="${MODE##*@}" - HEIGHT="${RES##*x}" - WIDTH="${RES%%x*}" - - # FFMpeg here is just converting V4L2 into rawvideo data to pipe to mpv which - # has better compatabilty with mpv's rawvideo demuxer (then v4l2 data). There - # (may) be a way to directly invoke the rawvideo demuxer with a v4l2 device - # in mpv; but this is simpler and more reliable for now. - ffmpeg -re -fflags nobuffer -f v4l2 -video_size "$RES" -i /dev/video1 -f rawvideo - | - mpv \ - --cache-secs=0 --demuxer-readahead-secs=0 \ - --demuxer-rawvideo-w="$WIDTH" --demuxer-rawvideo-h="$HEIGHT" \ - --untimed --vo=xv --cache-pause=no --no-demuxer-thread \ - --profile=low-latency --demuxer=rawvideo -vf transpose="$TRANSPOSE" \ - - -} - -camerarear() { - setupmediactllinks "${REAR_LINK}[0]" "${FRONT_LINK}[1]" - setupv4l2 "$REAR_MODE" "$REAR_NODE" - startmpv "$REAR_MODE" 1 -} -camerafront() { - setupmediactllinks "${FRONT_LINK}[0]" "${REAR_LINK}[1]" - setupv4l2 "$FRONT_MODE" "$FRONT_NODE" - startmpv "$FRONT_MODE" 3 -} - -cameramenu() { - CHOICE="$( - printf %b "Rear Camera\nFront Camera\nClose Menu" | - dmenu -fn Terminus-30 -c -p "Camera" -l 20 - )" - if [ "$CHOICE" = "Close Menu" ]; then - exit 0 - elif [ "$CHOICE" = "Rear Camera" ]; then - st -e "$0" camerarear - elif [ "$CHOICE" = "Front Camera" ]; then - st -e "$0" camerafront - fi -} - -if [ $# -gt 0 ]; then - "$@" -else - cameramenu -fi