mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-03 14:49:29 +00:00
sync
This commit is contained in:
parent
1b7a78c451
commit
16b14e83e9
7 changed files with 143 additions and 81 deletions
1
FAQ.md
1
FAQ.md
|
@ -199,3 +199,4 @@ scrcpy -m 1920
|
||||||
scrcpy -m 1024
|
scrcpy -m 1024
|
||||||
scrcpy -m 800
|
scrcpy -m 800
|
||||||
```
|
```
|
||||||
|
meson x --buildtype release --strip -Db_lto=true -Dprebuilt_server=server/scrcpy-server
|
29
app/src/CMakeLists.txt
Normal file
29
app/src/CMakeLists.txt
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
project(NiScrcpy)
|
||||||
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
|
||||||
|
include_directories(/mingw64/include)
|
||||||
|
include_directories(./)
|
||||||
|
link_directories(/usr/local/Cellar/ffmpeg/4.2.1/lib/)
|
||||||
|
|
||||||
|
include_directories(/usr/local/Cellar/sdl2/2.0.10/include/)
|
||||||
|
link_directories(/usr/local/Cellar/sdl2/2.0.10/lib)
|
||||||
|
|
||||||
|
aux_source_directory(. SRC_LIST) # 搜索当前目录下的所有.cpp文件
|
||||||
|
|
||||||
|
|
||||||
|
add_executable(NiScrcpy ${SRC_LIST})
|
||||||
|
|
||||||
|
target_link_libraries(
|
||||||
|
NiScrcpy
|
||||||
|
avcodec
|
||||||
|
avdevice
|
||||||
|
avfilter
|
||||||
|
avformat
|
||||||
|
avresample
|
||||||
|
avutil
|
||||||
|
postproc
|
||||||
|
swresample
|
||||||
|
swscale
|
||||||
|
SDL2
|
||||||
|
)
|
33
app/src/config.h
Normal file
33
app/src/config.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Autogenerated by the Meson build system.
|
||||||
|
* Do not edit, your changes will be lost.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define DEFAULT_BIT_RATE 8000000
|
||||||
|
|
||||||
|
#define DEFAULT_LOCAL_PORT_RANGE_FIRST 27183
|
||||||
|
|
||||||
|
#define DEFAULT_LOCAL_PORT_RANGE_LAST 27199
|
||||||
|
|
||||||
|
#define DEFAULT_LOCK_VIDEO_ORIENTATION -1
|
||||||
|
|
||||||
|
#define DEFAULT_MAX_SIZE 0
|
||||||
|
|
||||||
|
#define HIDPI_SUPPORT
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
|
||||||
|
#undef PORTABLE
|
||||||
|
|
||||||
|
#define PREFIX "c:/"
|
||||||
|
|
||||||
|
#define SCRCPY_VERSION "1.16"
|
||||||
|
|
||||||
|
#undef SERVER_DEBUGGER
|
||||||
|
|
||||||
|
#define SERVER_DEBUGGER_METHOD_NEW
|
||||||
|
|
||||||
|
#undef WINDOWS_NOCONSOLE
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_version(void) {
|
print_version(void)
|
||||||
|
{
|
||||||
fprintf(stderr, "scrcpy %s\n\n", SCRCPY_VERSION);
|
fprintf(stderr, "scrcpy %s\n\n", SCRCPY_VERSION);
|
||||||
|
|
||||||
fprintf(stderr, "dependencies:\n");
|
fprintf(stderr, "dependencies:\n");
|
||||||
|
@ -31,8 +32,10 @@ print_version(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_LogPriority
|
static SDL_LogPriority
|
||||||
convert_log_level_to_sdl(enum sc_log_level level) {
|
convert_log_level_to_sdl(enum sc_log_level level)
|
||||||
switch (level) {
|
{
|
||||||
|
switch (level)
|
||||||
|
{
|
||||||
case SC_LOG_LEVEL_DEBUG:
|
case SC_LOG_LEVEL_DEBUG:
|
||||||
return SDL_LOG_PRIORITY_DEBUG;
|
return SDL_LOG_PRIORITY_DEBUG;
|
||||||
case SC_LOG_LEVEL_INFO:
|
case SC_LOG_LEVEL_INFO:
|
||||||
|
@ -47,12 +50,12 @@ convert_log_level_to_sdl(enum sc_log_level level) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
int
|
{
|
||||||
main(int argc, char *argv[]) {
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
// disable buffering, we want logs immediately
|
// disable buffering, we want logs immediately
|
||||||
// even line buffering (setvbuf() with mode _IOLBF) is not sufficient
|
// even line buffering (setvbuf() with mode _IOLBF) is not sufficient
|
||||||
|
// 在windows取消打印缓冲
|
||||||
setbuf(stdout, NULL);
|
setbuf(stdout, NULL);
|
||||||
setbuf(stderr, NULL);
|
setbuf(stderr, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
@ -67,30 +70,33 @@ main(int argc, char *argv[]) {
|
||||||
args.opts.log_level = SC_LOG_LEVEL_DEBUG;
|
args.opts.log_level = SC_LOG_LEVEL_DEBUG;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!scrcpy_parse_args(&args, argc, argv)) {
|
if (!scrcpy_parse_args(&args, argc, argv))
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_LogPriority sdl_log = convert_log_level_to_sdl(args.opts.log_level);
|
SDL_LogPriority sdl_log = convert_log_level_to_sdl(args.opts.log_level);
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, sdl_log);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, sdl_log);
|
||||||
|
|
||||||
if (args.help) {
|
if (args.help)
|
||||||
|
{
|
||||||
scrcpy_print_usage(argv[0]);
|
scrcpy_print_usage(argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.version) {
|
if (args.version)
|
||||||
|
{
|
||||||
print_version();
|
print_version();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGI("scrcpy " SCRCPY_VERSION " <https://github.com/Genymobile/scrcpy>");
|
LOGI("scrcpy " SCRCPY_VERSION " <https://github.com/Genymobile/scrcpy>");
|
||||||
|
|
||||||
#ifdef SCRCPY_LAVF_REQUIRES_REGISTER_ALL
|
#ifdef SCRCPY_LAVF_REQUIRES_REGISTER_ALL
|
||||||
av_register_all();
|
av_register_all();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (avformat_network_init()) {
|
if (avformat_network_init())
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,8 +104,9 @@ main(int argc, char *argv[]) {
|
||||||
|
|
||||||
avformat_network_deinit(); // ignore failure
|
avformat_network_deinit(); // ignore failure
|
||||||
|
|
||||||
#if defined (__WINDOWS__) && ! defined (WINDOWS_NOCONSOLE)
|
#if defined(__WINDOWS__) && !defined(WINDOWS_NOCONSOLE)
|
||||||
if (res != 0) {
|
if (res != 0)
|
||||||
|
{
|
||||||
fprintf(stderr, "Press any key to continue...\n");
|
fprintf(stderr, "Press any key to continue...\n");
|
||||||
getchar();
|
getchar();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,16 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
enum sc_log_level {
|
enum sc_log_level
|
||||||
|
{
|
||||||
SC_LOG_LEVEL_DEBUG,
|
SC_LOG_LEVEL_DEBUG,
|
||||||
SC_LOG_LEVEL_INFO,
|
SC_LOG_LEVEL_INFO,
|
||||||
SC_LOG_LEVEL_WARN,
|
SC_LOG_LEVEL_WARN,
|
||||||
SC_LOG_LEVEL_ERROR,
|
SC_LOG_LEVEL_ERROR,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sc_record_format {
|
enum sc_record_format
|
||||||
|
{
|
||||||
SC_RECORD_FORMAT_AUTO,
|
SC_RECORD_FORMAT_AUTO,
|
||||||
SC_RECORD_FORMAT_MP4,
|
SC_RECORD_FORMAT_MP4,
|
||||||
SC_RECORD_FORMAT_MKV,
|
SC_RECORD_FORMAT_MKV,
|
||||||
|
@ -22,7 +24,8 @@ enum sc_record_format {
|
||||||
|
|
||||||
#define SC_MAX_SHORTCUT_MODS 8
|
#define SC_MAX_SHORTCUT_MODS 8
|
||||||
|
|
||||||
enum sc_shortcut_mod {
|
enum sc_shortcut_mod
|
||||||
|
{
|
||||||
SC_MOD_LCTRL = 1 << 0,
|
SC_MOD_LCTRL = 1 << 0,
|
||||||
SC_MOD_RCTRL = 1 << 1,
|
SC_MOD_RCTRL = 1 << 1,
|
||||||
SC_MOD_LALT = 1 << 2,
|
SC_MOD_LALT = 1 << 2,
|
||||||
|
@ -31,19 +34,22 @@ enum sc_shortcut_mod {
|
||||||
SC_MOD_RSUPER = 1 << 5,
|
SC_MOD_RSUPER = 1 << 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sc_shortcut_mods {
|
struct sc_shortcut_mods
|
||||||
|
{
|
||||||
unsigned data[SC_MAX_SHORTCUT_MODS];
|
unsigned data[SC_MAX_SHORTCUT_MODS];
|
||||||
unsigned count;
|
unsigned count;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sc_port_range {
|
struct sc_port_range
|
||||||
|
{
|
||||||
uint16_t first;
|
uint16_t first;
|
||||||
uint16_t last;
|
uint16_t last;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SC_WINDOW_POSITION_UNDEFINED (-0x8000)
|
#define SC_WINDOW_POSITION_UNDEFINED (-0x8000)
|
||||||
|
|
||||||
struct scrcpy_options {
|
struct scrcpy_options
|
||||||
|
{
|
||||||
const char *serial;
|
const char *serial;
|
||||||
const char *crop;
|
const char *crop;
|
||||||
const char *record_filename;
|
const char *record_filename;
|
||||||
|
@ -81,51 +87,31 @@ struct scrcpy_options {
|
||||||
bool forward_key_repeat;
|
bool forward_key_repeat;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SCRCPY_OPTIONS_DEFAULT { \
|
#define SCRCPY_OPTIONS_DEFAULT \
|
||||||
.serial = NULL, \
|
{
|
||||||
.crop = NULL, \
|
/*sadas*/
|
||||||
.record_filename = NULL, \
|
.serial = NULL,
|
||||||
.window_title = NULL, \
|
|
||||||
.push_target = NULL, \
|
/*sadas*/
|
||||||
.render_driver = NULL, \
|
.crop = NULL,
|
||||||
.codec_options = NULL, \
|
.record_filename = NULL,
|
||||||
.log_level = SC_LOG_LEVEL_INFO, \
|
.window_title = NULL,
|
||||||
.record_format = SC_RECORD_FORMAT_AUTO, \
|
.push_target = NULL,
|
||||||
.port_range = { \
|
.render_driver = NULL,
|
||||||
.first = DEFAULT_LOCAL_PORT_RANGE_FIRST, \
|
.codec_options = NULL,
|
||||||
.last = DEFAULT_LOCAL_PORT_RANGE_LAST, \
|
.log_level = SC_LOG_LEVEL_INFO,
|
||||||
}, \
|
.record_format = SC_RECORD_FORMAT_AUTO,
|
||||||
.shortcut_mods = { \
|
.port_range = {
|
||||||
.data = {SC_MOD_LALT, SC_MOD_LSUPER}, \
|
.first = DEFAULT_LOCAL_PORT_RANGE_FIRST,
|
||||||
.count = 2, \
|
.last = DEFAULT_LOCAL_PORT_RANGE_LAST,
|
||||||
}, \
|
},
|
||||||
.max_size = DEFAULT_MAX_SIZE, \
|
.shortcut_mods = {
|
||||||
.bit_rate = DEFAULT_BIT_RATE, \
|
.data = {SC_MOD_LALT, SC_MOD_LSUPER},
|
||||||
.max_fps = 0, \
|
.count = 2,
|
||||||
.lock_video_orientation = DEFAULT_LOCK_VIDEO_ORIENTATION, \
|
},
|
||||||
.rotation = 0, \
|
.max_size = DEFAULT_MAX_SIZE, .bit_rate = DEFAULT_BIT_RATE, .max_fps = 0, .lock_video_orientation = DEFAULT_LOCK_VIDEO_ORIENTATION, .rotation = 0, .window_x = SC_WINDOW_POSITION_UNDEFINED, .window_y = SC_WINDOW_POSITION_UNDEFINED, .window_width = 0, .window_height = 0, .display_id = 0, .show_touches = false, .fullscreen = false, .always_on_top = false, .control = true, .display = true, .turn_screen_off = false, .render_expired_frames = false, .prefer_text = false, .window_borderless = false, .mipmaps = true, .stay_awake = false, .force_adb_forward = false, .disable_screensaver = false, .forward_key_repeat = true,
|
||||||
.window_x = SC_WINDOW_POSITION_UNDEFINED, \
|
|
||||||
.window_y = SC_WINDOW_POSITION_UNDEFINED, \
|
|
||||||
.window_width = 0, \
|
|
||||||
.window_height = 0, \
|
|
||||||
.display_id = 0, \
|
|
||||||
.show_touches = false, \
|
|
||||||
.fullscreen = false, \
|
|
||||||
.always_on_top = false, \
|
|
||||||
.control = true, \
|
|
||||||
.display = true, \
|
|
||||||
.turn_screen_off = false, \
|
|
||||||
.render_expired_frames = false, \
|
|
||||||
.prefer_text = false, \
|
|
||||||
.window_borderless = false, \
|
|
||||||
.mipmaps = true, \
|
|
||||||
.stay_awake = false, \
|
|
||||||
.force_adb_forward = false, \
|
|
||||||
.disable_screensaver = false, \
|
|
||||||
.forward_key_repeat = true, \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool scrcpy(const struct scrcpy_options *options);
|
||||||
scrcpy(const struct scrcpy_options *options);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
BIN
server/scrcpy-server
Normal file
BIN
server/scrcpy-server
Normal file
Binary file not shown.
6
记录.md
Normal file
6
记录.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
想要通过Cmakefilelist构建c/c++项目
|
||||||
|
百度到cmake地址下载后加入环境变量,然后从mingw install manager中下载make、gcc
|
||||||
|
在正确的CMakeLists下,cmake正常运行,没有提示任何错误,make的时候提示缺少分隔符
|
||||||
|
|
||||||
|
|
||||||
|
于是尝试用windows子系统wsl
|
Loading…
Add table
Add a link
Reference in a new issue