mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-07-22 17:01:42 +00:00
add parameter "net_args" to enable/disable dynamic args
This commit is contained in:
parent
9833735952
commit
ac219a49d6
2 changed files with 19 additions and 9 deletions
|
@ -79,6 +79,7 @@ public class Options {
|
||||||
private boolean sendFrameMeta = true; // send PTS so that the client may record properly
|
private boolean sendFrameMeta = true; // send PTS so that the client may record properly
|
||||||
private boolean sendDummyByte = true; // write a byte on start to detect connection issues
|
private boolean sendDummyByte = true; // write a byte on start to detect connection issues
|
||||||
private boolean sendCodecMeta = true; // write the codec metadata before the stream
|
private boolean sendCodecMeta = true; // write the codec metadata before the stream
|
||||||
|
private boolean netArgs = false;
|
||||||
|
|
||||||
public Ln.Level getLogLevel() {
|
public Ln.Level getLogLevel() {
|
||||||
return logLevel;
|
return logLevel;
|
||||||
|
@ -288,6 +289,10 @@ public class Options {
|
||||||
return sendCodecMeta;
|
return sendCodecMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getEnableNetworkArgs() {
|
||||||
|
return netArgs;
|
||||||
|
}
|
||||||
|
|
||||||
private void parseKeyValue(String key, String value) {
|
private void parseKeyValue(String key, String value) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "scid":
|
case "scid":
|
||||||
|
@ -492,6 +497,9 @@ public class Options {
|
||||||
this.sendCodecMeta = false;
|
this.sendCodecMeta = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "net_args":
|
||||||
|
this.netArgs = Boolean.parseBoolean(value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Ln.w("Unknown server option: " + key);
|
Ln.w("Unknown server option: " + key);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -95,6 +95,7 @@ public final class Server {
|
||||||
|
|
||||||
DesktopConnection connection = DesktopConnection.open(scid, tunnelForward, video, audio, control, sendDummyByte);
|
DesktopConnection connection = DesktopConnection.open(scid, tunnelForward, video, audio, control, sendDummyByte);
|
||||||
try {
|
try {
|
||||||
|
if (options.getEnableNetworkArgs()) {
|
||||||
Ln.d("Waiting for additional args (JSON) ...");
|
Ln.d("Waiting for additional args (JSON) ...");
|
||||||
String additionalOptions = connection.receiveAdditionalOptions();
|
String additionalOptions = connection.receiveAdditionalOptions();
|
||||||
|
|
||||||
|
@ -106,6 +107,7 @@ public final class Server {
|
||||||
} else {
|
} else {
|
||||||
Ln.d("No additional args received.");
|
Ln.d("No additional args received.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT < AndroidVersions.API_31_ANDROID_12 && options.getVideoSource() == VideoSource.CAMERA) {
|
if (Build.VERSION.SDK_INT < AndroidVersions.API_31_ANDROID_12 && options.getVideoSource() == VideoSource.CAMERA) {
|
||||||
Ln.e("Camera mirroring is not supported before Android 12");
|
Ln.e("Camera mirroring is not supported before Android 12");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue