From b16b65a715485b3bf2babe51e7c17e3c3a355adf Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 23 Feb 2021 09:37:16 +0100 Subject: [PATCH] Simplify default values It makes sense to extract default values for bitrate and port range (which are arbitrary and might be changed in the future). However, the default values for "max size" and "lock video orientation" are naturally unlimited/unlocked, and will never be changed. Extracting these options just added complexity for no benefit, so hardcode them. --- app/meson.build | 10 ---------- app/src/cli.c | 14 ++------------ app/src/scrcpy.h | 4 ++-- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/app/meson.build b/app/meson.build index 75a2fd71..d230702e 100644 --- a/app/meson.build +++ b/app/meson.build @@ -114,16 +114,6 @@ conf.set('PORTABLE', get_option('portable')) conf.set('DEFAULT_LOCAL_PORT_RANGE_FIRST', '27183') conf.set('DEFAULT_LOCAL_PORT_RANGE_LAST', '27199') -# the default max video size for both dimensions, in pixels -# overridden by option --max-size -conf.set('DEFAULT_MAX_SIZE', '0') # 0: unlimited - -# the default video orientation -# natural device orientation is 0 and each increment adds 90 degrees -# counterclockwise -# overridden by option --lock-video-orientation -conf.set('DEFAULT_LOCK_VIDEO_ORIENTATION', '-1') # -1: unlocked - # the default video bitrate, in bits/second # overridden by option --bit-rate conf.set('DEFAULT_BIT_RATE', '8000000') # 8Mbps diff --git a/app/src/cli.c b/app/src/cli.c index d9cacf15..7f31b32c 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -84,12 +84,7 @@ scrcpy_print_usage(const char *arg0) { " Possible values are -1 (unlocked), 0, 1, 2 and 3.\n" " Natural device orientation is 0, and each increment adds a\n" " 90 degrees rotation counterclockwise.\n" -#if DEFAULT_LOCK_VIDEO_ORIENTATION == -1 -# define DEFAULT_LOCK_VIDEO_ORIENTATION_STR "-1 (unlocked)" -#else -# define DEFAULT_LOCK_VIDEO_ORIENTATION_STR STR(DEFAULT_LOCK_VIDEO_ORIENTATION) -#endif - " Default is " DEFAULT_LOCK_VIDEO_ORIENTATION_STR ".\n" + " Default is -1 (unlocked).\n" "\n" " --max-fps value\n" " Limit the frame rate of screen capture (officially supported\n" @@ -99,12 +94,7 @@ scrcpy_print_usage(const char *arg0) { " Limit both the width and height of the video to value. The\n" " other dimension is computed so that the device aspect-ratio\n" " is preserved.\n" -#if DEFAULT_MAX_SIZE == 0 -# define DEFAULT_MAX_SIZE_STR "0 (unlimited)" -#else -# define DEFAULT_MAX_SIZE_STR STR(DEFAULT_MAX_SIZE) -#endif - " Default is " DEFAULT_MAX_SIZE_STR ".\n" + " Default is 0 (unlimited).\n" "\n" " -n, --no-control\n" " Disable device control (mirror the device in read-only).\n" diff --git a/app/src/scrcpy.h b/app/src/scrcpy.h index 2253cc28..b877a987 100644 --- a/app/src/scrcpy.h +++ b/app/src/scrcpy.h @@ -103,10 +103,10 @@ struct scrcpy_options { .data = {SC_MOD_LALT, SC_MOD_LSUPER}, \ .count = 2, \ }, \ - .max_size = DEFAULT_MAX_SIZE, \ + .max_size = 0, \ .bit_rate = DEFAULT_BIT_RATE, \ .max_fps = 0, \ - .lock_video_orientation = DEFAULT_LOCK_VIDEO_ORIENTATION, \ + .lock_video_orientation = -1, \ .rotation = 0, \ .window_x = SC_WINDOW_POSITION_UNDEFINED, \ .window_y = SC_WINDOW_POSITION_UNDEFINED, \