mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-21 03:55:05 +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 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,46 +13,49 @@
|
|||
#include "util/log.h"
|
||||
|
||||
static void
|
||||
print_version(void) {
|
||||
print_version(void)
|
||||
{
|
||||
fprintf(stderr, "scrcpy %s\n\n", SCRCPY_VERSION);
|
||||
|
||||
fprintf(stderr, "dependencies:\n");
|
||||
fprintf(stderr, " - SDL %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION,
|
||||
SDL_PATCHLEVEL);
|
||||
SDL_PATCHLEVEL);
|
||||
fprintf(stderr, " - libavcodec %d.%d.%d\n", LIBAVCODEC_VERSION_MAJOR,
|
||||
LIBAVCODEC_VERSION_MINOR,
|
||||
LIBAVCODEC_VERSION_MICRO);
|
||||
LIBAVCODEC_VERSION_MINOR,
|
||||
LIBAVCODEC_VERSION_MICRO);
|
||||
fprintf(stderr, " - libavformat %d.%d.%d\n", LIBAVFORMAT_VERSION_MAJOR,
|
||||
LIBAVFORMAT_VERSION_MINOR,
|
||||
LIBAVFORMAT_VERSION_MICRO);
|
||||
LIBAVFORMAT_VERSION_MINOR,
|
||||
LIBAVFORMAT_VERSION_MICRO);
|
||||
fprintf(stderr, " - libavutil %d.%d.%d\n", LIBAVUTIL_VERSION_MAJOR,
|
||||
LIBAVUTIL_VERSION_MINOR,
|
||||
LIBAVUTIL_VERSION_MICRO);
|
||||
LIBAVUTIL_VERSION_MINOR,
|
||||
LIBAVUTIL_VERSION_MICRO);
|
||||
}
|
||||
|
||||
static SDL_LogPriority
|
||||
convert_log_level_to_sdl(enum sc_log_level level) {
|
||||
switch (level) {
|
||||
case SC_LOG_LEVEL_DEBUG:
|
||||
return SDL_LOG_PRIORITY_DEBUG;
|
||||
case SC_LOG_LEVEL_INFO:
|
||||
return SDL_LOG_PRIORITY_INFO;
|
||||
case SC_LOG_LEVEL_WARN:
|
||||
return SDL_LOG_PRIORITY_WARN;
|
||||
case SC_LOG_LEVEL_ERROR:
|
||||
return SDL_LOG_PRIORITY_ERROR;
|
||||
default:
|
||||
assert(!"unexpected log level");
|
||||
return SDL_LOG_PRIORITY_INFO;
|
||||
convert_log_level_to_sdl(enum sc_log_level level)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case SC_LOG_LEVEL_DEBUG:
|
||||
return SDL_LOG_PRIORITY_DEBUG;
|
||||
case SC_LOG_LEVEL_INFO:
|
||||
return SDL_LOG_PRIORITY_INFO;
|
||||
case SC_LOG_LEVEL_WARN:
|
||||
return SDL_LOG_PRIORITY_WARN;
|
||||
case SC_LOG_LEVEL_ERROR:
|
||||
return SDL_LOG_PRIORITY_ERROR;
|
||||
default:
|
||||
assert(!"unexpected log level");
|
||||
return SDL_LOG_PRIORITY_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
// disable buffering, we want logs immediately
|
||||
// even line buffering (setvbuf() with mode _IOLBF) is not sufficient
|
||||
// 在windows取消打印缓冲
|
||||
setbuf(stdout, NULL);
|
||||
setbuf(stderr, NULL);
|
||||
#endif
|
||||
|
@ -67,30 +70,33 @@ main(int argc, char *argv[]) {
|
|||
args.opts.log_level = SC_LOG_LEVEL_DEBUG;
|
||||
#endif
|
||||
|
||||
if (!scrcpy_parse_args(&args, argc, argv)) {
|
||||
if (!scrcpy_parse_args(&args, argc, argv))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_LogPriority sdl_log = convert_log_level_to_sdl(args.opts.log_level);
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, sdl_log);
|
||||
|
||||
if (args.help) {
|
||||
if (args.help)
|
||||
{
|
||||
scrcpy_print_usage(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args.version) {
|
||||
if (args.version)
|
||||
{
|
||||
print_version();
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOGI("scrcpy " SCRCPY_VERSION " <https://github.com/Genymobile/scrcpy>");
|
||||
|
||||
#ifdef SCRCPY_LAVF_REQUIRES_REGISTER_ALL
|
||||
av_register_all();
|
||||
#endif
|
||||
|
||||
if (avformat_network_init()) {
|
||||
if (avformat_network_init())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -98,8 +104,9 @@ main(int argc, char *argv[]) {
|
|||
|
||||
avformat_network_deinit(); // ignore failure
|
||||
|
||||
#if defined (__WINDOWS__) && ! defined (WINDOWS_NOCONSOLE)
|
||||
if (res != 0) {
|
||||
#if defined(__WINDOWS__) && !defined(WINDOWS_NOCONSOLE)
|
||||
if (res != 0)
|
||||
{
|
||||
fprintf(stderr, "Press any key to continue...\n");
|
||||
getchar();
|
||||
}
|
||||
|
|
|
@ -7,14 +7,16 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
enum sc_log_level {
|
||||
enum sc_log_level
|
||||
{
|
||||
SC_LOG_LEVEL_DEBUG,
|
||||
SC_LOG_LEVEL_INFO,
|
||||
SC_LOG_LEVEL_WARN,
|
||||
SC_LOG_LEVEL_ERROR,
|
||||
};
|
||||
|
||||
enum sc_record_format {
|
||||
enum sc_record_format
|
||||
{
|
||||
SC_RECORD_FORMAT_AUTO,
|
||||
SC_RECORD_FORMAT_MP4,
|
||||
SC_RECORD_FORMAT_MKV,
|
||||
|
@ -22,7 +24,8 @@ enum sc_record_format {
|
|||
|
||||
#define SC_MAX_SHORTCUT_MODS 8
|
||||
|
||||
enum sc_shortcut_mod {
|
||||
enum sc_shortcut_mod
|
||||
{
|
||||
SC_MOD_LCTRL = 1 << 0,
|
||||
SC_MOD_RCTRL = 1 << 1,
|
||||
SC_MOD_LALT = 1 << 2,
|
||||
|
@ -31,19 +34,22 @@ enum sc_shortcut_mod {
|
|||
SC_MOD_RSUPER = 1 << 5,
|
||||
};
|
||||
|
||||
struct sc_shortcut_mods {
|
||||
struct sc_shortcut_mods
|
||||
{
|
||||
unsigned data[SC_MAX_SHORTCUT_MODS];
|
||||
unsigned count;
|
||||
};
|
||||
|
||||
struct sc_port_range {
|
||||
struct sc_port_range
|
||||
{
|
||||
uint16_t first;
|
||||
uint16_t last;
|
||||
};
|
||||
|
||||
#define SC_WINDOW_POSITION_UNDEFINED (-0x8000)
|
||||
|
||||
struct scrcpy_options {
|
||||
struct scrcpy_options
|
||||
{
|
||||
const char *serial;
|
||||
const char *crop;
|
||||
const char *record_filename;
|
||||
|
@ -81,51 +87,31 @@ struct scrcpy_options {
|
|||
bool forward_key_repeat;
|
||||
};
|
||||
|
||||
#define SCRCPY_OPTIONS_DEFAULT { \
|
||||
.serial = NULL, \
|
||||
.crop = NULL, \
|
||||
.record_filename = NULL, \
|
||||
.window_title = NULL, \
|
||||
.push_target = NULL, \
|
||||
.render_driver = NULL, \
|
||||
.codec_options = NULL, \
|
||||
.log_level = SC_LOG_LEVEL_INFO, \
|
||||
.record_format = SC_RECORD_FORMAT_AUTO, \
|
||||
.port_range = { \
|
||||
.first = DEFAULT_LOCAL_PORT_RANGE_FIRST, \
|
||||
.last = DEFAULT_LOCAL_PORT_RANGE_LAST, \
|
||||
}, \
|
||||
.shortcut_mods = { \
|
||||
.data = {SC_MOD_LALT, SC_MOD_LSUPER}, \
|
||||
.count = 2, \
|
||||
}, \
|
||||
.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, \
|
||||
#define SCRCPY_OPTIONS_DEFAULT \
|
||||
{
|
||||
/*sadas*/
|
||||
.serial = NULL,
|
||||
|
||||
/*sadas*/
|
||||
.crop = NULL,
|
||||
.record_filename = NULL,
|
||||
.window_title = NULL,
|
||||
.push_target = NULL,
|
||||
.render_driver = NULL,
|
||||
.codec_options = NULL,
|
||||
.log_level = SC_LOG_LEVEL_INFO,
|
||||
.record_format = SC_RECORD_FORMAT_AUTO,
|
||||
.port_range = {
|
||||
.first = DEFAULT_LOCAL_PORT_RANGE_FIRST,
|
||||
.last = DEFAULT_LOCAL_PORT_RANGE_LAST,
|
||||
},
|
||||
.shortcut_mods = {
|
||||
.data = {SC_MOD_LALT, SC_MOD_LSUPER},
|
||||
.count = 2,
|
||||
},
|
||||
.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,
|
||||
}
|
||||
|
||||
bool
|
||||
scrcpy(const struct scrcpy_options *options);
|
||||
bool scrcpy(const struct scrcpy_options *options);
|
||||
|
||||
#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
Reference in a new issue