2021-10-27 18:43:47 +02:00
|
|
|
#ifndef SCRCPY_OPTIONS_H
|
|
|
|
#define SCRCPY_OPTIONS_H
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
2023-11-19 01:06:59 +01:00
|
|
|
#include <assert.h>
|
2021-10-27 18:43:47 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "util/tick.h"
|
|
|
|
|
|
|
|
enum sc_log_level {
|
|
|
|
SC_LOG_LEVEL_VERBOSE,
|
|
|
|
SC_LOG_LEVEL_DEBUG,
|
|
|
|
SC_LOG_LEVEL_INFO,
|
|
|
|
SC_LOG_LEVEL_WARN,
|
|
|
|
SC_LOG_LEVEL_ERROR,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum sc_record_format {
|
|
|
|
SC_RECORD_FORMAT_AUTO,
|
|
|
|
SC_RECORD_FORMAT_MP4,
|
|
|
|
SC_RECORD_FORMAT_MKV,
|
2023-05-07 12:23:51 +02:00
|
|
|
SC_RECORD_FORMAT_M4A,
|
|
|
|
SC_RECORD_FORMAT_MKA,
|
2023-05-07 12:35:27 +02:00
|
|
|
SC_RECORD_FORMAT_OPUS,
|
2023-05-07 12:38:32 +02:00
|
|
|
SC_RECORD_FORMAT_AAC,
|
2023-11-07 15:09:47 +03:00
|
|
|
SC_RECORD_FORMAT_FLAC,
|
2023-11-13 09:35:18 +01:00
|
|
|
SC_RECORD_FORMAT_WAV,
|
2021-10-27 18:43:47 +02:00
|
|
|
};
|
|
|
|
|
2023-05-07 12:23:51 +02:00
|
|
|
static inline bool
|
|
|
|
sc_record_format_is_audio_only(enum sc_record_format fmt) {
|
|
|
|
return fmt == SC_RECORD_FORMAT_M4A
|
2023-05-07 12:35:27 +02:00
|
|
|
|| fmt == SC_RECORD_FORMAT_MKA
|
2023-05-07 12:38:32 +02:00
|
|
|
|| fmt == SC_RECORD_FORMAT_OPUS
|
2023-11-07 15:09:47 +03:00
|
|
|
|| fmt == SC_RECORD_FORMAT_AAC
|
2023-11-13 09:35:18 +01:00
|
|
|
|| fmt == SC_RECORD_FORMAT_FLAC
|
|
|
|
|| fmt == SC_RECORD_FORMAT_WAV;
|
2023-05-07 12:23:51 +02:00
|
|
|
}
|
|
|
|
|
2023-02-03 12:35:37 +01:00
|
|
|
enum sc_codec {
|
|
|
|
SC_CODEC_H264,
|
2023-02-03 12:40:55 +01:00
|
|
|
SC_CODEC_H265,
|
2023-02-03 12:42:22 +01:00
|
|
|
SC_CODEC_AV1,
|
2023-02-18 19:05:43 +01:00
|
|
|
SC_CODEC_OPUS,
|
2023-02-18 19:30:36 +01:00
|
|
|
SC_CODEC_AAC,
|
2023-11-07 15:09:47 +03:00
|
|
|
SC_CODEC_FLAC,
|
2023-03-03 21:19:37 +01:00
|
|
|
SC_CODEC_RAW,
|
2023-02-03 12:35:37 +01:00
|
|
|
};
|
|
|
|
|
2023-07-16 17:07:19 +08:00
|
|
|
enum sc_video_source {
|
|
|
|
SC_VIDEO_SOURCE_DISPLAY,
|
|
|
|
SC_VIDEO_SOURCE_CAMERA,
|
|
|
|
};
|
|
|
|
|
2023-05-30 21:29:05 +02:00
|
|
|
enum sc_audio_source {
|
2023-10-25 00:09:54 +02:00
|
|
|
SC_AUDIO_SOURCE_AUTO, // OUTPUT for video DISPLAY, MIC for video CAMERA
|
2023-05-30 21:29:05 +02:00
|
|
|
SC_AUDIO_SOURCE_OUTPUT,
|
|
|
|
SC_AUDIO_SOURCE_MIC,
|
2024-07-15 10:57:46 +02:00
|
|
|
SC_AUDIO_SOURCE_PLAYBACK,
|
2023-05-30 21:29:05 +02:00
|
|
|
};
|
|
|
|
|
2023-07-22 17:17:05 +08:00
|
|
|
enum sc_camera_facing {
|
|
|
|
SC_CAMERA_FACING_ANY,
|
|
|
|
SC_CAMERA_FACING_FRONT,
|
|
|
|
SC_CAMERA_FACING_BACK,
|
|
|
|
SC_CAMERA_FACING_EXTERNAL,
|
|
|
|
};
|
|
|
|
|
2023-11-19 01:06:59 +01:00
|
|
|
// ,----- hflip (applied before the rotation)
|
|
|
|
// | ,--- 180°
|
|
|
|
// | | ,- 90° clockwise
|
|
|
|
// | | |
|
|
|
|
enum sc_orientation { // v v v
|
|
|
|
SC_ORIENTATION_0, // 0 0 0
|
|
|
|
SC_ORIENTATION_90, // 0 0 1
|
|
|
|
SC_ORIENTATION_180, // 0 1 0
|
|
|
|
SC_ORIENTATION_270, // 0 1 1
|
|
|
|
SC_ORIENTATION_FLIP_0, // 1 0 0
|
|
|
|
SC_ORIENTATION_FLIP_90, // 1 0 1
|
|
|
|
SC_ORIENTATION_FLIP_180, // 1 1 0
|
|
|
|
SC_ORIENTATION_FLIP_270, // 1 1 1
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
sc_orientation_is_mirror(enum sc_orientation orientation) {
|
|
|
|
assert(!(orientation & ~7));
|
|
|
|
return orientation & 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Does the orientation swap width and height?
|
|
|
|
static inline bool
|
|
|
|
sc_orientation_is_swap(enum sc_orientation orientation) {
|
|
|
|
assert(!(orientation & ~7));
|
|
|
|
return orientation & 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline enum sc_orientation
|
|
|
|
sc_orientation_get_rotation(enum sc_orientation orientation) {
|
|
|
|
assert(!(orientation & ~7));
|
|
|
|
return orientation & 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum sc_orientation
|
|
|
|
sc_orientation_apply(enum sc_orientation src, enum sc_orientation transform);
|
|
|
|
|
|
|
|
static inline const char *
|
|
|
|
sc_orientation_get_name(enum sc_orientation orientation) {
|
|
|
|
switch (orientation) {
|
|
|
|
case SC_ORIENTATION_0:
|
|
|
|
return "0";
|
|
|
|
case SC_ORIENTATION_90:
|
|
|
|
return "90";
|
|
|
|
case SC_ORIENTATION_180:
|
|
|
|
return "180";
|
|
|
|
case SC_ORIENTATION_270:
|
|
|
|
return "270";
|
|
|
|
case SC_ORIENTATION_FLIP_0:
|
|
|
|
return "flip0";
|
|
|
|
case SC_ORIENTATION_FLIP_90:
|
|
|
|
return "flip90";
|
|
|
|
case SC_ORIENTATION_FLIP_180:
|
|
|
|
return "flip180";
|
|
|
|
case SC_ORIENTATION_FLIP_270:
|
|
|
|
return "flip270";
|
|
|
|
default:
|
|
|
|
return "(unknown)";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-27 18:43:47 +02:00
|
|
|
enum sc_lock_video_orientation {
|
|
|
|
SC_LOCK_VIDEO_ORIENTATION_UNLOCKED = -1,
|
|
|
|
// lock the current orientation when scrcpy starts
|
|
|
|
SC_LOCK_VIDEO_ORIENTATION_INITIAL = -2,
|
|
|
|
SC_LOCK_VIDEO_ORIENTATION_0 = 0,
|
2023-11-20 13:49:14 +01:00
|
|
|
SC_LOCK_VIDEO_ORIENTATION_90 = 3,
|
|
|
|
SC_LOCK_VIDEO_ORIENTATION_180 = 2,
|
|
|
|
SC_LOCK_VIDEO_ORIENTATION_270 = 1,
|
2021-10-27 18:43:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum sc_keyboard_input_mode {
|
2023-11-28 17:17:35 +08:00
|
|
|
SC_KEYBOARD_INPUT_MODE_AUTO,
|
|
|
|
SC_KEYBOARD_INPUT_MODE_DISABLED,
|
|
|
|
SC_KEYBOARD_INPUT_MODE_SDK,
|
2023-11-28 17:17:35 +08:00
|
|
|
SC_KEYBOARD_INPUT_MODE_UHID,
|
2023-11-28 17:17:35 +08:00
|
|
|
SC_KEYBOARD_INPUT_MODE_AOA,
|
2021-10-27 18:43:47 +02:00
|
|
|
};
|
|
|
|
|
2021-12-26 22:32:51 +01:00
|
|
|
enum sc_mouse_input_mode {
|
2023-11-28 17:17:35 +08:00
|
|
|
SC_MOUSE_INPUT_MODE_AUTO,
|
|
|
|
SC_MOUSE_INPUT_MODE_DISABLED,
|
|
|
|
SC_MOUSE_INPUT_MODE_SDK,
|
2024-02-25 15:43:36 +01:00
|
|
|
SC_MOUSE_INPUT_MODE_UHID,
|
2023-11-28 17:17:35 +08:00
|
|
|
SC_MOUSE_INPUT_MODE_AOA,
|
2021-12-26 22:32:51 +01:00
|
|
|
};
|
|
|
|
|
2024-06-24 23:07:08 +02:00
|
|
|
enum sc_mouse_binding {
|
2024-06-24 23:11:42 +02:00
|
|
|
SC_MOUSE_BINDING_AUTO,
|
2024-06-24 23:07:08 +02:00
|
|
|
SC_MOUSE_BINDING_DISABLED,
|
|
|
|
SC_MOUSE_BINDING_CLICK,
|
|
|
|
SC_MOUSE_BINDING_BACK,
|
|
|
|
SC_MOUSE_BINDING_HOME,
|
|
|
|
SC_MOUSE_BINDING_APP_SWITCH,
|
|
|
|
SC_MOUSE_BINDING_EXPAND_NOTIFICATION_PANEL,
|
|
|
|
};
|
|
|
|
|
2024-07-09 20:45:49 +02:00
|
|
|
struct sc_mouse_binding_set {
|
2024-06-24 23:07:08 +02:00
|
|
|
enum sc_mouse_binding right_click;
|
|
|
|
enum sc_mouse_binding middle_click;
|
|
|
|
enum sc_mouse_binding click4;
|
|
|
|
enum sc_mouse_binding click5;
|
|
|
|
};
|
|
|
|
|
2024-07-09 20:45:49 +02:00
|
|
|
struct sc_mouse_bindings {
|
|
|
|
struct sc_mouse_binding_set pri;
|
|
|
|
struct sc_mouse_binding_set sec; // When Shift is pressed
|
|
|
|
};
|
|
|
|
|
2021-11-26 22:05:28 +01:00
|
|
|
enum sc_key_inject_mode {
|
|
|
|
// Inject special keys, letters and space as key events.
|
|
|
|
// Inject numbers and punctuation as text events.
|
|
|
|
// This is the default mode.
|
|
|
|
SC_KEY_INJECT_MODE_MIXED,
|
|
|
|
|
|
|
|
// Inject special keys as key events.
|
|
|
|
// Inject letters and space, numbers and punctuation as text events.
|
|
|
|
SC_KEY_INJECT_MODE_TEXT,
|
2021-11-26 22:15:44 +01:00
|
|
|
|
|
|
|
// Inject everything as key events.
|
|
|
|
SC_KEY_INJECT_MODE_RAW,
|
2021-11-26 22:05:28 +01:00
|
|
|
};
|
|
|
|
|
2021-10-27 18:43:47 +02:00
|
|
|
enum sc_shortcut_mod {
|
2021-12-28 15:24:15 +01:00
|
|
|
SC_SHORTCUT_MOD_LCTRL = 1 << 0,
|
|
|
|
SC_SHORTCUT_MOD_RCTRL = 1 << 1,
|
|
|
|
SC_SHORTCUT_MOD_LALT = 1 << 2,
|
|
|
|
SC_SHORTCUT_MOD_RALT = 1 << 3,
|
|
|
|
SC_SHORTCUT_MOD_LSUPER = 1 << 4,
|
|
|
|
SC_SHORTCUT_MOD_RSUPER = 1 << 5,
|
2021-10-27 18:43:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct sc_port_range {
|
|
|
|
uint16_t first;
|
|
|
|
uint16_t last;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SC_WINDOW_POSITION_UNDEFINED (-0x8000)
|
|
|
|
|
|
|
|
struct scrcpy_options {
|
|
|
|
const char *serial;
|
|
|
|
const char *crop;
|
|
|
|
const char *record_filename;
|
|
|
|
const char *window_title;
|
|
|
|
const char *push_target;
|
|
|
|
const char *render_driver;
|
2023-02-21 21:46:34 +01:00
|
|
|
const char *video_codec_options;
|
2023-02-22 22:48:23 +01:00
|
|
|
const char *audio_codec_options;
|
2023-02-22 22:44:01 +01:00
|
|
|
const char *video_encoder;
|
2023-02-19 20:20:29 +01:00
|
|
|
const char *audio_encoder;
|
2023-07-16 17:07:19 +08:00
|
|
|
const char *camera_id;
|
|
|
|
const char *camera_size;
|
2023-10-26 23:54:34 +02:00
|
|
|
const char *camera_ar;
|
2023-10-27 20:20:19 -04:00
|
|
|
uint16_t camera_fps;
|
2021-10-27 18:43:47 +02:00
|
|
|
enum sc_log_level log_level;
|
2023-02-20 21:19:36 +01:00
|
|
|
enum sc_codec video_codec;
|
2023-02-18 19:05:43 +01:00
|
|
|
enum sc_codec audio_codec;
|
2023-07-16 17:07:19 +08:00
|
|
|
enum sc_video_source video_source;
|
2023-05-30 21:29:05 +02:00
|
|
|
enum sc_audio_source audio_source;
|
2021-10-27 18:43:47 +02:00
|
|
|
enum sc_record_format record_format;
|
|
|
|
enum sc_keyboard_input_mode keyboard_input_mode;
|
2021-12-26 22:32:51 +01:00
|
|
|
enum sc_mouse_input_mode mouse_input_mode;
|
2024-06-24 23:07:08 +02:00
|
|
|
struct sc_mouse_bindings mouse_bindings;
|
2023-07-22 17:17:05 +08:00
|
|
|
enum sc_camera_facing camera_facing;
|
2021-10-27 18:43:47 +02:00
|
|
|
struct sc_port_range port_range;
|
2021-11-18 01:02:53 +01:00
|
|
|
uint32_t tunnel_host;
|
|
|
|
uint16_t tunnel_port;
|
2024-03-07 23:07:01 +01:00
|
|
|
uint8_t shortcut_mods; // OR of enum sc_shortcut_mod values
|
2021-10-27 18:43:47 +02:00
|
|
|
uint16_t max_size;
|
2023-02-21 19:56:44 +01:00
|
|
|
uint32_t video_bit_rate;
|
2023-02-18 18:32:43 +01:00
|
|
|
uint32_t audio_bit_rate;
|
2021-10-27 18:43:47 +02:00
|
|
|
uint16_t max_fps;
|
|
|
|
enum sc_lock_video_orientation lock_video_orientation;
|
2023-11-19 01:06:59 +01:00
|
|
|
enum sc_orientation display_orientation;
|
2023-11-20 14:02:46 +01:00
|
|
|
enum sc_orientation record_orientation;
|
2021-10-27 18:43:47 +02:00
|
|
|
int16_t window_x; // SC_WINDOW_POSITION_UNDEFINED for "auto"
|
|
|
|
int16_t window_y; // SC_WINDOW_POSITION_UNDEFINED for "auto"
|
|
|
|
uint16_t window_width;
|
|
|
|
uint16_t window_height;
|
|
|
|
uint32_t display_id;
|
|
|
|
sc_tick display_buffer;
|
2023-03-02 23:14:01 +01:00
|
|
|
sc_tick audio_buffer;
|
2023-03-13 09:23:02 +01:00
|
|
|
sc_tick audio_output_buffer;
|
2023-06-01 18:46:50 +02:00
|
|
|
sc_tick time_limit;
|
2023-05-24 20:39:13 +02:00
|
|
|
#ifdef HAVE_V4L2
|
|
|
|
const char *v4l2_device;
|
|
|
|
sc_tick v4l2_buffer;
|
|
|
|
#endif
|
2022-01-22 11:09:41 +01:00
|
|
|
#ifdef HAVE_USB
|
|
|
|
bool otg;
|
|
|
|
#endif
|
2021-10-27 18:43:47 +02:00
|
|
|
bool show_touches;
|
|
|
|
bool fullscreen;
|
|
|
|
bool always_on_top;
|
|
|
|
bool control;
|
2023-05-24 21:22:31 +02:00
|
|
|
bool video_playback;
|
|
|
|
bool audio_playback;
|
2021-10-27 18:43:47 +02:00
|
|
|
bool turn_screen_off;
|
2021-11-26 22:05:28 +01:00
|
|
|
enum sc_key_inject_mode key_inject_mode;
|
2021-10-27 18:43:47 +02:00
|
|
|
bool window_borderless;
|
|
|
|
bool mipmaps;
|
|
|
|
bool stay_awake;
|
|
|
|
bool force_adb_forward;
|
|
|
|
bool disable_screensaver;
|
|
|
|
bool forward_key_repeat;
|
|
|
|
bool legacy_paste;
|
|
|
|
bool power_off_on_close;
|
2021-11-22 08:49:10 +01:00
|
|
|
bool clipboard_autosync;
|
2022-01-15 23:01:14 +01:00
|
|
|
bool downsize_on_error;
|
2021-11-25 22:22:49 +01:00
|
|
|
bool tcpip;
|
|
|
|
const char *tcpip_dst;
|
2022-02-06 18:40:18 +01:00
|
|
|
bool select_usb;
|
|
|
|
bool select_tcpip;
|
2022-02-13 17:17:01 +01:00
|
|
|
bool cleanup;
|
2022-02-17 20:08:41 +01:00
|
|
|
bool start_fps_counter;
|
2022-04-23 15:08:30 +02:00
|
|
|
bool power_on;
|
2023-05-07 12:08:50 +02:00
|
|
|
bool video;
|
2023-02-03 16:27:34 +01:00
|
|
|
bool audio;
|
2023-02-28 21:19:43 +01:00
|
|
|
bool require_audio;
|
2023-06-05 19:48:21 +02:00
|
|
|
bool kill_adb_on_close;
|
2023-10-27 20:20:19 -04:00
|
|
|
bool camera_high_speed;
|
2023-10-24 23:54:56 +02:00
|
|
|
#define SC_OPTION_LIST_ENCODERS 0x1
|
|
|
|
#define SC_OPTION_LIST_DISPLAYS 0x2
|
2023-07-16 17:07:19 +08:00
|
|
|
#define SC_OPTION_LIST_CAMERAS 0x4
|
2023-10-24 23:46:56 +02:00
|
|
|
#define SC_OPTION_LIST_CAMERA_SIZES 0x8
|
2023-10-24 23:54:56 +02:00
|
|
|
uint8_t list;
|
2024-04-07 16:01:26 +02:00
|
|
|
bool window;
|
2024-06-21 16:54:00 +02:00
|
|
|
bool mouse_hover;
|
2024-07-16 20:56:18 +02:00
|
|
|
bool audio_dup;
|
2021-10-27 18:43:47 +02:00
|
|
|
};
|
|
|
|
|
2021-10-27 18:43:47 +02:00
|
|
|
extern const struct scrcpy_options scrcpy_options_default;
|
2021-10-27 18:43:47 +02:00
|
|
|
|
|
|
|
#endif
|