2018-02-08 11:14:13 +01:00
|
|
|
#ifndef SCRCPY_H
|
|
|
|
#define SCRCPY_H
|
2017-12-12 15:12:07 +01:00
|
|
|
|
2021-01-08 19:24:51 +01:00
|
|
|
#include "common.h"
|
|
|
|
|
2019-03-02 23:52:22 +01:00
|
|
|
#include <stdbool.h>
|
2020-06-19 22:04:06 +02:00
|
|
|
#include <stddef.h>
|
2019-03-02 23:52:22 +01:00
|
|
|
#include <stdint.h>
|
2017-12-12 15:12:07 +01:00
|
|
|
|
2021-07-06 19:04:05 +02:00
|
|
|
#include "util/tick.h"
|
|
|
|
|
2020-06-19 22:04:06 +02:00
|
|
|
enum sc_log_level {
|
2021-06-17 22:40:30 +03:00
|
|
|
SC_LOG_LEVEL_VERBOSE,
|
2020-06-19 22:04:06 +02:00
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
2021-04-19 18:42:20 +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,
|
|
|
|
SC_LOCK_VIDEO_ORIENTATION_1,
|
|
|
|
SC_LOCK_VIDEO_ORIENTATION_2,
|
|
|
|
SC_LOCK_VIDEO_ORIENTATION_3,
|
|
|
|
};
|
|
|
|
|
2020-07-17 00:00:42 +02:00
|
|
|
#define SC_MAX_SHORTCUT_MODS 8
|
|
|
|
|
|
|
|
enum sc_shortcut_mod {
|
|
|
|
SC_MOD_LCTRL = 1 << 0,
|
|
|
|
SC_MOD_RCTRL = 1 << 1,
|
|
|
|
SC_MOD_LALT = 1 << 2,
|
|
|
|
SC_MOD_RALT = 1 << 3,
|
|
|
|
SC_MOD_LSUPER = 1 << 4,
|
|
|
|
SC_MOD_RSUPER = 1 << 5,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sc_shortcut_mods {
|
|
|
|
unsigned data[SC_MAX_SHORTCUT_MODS];
|
|
|
|
unsigned count;
|
|
|
|
};
|
|
|
|
|
2020-06-19 22:04:06 +02:00
|
|
|
struct sc_port_range {
|
|
|
|
uint16_t first;
|
|
|
|
uint16_t last;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SC_WINDOW_POSITION_UNDEFINED (-0x8000)
|
2019-09-29 22:36:56 +02:00
|
|
|
|
2018-03-21 14:04:13 +01:00
|
|
|
struct scrcpy_options {
|
|
|
|
const char *serial;
|
2018-08-09 19:12:27 +02:00
|
|
|
const char *crop;
|
2018-11-11 14:03:29 +01:00
|
|
|
const char *record_filename;
|
2019-06-23 13:02:34 -04:00
|
|
|
const char *window_title;
|
2019-07-31 01:48:32 +02:00
|
|
|
const char *push_target;
|
2020-04-11 14:34:41 +02:00
|
|
|
const char *render_driver;
|
2020-04-26 15:22:08 +03:00
|
|
|
const char *codec_options;
|
2020-10-12 12:23:06 +03:00
|
|
|
const char *encoder_name;
|
2021-04-04 00:10:44 +02:00
|
|
|
const char *v4l2_device;
|
2020-05-24 21:51:40 +02:00
|
|
|
enum sc_log_level log_level;
|
2020-06-19 22:04:06 +02:00
|
|
|
enum sc_record_format record_format;
|
|
|
|
struct sc_port_range port_range;
|
2020-07-17 00:00:42 +02:00
|
|
|
struct sc_shortcut_mods shortcut_mods;
|
2019-03-02 23:52:22 +01:00
|
|
|
uint16_t max_size;
|
|
|
|
uint32_t bit_rate;
|
2019-11-17 22:07:19 +01:00
|
|
|
uint16_t max_fps;
|
2021-04-19 18:42:20 +02:00
|
|
|
enum sc_lock_video_orientation lock_video_orientation;
|
2020-04-08 10:17:12 +02:00
|
|
|
uint8_t rotation;
|
2020-06-19 22:04:06 +02:00
|
|
|
int16_t window_x; // SC_WINDOW_POSITION_UNDEFINED for "auto"
|
|
|
|
int16_t window_y; // SC_WINDOW_POSITION_UNDEFINED for "auto"
|
2019-11-03 18:00:11 +01:00
|
|
|
uint16_t window_width;
|
|
|
|
uint16_t window_height;
|
2021-01-04 08:16:32 +01:00
|
|
|
uint32_t display_id;
|
2021-07-06 19:04:05 +02:00
|
|
|
sc_tick display_buffer;
|
|
|
|
sc_tick v4l2_buffer;
|
2019-03-02 23:52:22 +01:00
|
|
|
bool show_touches;
|
|
|
|
bool fullscreen;
|
|
|
|
bool always_on_top;
|
2019-06-04 21:49:26 +02:00
|
|
|
bool control;
|
|
|
|
bool display;
|
2019-06-05 00:55:46 +02:00
|
|
|
bool turn_screen_off;
|
2019-11-07 19:01:35 +01:00
|
|
|
bool prefer_text;
|
2019-08-29 00:25:17 -05:00
|
|
|
bool window_borderless;
|
2020-04-11 23:55:29 +02:00
|
|
|
bool mipmaps;
|
2020-05-02 01:54:48 +02:00
|
|
|
bool stay_awake;
|
2020-05-24 23:27:34 +02:00
|
|
|
bool force_adb_forward;
|
2020-06-13 15:10:41 +03:00
|
|
|
bool disable_screensaver;
|
2020-07-27 02:26:25 -04:00
|
|
|
bool forward_key_repeat;
|
2020-10-05 20:45:53 +02:00
|
|
|
bool forward_all_clicks;
|
2020-10-06 21:30:10 +02:00
|
|
|
bool legacy_paste;
|
2021-02-21 08:42:04 +08:00
|
|
|
bool power_off_on_close;
|
2018-03-21 14:04:13 +01:00
|
|
|
};
|
|
|
|
|
2019-11-06 22:06:54 +01:00
|
|
|
#define SCRCPY_OPTIONS_DEFAULT { \
|
|
|
|
.serial = NULL, \
|
|
|
|
.crop = NULL, \
|
|
|
|
.record_filename = NULL, \
|
|
|
|
.window_title = NULL, \
|
|
|
|
.push_target = NULL, \
|
2020-04-11 14:34:41 +02:00
|
|
|
.render_driver = NULL, \
|
2020-04-26 15:22:08 +03:00
|
|
|
.codec_options = NULL, \
|
2020-10-12 12:23:06 +03:00
|
|
|
.encoder_name = NULL, \
|
2021-04-04 00:10:44 +02:00
|
|
|
.v4l2_device = NULL, \
|
2020-05-24 21:51:40 +02:00
|
|
|
.log_level = SC_LOG_LEVEL_INFO, \
|
2020-06-19 22:04:06 +02:00
|
|
|
.record_format = SC_RECORD_FORMAT_AUTO, \
|
2019-12-09 21:16:09 +01:00
|
|
|
.port_range = { \
|
|
|
|
.first = DEFAULT_LOCAL_PORT_RANGE_FIRST, \
|
|
|
|
.last = DEFAULT_LOCAL_PORT_RANGE_LAST, \
|
|
|
|
}, \
|
2020-07-17 00:00:42 +02:00
|
|
|
.shortcut_mods = { \
|
2020-07-17 00:00:42 +02:00
|
|
|
.data = {SC_MOD_LALT, SC_MOD_LSUPER}, \
|
|
|
|
.count = 2, \
|
2020-07-17 00:00:42 +02:00
|
|
|
}, \
|
2021-02-23 09:37:16 +01:00
|
|
|
.max_size = 0, \
|
2019-11-06 22:06:54 +01:00
|
|
|
.bit_rate = DEFAULT_BIT_RATE, \
|
2019-11-17 22:07:19 +01:00
|
|
|
.max_fps = 0, \
|
2021-04-19 18:42:20 +02:00
|
|
|
.lock_video_orientation = SC_LOCK_VIDEO_ORIENTATION_UNLOCKED, \
|
2020-04-08 10:17:12 +02:00
|
|
|
.rotation = 0, \
|
2020-06-19 22:04:06 +02:00
|
|
|
.window_x = SC_WINDOW_POSITION_UNDEFINED, \
|
|
|
|
.window_y = SC_WINDOW_POSITION_UNDEFINED, \
|
2019-11-03 18:00:11 +01:00
|
|
|
.window_width = 0, \
|
|
|
|
.window_height = 0, \
|
2020-02-24 14:16:38 +03:00
|
|
|
.display_id = 0, \
|
2021-07-06 19:04:05 +02:00
|
|
|
.display_buffer = 0, \
|
|
|
|
.v4l2_buffer = 0, \
|
2019-11-06 22:06:54 +01:00
|
|
|
.show_touches = false, \
|
|
|
|
.fullscreen = false, \
|
|
|
|
.always_on_top = false, \
|
|
|
|
.control = true, \
|
|
|
|
.display = true, \
|
|
|
|
.turn_screen_off = false, \
|
2019-11-07 19:01:35 +01:00
|
|
|
.prefer_text = false, \
|
2019-08-29 00:25:17 -05:00
|
|
|
.window_borderless = false, \
|
2020-04-11 23:55:29 +02:00
|
|
|
.mipmaps = true, \
|
2020-05-02 01:54:48 +02:00
|
|
|
.stay_awake = false, \
|
2020-05-24 23:27:34 +02:00
|
|
|
.force_adb_forward = false, \
|
2020-06-13 15:10:41 +03:00
|
|
|
.disable_screensaver = false, \
|
2020-07-27 02:26:25 -04:00
|
|
|
.forward_key_repeat = true, \
|
2020-10-05 20:45:53 +02:00
|
|
|
.forward_all_clicks = false, \
|
2020-10-06 21:30:10 +02:00
|
|
|
.legacy_paste = false, \
|
2021-02-21 08:42:04 +08:00
|
|
|
.power_off_on_close = false, \
|
2019-11-06 22:06:54 +01:00
|
|
|
}
|
|
|
|
|
2019-03-02 23:52:22 +01:00
|
|
|
bool
|
2019-03-02 20:09:56 +01:00
|
|
|
scrcpy(const struct scrcpy_options *options);
|
2017-12-12 15:12:07 +01:00
|
|
|
|
|
|
|
#endif
|