assistd / scrcpy

Apache License 2.0
0 stars 1 forks source link

超同显示客户端实现 #5

Open prife opened 1 year ago

prife commented 1 year ago

窗口起始坐标的一些测试结论

macOS

prife commented 1 year ago

https://github.com/assistd/scrcpy/commit/b2043558c26b3bddff987a3d363a2e430b15539c 可以同时支持Android和iOS,其连接的过程与webrtc-streamer(不带重试版本)连assistd时一样。

设计

scrcpy pc client后续简称client。在udt-sa(sa系super assistant 超级同步助手缩写)模式下,组件分工如下:

  1. client不操作adb或者goios,仅负责执行投屏+触摸
  2. sa-agent与assistd/wa-automator-server一样,操控adb/go-ios,准备执行环境

Android测试

./push.sh
./x/app/scrcpy -A --udt-sa-port 21345

iOS测试

  1. 手动启动scrcpy-Runner
  2. tidevice建立端口映射
    • tidevice relay 21343 21343
    • tidevice relay 21344 21344
  3. ./x/app/scrcpy -A
prife commented 1 year ago

buiLd2.patch

编译

ninja -Cx
prife commented 1 year ago
diff --git a/app/meson.build b/app/meson.build
index a86c1dee..413ab698 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -93,12 +93,15 @@ crossbuild_windows = meson.is_cross_build() and host_machine.system() == 'window

 if not crossbuild_windows

+    sdldep = dependency('sdl2', version: '>= 2.0.5')
+    sdldep_include = sdldep.get_variable(pkgconfig : 'includedir')
+
     # native build
     dependencies = [
         dependency('libavformat', version: '>= 57.33'),
         dependency('libavcodec', version: '>= 57.37'),
         dependency('libavutil'),
-        dependency('sdl2', version: '>= 2.0.5'),
+        sdldep
     ]

     if v4l2_support
@@ -216,7 +219,7 @@ conf.set('HAVE_USB', usb_support)

 configure_file(configuration: conf, output: 'config.h')

-src_dir = include_directories('src')
+src_dir = include_directories('src', sdldep_include)

 executable('scrcpy', src,
            dependencies: dependencies,
diff --git a/app/src/input_manager.c b/app/src/input_manager.c
index bba3665c..08fed704 100644
--- a/app/src/input_manager.c
+++ b/app/src/input_manager.c
@@ -645,7 +645,8 @@ sc_input_manager_process_mouse_button(struct sc_input_manager *im,
                 return;
             }
             if (event->button == SDL_BUTTON_RIGHT) {
-                press_back_or_turn_screen_on(controller, action);
+                // press_back_or_turn_screen_on(controller, action);
+                action_home(controller, action);
                 return;
             }
             if (event->button == SDL_BUTTON_MIDDLE) {
diff --git a/app/src/ios.c b/app/src/ios.c
index 0216ddd6..f60fe1ed 100644
--- a/app/src/ios.c
+++ b/app/src/ios.c
@@ -58,7 +58,7 @@ connect_to_server(struct sc_server *server, enum udt_conn_type conn_type, uint32
     }

 // enable with assistd
-#if 1
+#if 0
     // <length: 4-byte> <json string>
     char buf[128];
     int _len = snprintf(&buf[4], sizeof(buf)-4, "{\"serial\":\"%s\",\"conn\":\"%s\"}",
diff --git a/push.sh b/push.sh
index fe580c03..ed32b941 100755
--- a/push.sh
+++ b/push.sh
@@ -1,5 +1,5 @@
 #!/bin/bash

 adb push scrcpy-server-v1.24 /data/local/tmp/scrcpy-server.jar
-adb forward tcp:21344 localabstract:scrcpy
+adb forward tcp:21345 localabstract:scrcpy
 adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 1.24 log_level=info bit_rate=8000000 tunnel_forward=true control=false