2021-10-27 18:43:47 +02:00
|
|
|
|
#include "options.h"
|
|
|
|
|
|
|
|
|
|
const struct scrcpy_options scrcpy_options_default = {
|
|
|
|
|
.serial = NULL,
|
|
|
|
|
.crop = NULL,
|
|
|
|
|
.record_filename = NULL,
|
|
|
|
|
.window_title = NULL,
|
|
|
|
|
.push_target = NULL,
|
|
|
|
|
.render_driver = NULL,
|
2023-02-21 21:46:34 +01:00
|
|
|
|
.video_codec_options = NULL,
|
2023-02-22 22:48:23 +01:00
|
|
|
|
.audio_codec_options = NULL,
|
2023-02-22 22:44:01 +01:00
|
|
|
|
.video_encoder = NULL,
|
2023-02-19 20:20:29 +01:00
|
|
|
|
.audio_encoder = NULL,
|
2023-07-16 17:07:19 +08:00
|
|
|
|
.camera_id = NULL,
|
|
|
|
|
.camera_size = NULL,
|
2023-10-26 23:54:34 +02:00
|
|
|
|
.camera_ar = NULL,
|
2023-10-27 20:20:19 -04:00
|
|
|
|
.camera_fps = 0,
|
2021-10-27 18:43:47 +02:00
|
|
|
|
.log_level = SC_LOG_LEVEL_INFO,
|
2023-02-20 21:19:36 +01:00
|
|
|
|
.video_codec = SC_CODEC_H264,
|
2023-02-18 19:05:43 +01:00
|
|
|
|
.audio_codec = SC_CODEC_OPUS,
|
2023-07-16 17:07:19 +08:00
|
|
|
|
.video_source = SC_VIDEO_SOURCE_DISPLAY,
|
2023-10-25 00:09:54 +02:00
|
|
|
|
.audio_source = SC_AUDIO_SOURCE_AUTO,
|
2021-10-27 18:43:47 +02:00
|
|
|
|
.record_format = SC_RECORD_FORMAT_AUTO,
|
2023-11-28 17:17:35 +08:00
|
|
|
|
.keyboard_input_mode = SC_KEYBOARD_INPUT_MODE_AUTO,
|
|
|
|
|
.mouse_input_mode = SC_MOUSE_INPUT_MODE_AUTO,
|
2024-09-06 23:08:08 +02:00
|
|
|
|
.gamepad_input_mode = SC_GAMEPAD_INPUT_MODE_DISABLED,
|
2024-06-24 23:07:08 +02:00
|
|
|
|
.mouse_bindings = {
|
2024-07-09 20:45:49 +02:00
|
|
|
|
.pri = {
|
|
|
|
|
.right_click = SC_MOUSE_BINDING_AUTO,
|
|
|
|
|
.middle_click = SC_MOUSE_BINDING_AUTO,
|
|
|
|
|
.click4 = SC_MOUSE_BINDING_AUTO,
|
|
|
|
|
.click5 = SC_MOUSE_BINDING_AUTO,
|
|
|
|
|
},
|
|
|
|
|
.sec = {
|
|
|
|
|
.right_click = SC_MOUSE_BINDING_AUTO,
|
|
|
|
|
.middle_click = SC_MOUSE_BINDING_AUTO,
|
|
|
|
|
.click4 = SC_MOUSE_BINDING_AUTO,
|
|
|
|
|
.click5 = SC_MOUSE_BINDING_AUTO,
|
|
|
|
|
},
|
2024-06-24 23:07:08 +02:00
|
|
|
|
},
|
2023-07-22 17:17:05 +08:00
|
|
|
|
.camera_facing = SC_CAMERA_FACING_ANY,
|
2021-10-27 18:43:47 +02:00
|
|
|
|
.port_range = {
|
|
|
|
|
.first = DEFAULT_LOCAL_PORT_RANGE_FIRST,
|
|
|
|
|
.last = DEFAULT_LOCAL_PORT_RANGE_LAST,
|
|
|
|
|
},
|
2021-11-18 01:02:53 +01:00
|
|
|
|
.tunnel_host = 0,
|
|
|
|
|
.tunnel_port = 0,
|
2024-03-07 23:07:01 +01:00
|
|
|
|
.shortcut_mods = SC_SHORTCUT_MOD_LALT | SC_SHORTCUT_MOD_LSUPER,
|
2021-10-27 18:43:47 +02:00
|
|
|
|
.max_size = 0,
|
2023-02-21 19:56:44 +01:00
|
|
|
|
.video_bit_rate = 0,
|
2023-02-18 18:32:43 +01:00
|
|
|
|
.audio_bit_rate = 0,
|
2024-09-14 14:32:32 +02:00
|
|
|
|
.max_fps = NULL,
|
Add --capture-orientation
Deprecate --lock-video-orientation in favor of a more general option
--capture-orientation, which supports all possible orientations
(0, 90, 180, 270, flip0, flip90, flip180, flip270), and a "locked" flag
via a '@' prefix.
All the old "locked video orientations" are supported:
- --lock-video-orientation -> --capture-orientation=@
- --lock-video-orientation=0 -> --capture-orientation=@0
- --lock-video-orientation=90 -> --capture-orientation=@90
- --lock-video-orientation=180 -> --capture-orientation=@180
- --lock-video-orientation=270 -> --capture-orientation=@270
In addition, --capture-orientation can rotate/flip the display without
locking, so that it follows the physical device rotation.
For example:
scrcpy --capture-orientation=flip90
always flips and rotates the capture by 90° clockwise.
The arguments are consistent with --display-orientation and
--record-orientation and --orientation (which provide separate
client-side orientation settings).
Refs #4011 <https://github.com/Genymobile/scrcpy/issues/4011>
PR #5455 <https://github.com/Genymobile/scrcpy/pull/5455>
2024-11-14 20:19:40 +01:00
|
|
|
|
.capture_orientation = SC_ORIENTATION_0,
|
|
|
|
|
.capture_orientation_lock = SC_ORIENTATION_UNLOCKED,
|
2023-11-19 01:06:59 +01:00
|
|
|
|
.display_orientation = SC_ORIENTATION_0,
|
2023-11-20 14:02:46 +01:00
|
|
|
|
.record_orientation = SC_ORIENTATION_0,
|
2021-10-27 18:43:47 +02:00
|
|
|
|
.window_x = SC_WINDOW_POSITION_UNDEFINED,
|
|
|
|
|
.window_y = SC_WINDOW_POSITION_UNDEFINED,
|
|
|
|
|
.window_width = 0,
|
|
|
|
|
.window_height = 0,
|
|
|
|
|
.display_id = 0,
|
2024-10-29 19:09:01 +01:00
|
|
|
|
.video_buffer = 0,
|
2023-11-12 18:34:04 +01:00
|
|
|
|
.audio_buffer = -1, // depends on the audio format,
|
2023-03-13 09:23:02 +01:00
|
|
|
|
.audio_output_buffer = SC_TICK_FROM_MS(5),
|
2023-06-01 18:46:50 +02:00
|
|
|
|
.time_limit = 0,
|
2024-11-03 22:46:21 +01:00
|
|
|
|
.screen_off_timeout = -1,
|
2023-05-24 20:39:13 +02:00
|
|
|
|
#ifdef HAVE_V4L2
|
|
|
|
|
.v4l2_device = NULL,
|
|
|
|
|
.v4l2_buffer = 0,
|
|
|
|
|
#endif
|
2022-01-22 11:09:41 +01:00
|
|
|
|
#ifdef HAVE_USB
|
|
|
|
|
.otg = false,
|
|
|
|
|
#endif
|
2021-10-27 18:43:47 +02:00
|
|
|
|
.show_touches = false,
|
|
|
|
|
.fullscreen = false,
|
|
|
|
|
.always_on_top = false,
|
|
|
|
|
.control = true,
|
2023-05-24 21:22:31 +02:00
|
|
|
|
.video_playback = true,
|
|
|
|
|
.audio_playback = true,
|
2021-10-27 18:43:47 +02:00
|
|
|
|
.turn_screen_off = false,
|
2021-11-26 22:05:28 +01:00
|
|
|
|
.key_inject_mode = SC_KEY_INJECT_MODE_MIXED,
|
2021-10-27 18:43:47 +02:00
|
|
|
|
.window_borderless = false,
|
|
|
|
|
.mipmaps = true,
|
|
|
|
|
.stay_awake = false,
|
|
|
|
|
.force_adb_forward = false,
|
|
|
|
|
.disable_screensaver = false,
|
|
|
|
|
.forward_key_repeat = true,
|
|
|
|
|
.legacy_paste = false,
|
|
|
|
|
.power_off_on_close = false,
|
2021-11-22 08:49:10 +01:00
|
|
|
|
.clipboard_autosync = true,
|
2022-01-15 23:01:14 +01:00
|
|
|
|
.downsize_on_error = true,
|
2021-11-25 22:22:49 +01:00
|
|
|
|
.tcpip = false,
|
|
|
|
|
.tcpip_dst = NULL,
|
2022-02-06 18:40:18 +01:00
|
|
|
|
.select_tcpip = false,
|
|
|
|
|
.select_usb = false,
|
2022-02-13 17:17:01 +01:00
|
|
|
|
.cleanup = true,
|
2022-02-17 20:08:41 +01:00
|
|
|
|
.start_fps_counter = false,
|
2022-04-23 15:08:30 +02:00
|
|
|
|
.power_on = true,
|
2023-05-07 12:08:50 +02:00
|
|
|
|
.video = true,
|
2023-02-03 16:27:34 +01:00
|
|
|
|
.audio = true,
|
2023-02-28 21:19:43 +01:00
|
|
|
|
.require_audio = false,
|
2023-06-05 19:48:21 +02:00
|
|
|
|
.kill_adb_on_close = false,
|
2023-10-27 20:20:19 -04:00
|
|
|
|
.camera_high_speed = false,
|
2023-10-24 23:54:56 +02:00
|
|
|
|
.list = 0,
|
2024-04-07 16:01:26 +02:00
|
|
|
|
.window = true,
|
2024-06-21 16:54:00 +02:00
|
|
|
|
.mouse_hover = true,
|
2024-07-16 20:56:18 +02:00
|
|
|
|
.audio_dup = false,
|
2024-10-12 09:23:31 +02:00
|
|
|
|
.new_display = NULL,
|
2024-10-19 18:19:10 +02:00
|
|
|
|
.start_app = NULL,
|
2024-11-15 19:17:04 +01:00
|
|
|
|
.angle = NULL,
|
2024-11-16 22:45:38 +01:00
|
|
|
|
.vd_system_decorations = true,
|
2021-10-27 18:43:47 +02:00
|
|
|
|
};
|
2023-11-19 01:06:59 +01:00
|
|
|
|
|
|
|
|
|
enum sc_orientation
|
|
|
|
|
sc_orientation_apply(enum sc_orientation src, enum sc_orientation transform) {
|
|
|
|
|
assert(!(src & ~7));
|
|
|
|
|
assert(!(transform & ~7));
|
|
|
|
|
|
|
|
|
|
unsigned transform_hflip = transform & 4;
|
|
|
|
|
unsigned transform_rotation = transform & 3;
|
|
|
|
|
unsigned src_hflip = src & 4;
|
|
|
|
|
unsigned src_rotation = src & 3;
|
|
|
|
|
unsigned src_swap = src & 1;
|
|
|
|
|
if (src_swap && transform_hflip) {
|
|
|
|
|
// If the src is rotated by 90 or 270 degrees, applying a flipped
|
|
|
|
|
// transformation requires an additional 180 degrees rotation to
|
|
|
|
|
// compensate for the inversion of the order of multiplication:
|
|
|
|
|
//
|
|
|
|
|
// hflip1 × rotate1 × hflip2 × rotate2
|
|
|
|
|
// `--------------' `--------------'
|
|
|
|
|
// src transform
|
|
|
|
|
//
|
|
|
|
|
// In the final result, we want all the hflips then all the rotations,
|
|
|
|
|
// so we must move hflip2 to the left:
|
|
|
|
|
//
|
|
|
|
|
// hflip1 × hflip2 × rotate1' × rotate2
|
|
|
|
|
//
|
|
|
|
|
// with rotate1' = | rotate1 if src is 0° or 180°
|
|
|
|
|
// | rotate1 + 180° if src is 90° or 270°
|
|
|
|
|
|
|
|
|
|
src_rotation += 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned result_hflip = src_hflip ^ transform_hflip;
|
|
|
|
|
unsigned result_rotation = (transform_rotation + src_rotation) % 4;
|
|
|
|
|
enum sc_orientation result = result_hflip | result_rotation;
|
|
|
|
|
return result;
|
|
|
|
|
}
|