Skip to content

Commit

Permalink
update to scrcpy v2.4 (debugging)
Browse files Browse the repository at this point in the history
  • Loading branch information
k23223 authored and leng-yue committed Jun 7, 2024
1 parent f37c8b1 commit 9555567
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
5 changes: 3 additions & 2 deletions scrcpy/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def text(self, text: str) -> bytes:

@inject(const.TYPE_INJECT_TOUCH_EVENT)
def touch(
self, x: int, y: int, action: int = const.ACTION_DOWN, touch_id: int = -1
self, x: int, y: int, action: int = const.ACTION_DOWN, touch_id: int = 0x1234567887654321
) -> bytes:
"""
Touch screen
Expand All @@ -74,7 +74,7 @@ def touch(
"""
x, y = max(x, 0), max(y, 0)
return struct.pack(
">BqiiHHHi",
">BqiiHHHii",
action,
touch_id,
int(x),
Expand All @@ -83,6 +83,7 @@ def touch(
int(self.parent.resolution[1]),
0xFFFF,
1,
1,
)

@inject(const.TYPE_INJECT_SCROLL_EVENT)
Expand Down
29 changes: 13 additions & 16 deletions scrcpy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,19 @@ def __deploy_server(self) -> None:
"app_process",
"/",
"com.genymobile.scrcpy.Server",
"1.20", # Scrcpy server version
"info", # Log level: info, verbose...
f"{self.max_width}", # Max screen width (long side)
f"{self.bitrate}", # Bitrate of video
f"{self.max_fps}", # Max frame per second
f"{self.lock_screen_orientation}", # Lock screen orientation: LOCK_SCREEN_ORIENTATION
"true", # Tunnel forward
"-", # Crop screen
"false", # Send frame rate to client
"true", # Control enabled
"0", # Display id
"false", # Show touches
"true" if self.stay_awake else "false", # Stay awake
"-", # Codec (video encoding) options
self.encoder_name or "-", # Encoder name
"false", # Power off screen after server closed
"2.4", # Scrcpy server version
"log_level=info",
f"max_size={self.max_width}",
f"max_fps={self.max_fps}",
f"video_bit_rate={self.bitrate}",
"tunnel_forward=true",
"send_frame_meta=false",
"control=true",
"audio=false",
"show_touches=false",
"stay_awake=false",
"power_off_on_close=false",
"clipboard_autosync=false"
]

self.__server_stream: AdbConnection = self.device.shell(
Expand Down
Binary file modified scrcpy/scrcpy-server.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion scrcpy_ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import scrcpy

from .ui_main import Ui_MainWindow
from ui_main import Ui_MainWindow

if not QApplication.instance():
app = QApplication([])
Expand Down Expand Up @@ -40,6 +40,7 @@ def __init__(
flip=self.ui.flip.isChecked(),
bitrate=1000000000,
encoder_name=encoder_name,
max_fps=60
)
self.client.add_listener(scrcpy.EVENT_INIT, self.on_init)
self.client.add_listener(scrcpy.EVENT_FRAME, self.on_frame)
Expand Down

0 comments on commit 9555567

Please sign in to comment.