Pass --lock-video-orientation argument in degrees
For consistency with the new --display-orientation option, express the --lock-video-orientation in degrees clockwise: * --lock-video-orientation=0 -> --lock-video-orientation=0 * --lock-video-orientation=3 -> --lock-video-orientation=90 * --lock-video-orientation=2 -> --lock-video-orientation=180 * --lock-video-orientation=1 -> --lock-video-orientation=270 PR #4441 <https://github.com/Genymobile/scrcpy/pull/4441>
This commit is contained in:
parent
bb88b60227
commit
2f92686930
@ -118,7 +118,7 @@ _scrcpy() {
|
|||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--lock-video-orientation)
|
--lock-video-orientation)
|
||||||
COMPREPLY=($(compgen -W 'unlocked initial 0 1 2 3' -- "$cur"))
|
COMPREPLY=($(compgen -W 'unlocked initial 0 90 180 270' -- "$cur"))
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--pause-on-exit)
|
--pause-on-exit)
|
||||||
|
@ -41,7 +41,7 @@ arguments=(
|
|||||||
'--list-cameras[List cameras available on the device]'
|
'--list-cameras[List cameras available on the device]'
|
||||||
'--list-displays[List displays available on the device]'
|
'--list-displays[List displays available on the device]'
|
||||||
'--list-encoders[List video and audio encoders available on the device]'
|
'--list-encoders[List video and audio encoders available on the device]'
|
||||||
'--lock-video-orientation=[Lock video orientation]:orientation:(unlocked initial 0 1 2 3)'
|
'--lock-video-orientation=[Lock video orientation]:orientation:(unlocked initial 0 90 180 270)'
|
||||||
{-m,--max-size=}'[Limit both the width and height of the video to value]'
|
{-m,--max-size=}'[Limit both the width and height of the video to value]'
|
||||||
{-M,--hid-mouse}'[Simulate a physical mouse by using HID over AOAv2]'
|
{-M,--hid-mouse}'[Simulate a physical mouse by using HID over AOAv2]'
|
||||||
'--max-fps=[Limit the frame rate of screen capture]'
|
'--max-fps=[Limit the frame rate of screen capture]'
|
||||||
|
@ -215,7 +215,9 @@ List displays available on the device.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-lock\-video\-orientation\fR[=\fIvalue\fR]
|
\fB\-\-lock\-video\-orientation\fR[=\fIvalue\fR]
|
||||||
Lock video orientation to \fIvalue\fR. Possible values are "unlocked", "initial" (locked to the initial orientation), 0, 1, 2 and 3. Natural device orientation is 0, and each increment adds a 90 degrees rotation counterclockwise.
|
Lock capture video orientation to \fIvalue\fR.
|
||||||
|
|
||||||
|
Possible values are "unlocked", "initial" (locked to the initial orientation), 0, 90, 180, and 270. The values represent the clockwise rotation from the natural device orientation, in degrees.
|
||||||
|
|
||||||
Default is "unlocked".
|
Default is "unlocked".
|
||||||
|
|
||||||
|
@ -411,11 +411,11 @@ static const struct sc_option options[] = {
|
|||||||
.longopt = "lock-video-orientation",
|
.longopt = "lock-video-orientation",
|
||||||
.argdesc = "value",
|
.argdesc = "value",
|
||||||
.optional_arg = true,
|
.optional_arg = true,
|
||||||
.text = "Lock video orientation to value.\n"
|
.text = "Lock capture video orientation to value.\n"
|
||||||
"Possible values are \"unlocked\", \"initial\" (locked to the "
|
"Possible values are \"unlocked\", \"initial\" (locked to the "
|
||||||
"initial orientation), 0, 1, 2 and 3. Natural device "
|
"initial orientation), 0, 90, 180 and 270. The values "
|
||||||
"orientation is 0, and each increment adds a 90 degrees "
|
"represent the clockwise rotation from the natural device "
|
||||||
"rotation counterclockwise.\n"
|
"orientation, in degrees.\n"
|
||||||
"Default is \"unlocked\".\n"
|
"Default is \"unlocked\".\n"
|
||||||
"Passing the option without argument is equivalent to passing "
|
"Passing the option without argument is equivalent to passing "
|
||||||
"\"initial\".",
|
"\"initial\".",
|
||||||
@ -1400,15 +1400,50 @@ parse_lock_video_orientation(const char *s,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
long value;
|
if (!strcmp(s, "0")) {
|
||||||
bool ok = parse_integer_arg(s, &value, false, 0, 3,
|
*lock_mode = SC_LOCK_VIDEO_ORIENTATION_0;
|
||||||
"lock video orientation");
|
return true;
|
||||||
if (!ok) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*lock_mode = (enum sc_lock_video_orientation) value;
|
if (!strcmp(s, "90")) {
|
||||||
return true;
|
*lock_mode = SC_LOCK_VIDEO_ORIENTATION_90;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(s, "180")) {
|
||||||
|
*lock_mode = SC_LOCK_VIDEO_ORIENTATION_180;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(s, "270")) {
|
||||||
|
*lock_mode = SC_LOCK_VIDEO_ORIENTATION_270;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(s, "1")) {
|
||||||
|
LOGW("--lock-video-orientation=1 is deprecated, use "
|
||||||
|
"--lock-video-orientation=270 instead.");
|
||||||
|
*lock_mode = SC_LOCK_VIDEO_ORIENTATION_270;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(s, "2")) {
|
||||||
|
LOGW("--lock-video-orientation=2 is deprecated, use "
|
||||||
|
"--lock-video-orientation=180 instead.");
|
||||||
|
*lock_mode = SC_LOCK_VIDEO_ORIENTATION_180;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(s, "3")) {
|
||||||
|
LOGW("--lock-video-orientation=3 is deprecated, use "
|
||||||
|
"--lock-video-orientation=90 instead.");
|
||||||
|
*lock_mode = SC_LOCK_VIDEO_ORIENTATION_90;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGE("Unsupported --lock-video-orientation value: %s (expected initial, "
|
||||||
|
"unlocked, 0, 90, 180 or 270).", s);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -134,9 +134,9 @@ enum sc_lock_video_orientation {
|
|||||||
// lock the current orientation when scrcpy starts
|
// lock the current orientation when scrcpy starts
|
||||||
SC_LOCK_VIDEO_ORIENTATION_INITIAL = -2,
|
SC_LOCK_VIDEO_ORIENTATION_INITIAL = -2,
|
||||||
SC_LOCK_VIDEO_ORIENTATION_0 = 0,
|
SC_LOCK_VIDEO_ORIENTATION_0 = 0,
|
||||||
SC_LOCK_VIDEO_ORIENTATION_1,
|
SC_LOCK_VIDEO_ORIENTATION_90 = 3,
|
||||||
SC_LOCK_VIDEO_ORIENTATION_2,
|
SC_LOCK_VIDEO_ORIENTATION_180 = 2,
|
||||||
SC_LOCK_VIDEO_ORIENTATION_3,
|
SC_LOCK_VIDEO_ORIENTATION_270 = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sc_keyboard_input_mode {
|
enum sc_keyboard_input_mode {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user