mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-07-23 17:31:30 +00:00
update:确保pc端总是发送4个参数
This commit is contained in:
parent
57167ca562
commit
7cc18e853c
3 changed files with 10 additions and 16 deletions
|
@ -146,11 +146,12 @@ bool Server::execute()
|
||||||
args << QString::number(m_maxSize);
|
args << QString::number(m_maxSize);
|
||||||
args << QString::number(m_bitRate);
|
args << QString::number(m_bitRate);
|
||||||
args << (m_tunnelForward ? "true" : "false");
|
args << (m_tunnelForward ? "true" : "false");
|
||||||
if (!m_crop.isEmpty()) {
|
if (m_crop.isEmpty()) {
|
||||||
args << m_crop;
|
args << "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
// adb -s P7C0218510000537 shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 0 8000000 false
|
// adb -s P7C0218510000537 shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 0 8000000 false
|
||||||
|
// mark: crop input format: "width:height:x:y" or - for no crop, for example: "100:200:0:0"
|
||||||
// 这条adb命令是阻塞运行的,m_serverProcess进程不会退出了
|
// 这条adb命令是阻塞运行的,m_serverProcess进程不会退出了
|
||||||
m_serverProcess.execute(m_serial, args);
|
m_serverProcess.execute(m_serial, args);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -98,7 +98,8 @@ VideoForm::VideoForm(const QString& serial, quint16 maxSize, quint32 bitRate,QWi
|
||||||
// support wireless connect, example:
|
// support wireless connect, example:
|
||||||
//m_server->start("192.168.0.174:5555", 27183, m_maxSize, m_bitRate, "");
|
//m_server->start("192.168.0.174:5555", 27183, m_maxSize, m_bitRate, "");
|
||||||
// only one devices, serial can be null
|
// only one devices, serial can be null
|
||||||
m_server->start(m_serial, 27183, m_maxSize, m_bitRate, "");
|
// mark: crop input format: "width:height:x:y" or - for no crop, for example: "100:200:0:0"
|
||||||
|
m_server->start(m_serial, 27183, m_maxSize, m_bitRate, "-");
|
||||||
});
|
});
|
||||||
|
|
||||||
updateShowSize(size());
|
updateShowSize(size());
|
||||||
|
|
|
@ -45,29 +45,21 @@ public final class Server {
|
||||||
|
|
||||||
@SuppressWarnings("checkstyle:MagicNumber")
|
@SuppressWarnings("checkstyle:MagicNumber")
|
||||||
private static Options createOptions(String... args) {
|
private static Options createOptions(String... args) {
|
||||||
|
if (args.length != 4)
|
||||||
|
throw new IllegalArgumentException("Expecting 4 parameters");
|
||||||
|
|
||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
if (args.length < 1) {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
int maxSize = Integer.parseInt(args[0]) & ~7; // multiple of 8
|
int maxSize = Integer.parseInt(args[0]) & ~7; // multiple of 8
|
||||||
options.setMaxSize(maxSize);
|
options.setMaxSize(maxSize);
|
||||||
|
|
||||||
if (args.length < 2) {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
int bitRate = Integer.parseInt(args[1]);
|
int bitRate = Integer.parseInt(args[1]);
|
||||||
options.setBitRate(bitRate);
|
options.setBitRate(bitRate);
|
||||||
|
|
||||||
if (args.length < 3) {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
// use "adb forward" instead of "adb tunnel"? (so the server must listen)
|
// use "adb forward" instead of "adb tunnel"? (so the server must listen)
|
||||||
boolean tunnelForward = Boolean.parseBoolean(args[2]);
|
boolean tunnelForward = Boolean.parseBoolean(args[2]);
|
||||||
options.setTunnelForward(tunnelForward);
|
options.setTunnelForward(tunnelForward);
|
||||||
|
|
||||||
if (args.length < 4) {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
Rect crop = parseCrop(args[3]);
|
Rect crop = parseCrop(args[3]);
|
||||||
options.setCrop(crop);
|
options.setCrop(crop);
|
||||||
|
|
||||||
|
@ -75,7 +67,7 @@ public final class Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Rect parseCrop(String crop) {
|
private static Rect parseCrop(String crop) {
|
||||||
if (crop.isEmpty()) {
|
if ("-".equals(crop)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// input format: "width:height:x:y"
|
// input format: "width:height:x:y"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue