Replace the camera script with the Megapixel app

Signed-off-by: Reed Wade <reedwade@misterbanal.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
master
Reed Wade 4 years ago committed by Anjandev Momi
parent cbeaecbef5
commit 0ae9825752
  1. 2
      scripts/core/sxmo_appmenu.sh
  2. 80
      scripts/core/sxmo_camera.sh

@ -367,7 +367,7 @@ programchoicesinit() {
$(command -v foxtrotgps >/dev/null && echo 'Maps ^ 0 ^ foxtrotgps') $(command -v foxtrotgps >/dev/null && echo 'Maps ^ 0 ^ foxtrotgps')
Dialer ^ 0 ^ sxmo_modemdial.sh Dialer ^ 0 ^ sxmo_modemdial.sh
Texts ^ 0 ^ sxmo_modemtext.sh Texts ^ 0 ^ sxmo_modemtext.sh
Camera ^ 0 ^ sxmo_camera.sh $(command -v megapixels >/dev/null && echo 'Camera ^ 0 ^ megapixels')
Networks ^ 0 ^ sxmo_networks.sh Networks ^ 0 ^ sxmo_networks.sh
Audio ^ 0 ^ sxmo_appmenu.sh audioout Audio ^ 0 ^ sxmo_appmenu.sh audioout
Config ^ 0 ^ sxmo_appmenu.sh config Config ^ 0 ^ sxmo_appmenu.sh config

@ -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
Loading…
Cancel
Save