From ed20ef64dfb2058130ea1006fbf6915252b6e29b Mon Sep 17 00:00:00 2001 From: Nickolas Andersen Date: Mon, 13 Nov 2023 21:10:05 -0500 Subject: [PATCH] Update reStream.sh Can now detect if the Remarkable version is older than 2023-10-02. Versions ahead of this date use a different format for the video settings. --- reStream.sh | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/reStream.sh b/reStream.sh index 6da63f4..ed9ce8b 100755 --- a/reStream.sh +++ b/reStream.sh @@ -3,17 +3,24 @@ # Current reStream.sh version version="1.2.0" +# video_filters links: +# https://ffmpeg.org/doxygen/trunk/pixfmt_8h_source.html +# https://ffmpeg.org/ffmpeg-filters.html#eq + +# This date is used to determine video_filters. (1696246154 == 2023-10-02 11:29:14.927044663 +0000) +rm2_old_xochitl_date=1696246154 + # default values for arguments -remarkable="${REMARKABLE_IP:-10.11.99.1}" # remarkable IP address -landscape=true # rotate 90 degrees to the right -output_path=- # display output through ffplay -format=- # automatic output format -webcam=false # not to a webcam -hflip=false # horizontal flip webcam -measure_throughput=false # measure how fast data is being transferred -window_title=reStream # stream window title is reStream -video_filters="" # list of ffmpeg filters to apply -unsecure_connection=false # Establish a unsecure connection that is faster +remarkable="10.11.99.1" # remarkable connected through USB +landscape=false # rotate 90 degrees to the right +output_path=- # display output through ffplay +format=- # automatic output format +webcam=false # not to a webcam +hflip=false # horizontal flip webcam +measure_throughput=false # measure how fast data is being transferred +window_title=reStream # stream window title is reStream +video_filters="" # list of ffmpeg filters to apply +unsecure_connection=true # Establish a unsecure connection that is faster # loop through arguments and process them while [ $# -gt 0 ]; do @@ -143,12 +150,24 @@ case "$rm_version" in fb_file="/dev/shm/swtfb.01" pixel_format="rgb565le" else + # Get the Remarkable software version before proceeding (File date of xochitl.) width=1872 height=1404 - bytes_per_pixel=1 fb_file=":mem:" - pixel_format="gray8" - video_filters="$video_filters,transpose=2" + + # Use updated video settings? + if [ $(ssh_cmd 'stat -c "%Y" /usr/bin/xochitl') -ge $rm2_old_xochitl_date ]; then + echo "Using the newer :mem: video settings." + bytes_per_pixel=2 + pixel_format="gray16be" + video_filters="$video_filters eq=gamma=0.125:brightness=0.825,transpose=3" + # Use the previous video settings. + else + echo "Using the older :mem: video settings." + bytes_per_pixel=1 + pixel_format="gray8" + video_filters="$video_filters,transpose=2" + fi fi ;; *)