2021-10-27 16:43:47 +00: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 20:46:34 +00:00
|
|
|
|
.video_codec_options = NULL,
|
2023-02-22 21:48:23 +00:00
|
|
|
|
.audio_codec_options = NULL,
|
2023-02-22 21:44:01 +00:00
|
|
|
|
.video_encoder = NULL,
|
2023-02-19 19:20:29 +00:00
|
|
|
|
.audio_encoder = NULL,
|
2023-07-16 09:07:19 +00:00
|
|
|
|
.camera_id = NULL,
|
|
|
|
|
.camera_size = NULL,
|
2023-10-26 21:54:34 +00:00
|
|
|
|
.camera_ar = NULL,
|
2023-10-28 00:20:19 +00:00
|
|
|
|
.camera_fps = 0,
|
2021-10-27 16:43:47 +00:00
|
|
|
|
.log_level = SC_LOG_LEVEL_INFO,
|
2023-02-20 20:19:36 +00:00
|
|
|
|
.video_codec = SC_CODEC_H264,
|
2023-02-18 18:05:43 +00:00
|
|
|
|
.audio_codec = SC_CODEC_OPUS,
|
2023-07-16 09:07:19 +00:00
|
|
|
|
.video_source = SC_VIDEO_SOURCE_DISPLAY,
|
2023-10-24 22:09:54 +00:00
|
|
|
|
.audio_source = SC_AUDIO_SOURCE_AUTO,
|
2021-10-27 16:43:47 +00:00
|
|
|
|
.record_format = SC_RECORD_FORMAT_AUTO,
|
2023-11-28 09:17:35 +00:00
|
|
|
|
.keyboard_input_mode = SC_KEYBOARD_INPUT_MODE_AUTO,
|
|
|
|
|
.mouse_input_mode = SC_MOUSE_INPUT_MODE_AUTO,
|
2023-07-22 09:17:05 +00:00
|
|
|
|
.camera_facing = SC_CAMERA_FACING_ANY,
|
2021-10-27 16:43:47 +00:00
|
|
|
|
.port_range = {
|
|
|
|
|
.first = DEFAULT_LOCAL_PORT_RANGE_FIRST,
|
|
|
|
|
.last = DEFAULT_LOCAL_PORT_RANGE_LAST,
|
|
|
|
|
},
|
2021-11-18 00:02:53 +00:00
|
|
|
|
.tunnel_host = 0,
|
|
|
|
|
.tunnel_port = 0,
|
2021-10-27 16:43:47 +00:00
|
|
|
|
.shortcut_mods = {
|
2021-12-28 14:24:15 +00:00
|
|
|
|
.data = {SC_SHORTCUT_MOD_LALT, SC_SHORTCUT_MOD_LSUPER},
|
2021-10-27 16:43:47 +00:00
|
|
|
|
.count = 2,
|
|
|
|
|
},
|
|
|
|
|
.max_size = 0,
|
2023-02-21 18:56:44 +00:00
|
|
|
|
.video_bit_rate = 0,
|
2023-02-18 17:32:43 +00:00
|
|
|
|
.audio_bit_rate = 0,
|
2021-10-27 16:43:47 +00:00
|
|
|
|
.max_fps = 0,
|
|
|
|
|
.lock_video_orientation = SC_LOCK_VIDEO_ORIENTATION_UNLOCKED,
|
2023-11-19 00:06:59 +00:00
|
|
|
|
.display_orientation = SC_ORIENTATION_0,
|
2023-11-20 13:02:46 +00:00
|
|
|
|
.record_orientation = SC_ORIENTATION_0,
|
2021-10-27 16:43:47 +00:00
|
|
|
|
.window_x = SC_WINDOW_POSITION_UNDEFINED,
|
|
|
|
|
.window_y = SC_WINDOW_POSITION_UNDEFINED,
|
|
|
|
|
.window_width = 0,
|
|
|
|
|
.window_height = 0,
|
|
|
|
|
.display_id = 0,
|
|
|
|
|
.display_buffer = 0,
|
2023-11-12 17:34:04 +00:00
|
|
|
|
.audio_buffer = -1, // depends on the audio format,
|
2023-03-13 08:23:02 +00:00
|
|
|
|
.audio_output_buffer = SC_TICK_FROM_MS(5),
|
2023-06-01 16:46:50 +00:00
|
|
|
|
.time_limit = 0,
|
2023-05-24 18:39:13 +00:00
|
|
|
|
#ifdef HAVE_V4L2
|
|
|
|
|
.v4l2_device = NULL,
|
|
|
|
|
.v4l2_buffer = 0,
|
|
|
|
|
#endif
|
2022-01-22 10:09:41 +00:00
|
|
|
|
#ifdef HAVE_USB
|
|
|
|
|
.otg = false,
|
|
|
|
|
#endif
|
2021-10-27 16:43:47 +00:00
|
|
|
|
.show_touches = false,
|
|
|
|
|
.fullscreen = false,
|
|
|
|
|
.always_on_top = false,
|
|
|
|
|
.control = true,
|
2023-05-24 19:22:31 +00:00
|
|
|
|
.video_playback = true,
|
|
|
|
|
.audio_playback = true,
|
2021-10-27 16:43:47 +00:00
|
|
|
|
.turn_screen_off = false,
|
2021-11-26 21:05:28 +00:00
|
|
|
|
.key_inject_mode = SC_KEY_INJECT_MODE_MIXED,
|
2021-10-27 16:43:47 +00:00
|
|
|
|
.window_borderless = false,
|
|
|
|
|
.mipmaps = true,
|
|
|
|
|
.stay_awake = false,
|
|
|
|
|
.force_adb_forward = false,
|
|
|
|
|
.disable_screensaver = false,
|
|
|
|
|
.forward_key_repeat = true,
|
|
|
|
|
.forward_all_clicks = false,
|
|
|
|
|
.legacy_paste = false,
|
|
|
|
|
.power_off_on_close = false,
|
2021-11-22 07:49:10 +00:00
|
|
|
|
.clipboard_autosync = true,
|
2022-01-15 22:01:14 +00:00
|
|
|
|
.downsize_on_error = true,
|
2021-11-25 21:22:49 +00:00
|
|
|
|
.tcpip = false,
|
|
|
|
|
.tcpip_dst = NULL,
|
2022-02-06 17:40:18 +00:00
|
|
|
|
.select_tcpip = false,
|
|
|
|
|
.select_usb = false,
|
2022-02-13 16:17:01 +00:00
|
|
|
|
.cleanup = true,
|
2022-02-17 19:08:41 +00:00
|
|
|
|
.start_fps_counter = false,
|
2022-04-23 13:08:30 +00:00
|
|
|
|
.power_on = true,
|
2023-05-07 10:08:50 +00:00
|
|
|
|
.video = true,
|
2023-02-03 15:27:34 +00:00
|
|
|
|
.audio = true,
|
2023-02-28 20:19:43 +00:00
|
|
|
|
.require_audio = false,
|
2023-06-05 17:48:21 +00:00
|
|
|
|
.kill_adb_on_close = false,
|
2023-10-28 00:20:19 +00:00
|
|
|
|
.camera_high_speed = false,
|
2023-10-24 21:54:56 +00:00
|
|
|
|
.list = 0,
|
2021-10-27 16:43:47 +00:00
|
|
|
|
};
|
2023-11-19 00:06:59 +00: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;
|
|
|
|
|
}
|