From 616afb05e5fb7c9785969a3648f15e55307831f5 Mon Sep 17 00:00:00 2001 From: nik0 <1867654+nik0@users.noreply.github.com> Date: Sat, 14 Jul 2018 09:47:27 +0200 Subject: [PATCH] Make image flip persist on reboot (#569) * Basic keep image flip at reboot settings page could be improved * Basic keep image flip at reboot settings page could be improved --- firmware_mod/config/rtspserver.conf.dist | 2 ++ firmware_mod/controlscripts/rtsp-h264 | 7 +++++++ firmware_mod/controlscripts/rtsp-mjpeg | 7 +++++++ firmware_mod/www/cgi-bin/action.cgi | 2 ++ 4 files changed, 18 insertions(+) diff --git a/firmware_mod/config/rtspserver.conf.dist b/firmware_mod/config/rtspserver.conf.dist index 2947a3f..4a47e2f 100644 --- a/firmware_mod/config/rtspserver.conf.dist +++ b/firmware_mod/config/rtspserver.conf.dist @@ -27,6 +27,8 @@ BITRATE=5000 # Framerate FRAMERATE_DEN=1 FRAMERATE_NUM=25 +# Video format: (0 = FixedQp, 1 = CBR, 2 = VBR, 3 = SMART, default = 2) +VIDEOFORMAT=2 # AudioFormat # Can be: OPUS | MP3 | PCM | PCMU diff --git a/firmware_mod/controlscripts/rtsp-h264 b/firmware_mod/controlscripts/rtsp-h264 index 0e55fba..d9bf12a 100644 --- a/firmware_mod/controlscripts/rtsp-h264 +++ b/firmware_mod/controlscripts/rtsp-h264 @@ -77,6 +77,13 @@ start() PORT="-P $PORT" fi + ## FLIP + if [ "$FLIP" == "ON" ]; then + /system/sdcard/bin/setconf -k f -v 1 + elif [ "$FLIP" == "OFF" ]; then + /system/sdcard/bin/setconf -k f -v 0 + fi + echo "================== START ===============" >> "$LOGPATH" echo "/system/sdcard/bin/v4l2rtspserver-master $RTSPH264OPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT" >> "$LOGPATH" /system/sdcard/bin/v4l2rtspserver-master $RTSPH264OPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT 2>> "$LOGPATH" >> "$LOGPATH" & diff --git a/firmware_mod/controlscripts/rtsp-mjpeg b/firmware_mod/controlscripts/rtsp-mjpeg index 118a76e..bea3a29 100644 --- a/firmware_mod/controlscripts/rtsp-mjpeg +++ b/firmware_mod/controlscripts/rtsp-mjpeg @@ -77,6 +77,13 @@ start() PORT="-P $PORT" fi + ## FLIP + if [ "$FLIP" == "ON" ]; then + /system/sdcard/bin/setconf -k f -v 1 + elif [ "$FLIP" == "OFF" ]; then + /system/sdcard/bin/setconf -k f -v 0 + fi + echo "================== START ===============" >> "$LOGPATH" echo "/system/sdcard/bin/v4l2rtspserver-master -fMJPG $RTSPMJPEGOPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT" >> "$LOGPATH" /system/sdcard/bin/v4l2rtspserver-master -fMJPG $RTSPMJPEGOPTS $AUDIOPARAM $VIDEOFORMAT $CREDENTIAL $PORT 2>> "$LOGPATH" >> "$LOGPATH" & diff --git a/firmware_mod/www/cgi-bin/action.cgi b/firmware_mod/www/cgi-bin/action.cgi index c1b5a64..ea359d5 100755 --- a/firmware_mod/www/cgi-bin/action.cgi +++ b/firmware_mod/www/cgi-bin/action.cgi @@ -340,10 +340,12 @@ if [ -n "$F_cmd" ]; then ;; flip-on) + rewrite_config /system/sdcard/config/rtspserver.conf FLIP "ON" /system/sdcard/bin/setconf -k f -v 1 ;; flip-off) + rewrite_config /system/sdcard/config/rtspserver.conf FLIP "OFF" /system/sdcard/bin/setconf -k f -v 0 ;;