Add server option send_device_meta
Similar to send_device_frame, this option allows to disable sending the device name and size on start. This is only useful when using the scrcpy-server alone to get a raw H.264 stream, without using the scrcpy client. PR #2971 <https://github.com/Genymobile/scrcpy/pull/2971>
This commit is contained in:
parent
6b21f4ae13
commit
3ba32c2a0d
2 changed files with 17 additions and 2 deletions
|
@ -23,6 +23,7 @@ public class Options {
|
|||
private boolean downsizeOnError = true;
|
||||
|
||||
// Options not used by the scrcpy client, but useful to use scrcpy-server directly
|
||||
private boolean sendDeviceMeta = true; // send device name and size
|
||||
private boolean sendFrameMeta = true; // send PTS so that the client may record properly
|
||||
|
||||
public Ln.Level getLogLevel() {
|
||||
|
@ -153,6 +154,14 @@ public class Options {
|
|||
this.downsizeOnError = downsizeOnError;
|
||||
}
|
||||
|
||||
public boolean getSendDeviceMeta() {
|
||||
return sendDeviceMeta;
|
||||
}
|
||||
|
||||
public void setSendDeviceMeta(boolean sendDeviceMeta) {
|
||||
this.sendDeviceMeta = sendDeviceMeta;
|
||||
}
|
||||
|
||||
public boolean getSendFrameMeta() {
|
||||
return sendFrameMeta;
|
||||
}
|
||||
|
|
|
@ -68,8 +68,10 @@ public final class Server {
|
|||
boolean control = options.getControl();
|
||||
|
||||
try (DesktopConnection connection = DesktopConnection.open(tunnelForward, control)) {
|
||||
Size videoSize = device.getScreenInfo().getVideoSize();
|
||||
connection.sendDeviceMeta(Device.getDeviceName(), videoSize.getWidth(), videoSize.getHeight());
|
||||
if (options.getSendDeviceMeta()) {
|
||||
Size videoSize = device.getScreenInfo().getVideoSize();
|
||||
connection.sendDeviceMeta(Device.getDeviceName(), videoSize.getWidth(), videoSize.getHeight());
|
||||
}
|
||||
ScreenEncoder screenEncoder = new ScreenEncoder(options.getSendFrameMeta(), options.getBitRate(), options.getMaxFps(), codecOptions,
|
||||
options.getEncoderName(), options.getDownsizeOnError());
|
||||
|
||||
|
@ -238,6 +240,10 @@ public final class Server {
|
|||
boolean downsizeOnError = Boolean.parseBoolean(value);
|
||||
options.setDownsizeOnError(downsizeOnError);
|
||||
break;
|
||||
case "send_device_meta":
|
||||
boolean sendDeviceMeta = Boolean.parseBoolean(value);
|
||||
options.setSendDeviceMeta(sendDeviceMeta);
|
||||
break;
|
||||
case "send_frame_meta":
|
||||
boolean sendFrameMeta = Boolean.parseBoolean(value);
|
||||
options.setSendFrameMeta(sendFrameMeta);
|
||||
|
|
Loading…
Reference in a new issue