Skip to content

Commit 2630512

Browse files
committed
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.
1 parent b0b0240 commit 2630512

File tree

3 files changed

+4
-24
lines changed

3 files changed

+4
-24
lines changed

app/meson.build

-10
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,6 @@ conf.set('PORTABLE', get_option('portable'))
114114
conf.set('DEFAULT_LOCAL_PORT_RANGE_FIRST', '27183')
115115
conf.set('DEFAULT_LOCAL_PORT_RANGE_LAST', '27199')
116116

117-
# the default max video size for both dimensions, in pixels
118-
# overridden by option --max-size
119-
conf.set('DEFAULT_MAX_SIZE', '0') # 0: unlimited
120-
121-
# the default video orientation
122-
# natural device orientation is 0 and each increment adds 90 degrees
123-
# counterclockwise
124-
# overridden by option --lock-video-orientation
125-
conf.set('DEFAULT_LOCK_VIDEO_ORIENTATION', '-1') # -1: unlocked
126-
127117
# the default video bitrate, in bits/second
128118
# overridden by option --bit-rate
129119
conf.set('DEFAULT_BIT_RATE', '8000000') # 8Mbps

app/src/cli.c

+2-12
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,7 @@ scrcpy_print_usage(const char *arg0) {
8484
" Possible values are -1 (unlocked), 0, 1, 2 and 3.\n"
8585
" Natural device orientation is 0, and each increment adds a\n"
8686
" 90 degrees rotation counterclockwise.\n"
87-
#if DEFAULT_LOCK_VIDEO_ORIENTATION == -1
88-
# define DEFAULT_LOCK_VIDEO_ORIENTATION_STR "-1 (unlocked)"
89-
#else
90-
# define DEFAULT_LOCK_VIDEO_ORIENTATION_STR STR(DEFAULT_LOCK_VIDEO_ORIENTATION)
91-
#endif
92-
" Default is " DEFAULT_LOCK_VIDEO_ORIENTATION_STR ".\n"
87+
" Default is -1 (unlocked).\n"
9388
"\n"
9489
" --max-fps value\n"
9590
" Limit the frame rate of screen capture (officially supported\n"
@@ -99,12 +94,7 @@ scrcpy_print_usage(const char *arg0) {
9994
" Limit both the width and height of the video to value. The\n"
10095
" other dimension is computed so that the device aspect-ratio\n"
10196
" is preserved.\n"
102-
#if DEFAULT_MAX_SIZE == 0
103-
# define DEFAULT_MAX_SIZE_STR "0 (unlimited)"
104-
#else
105-
# define DEFAULT_MAX_SIZE_STR STR(DEFAULT_MAX_SIZE)
106-
#endif
107-
" Default is " DEFAULT_MAX_SIZE_STR ".\n"
97+
" Default is 0 (unlimited).\n"
10898
"\n"
10999
" -n, --no-control\n"
110100
" Disable device control (mirror the device in read-only).\n"

app/src/scrcpy.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ struct scrcpy_options {
103103
.data = {SC_MOD_LALT, SC_MOD_LSUPER}, \
104104
.count = 2, \
105105
}, \
106-
.max_size = DEFAULT_MAX_SIZE, \
106+
.max_size = 0, \
107107
.bit_rate = DEFAULT_BIT_RATE, \
108108
.max_fps = 0, \
109-
.lock_video_orientation = DEFAULT_LOCK_VIDEO_ORIENTATION, \
109+
.lock_video_orientation = -1, \
110110
.rotation = 0, \
111111
.window_x = SC_WINDOW_POSITION_UNDEFINED, \
112112
.window_y = SC_WINDOW_POSITION_UNDEFINED, \

0 commit comments

Comments
 (0)