From 2c3099e2de13913332f3e0085faf646e19bb976b Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 24 Nov 2021 21:06:02 +0100 Subject: [PATCH] Parse codec options early For consistency with other options, parse the codec options on the server before storing them in the Options instance. --- server/src/main/java/com/genymobile/scrcpy/Options.java | 8 +++++--- server/src/main/java/com/genymobile/scrcpy/Server.java | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Options.java b/server/src/main/java/com/genymobile/scrcpy/Options.java index 74467c7c..20a579ed 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Options.java +++ b/server/src/main/java/com/genymobile/scrcpy/Options.java @@ -2,6 +2,8 @@ package com.genymobile.scrcpy; import android.graphics.Rect; +import java.util.List; + public class Options { private Ln.Level logLevel; private int maxSize; @@ -15,7 +17,7 @@ public class Options { private int displayId; private boolean showTouches; private boolean stayAwake; - private String codecOptions; + private List codecOptions; private String encoderName; private boolean powerOffScreenOnClose; private boolean clipboardAutosync; @@ -116,11 +118,11 @@ public class Options { this.stayAwake = stayAwake; } - public String getCodecOptions() { + public List getCodecOptions() { return codecOptions; } - public void setCodecOptions(String codecOptions) { + public void setCodecOptions(List codecOptions) { this.codecOptions = codecOptions; } diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index 188974ff..bcdaf6bb 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -61,7 +61,7 @@ public final class Server { private static void scrcpy(Options options) throws IOException { Ln.i("Device: " + Build.MANUFACTURER + " " + Build.MODEL + " (Android " + Build.VERSION.RELEASE + ")"); final Device device = new Device(options); - List codecOptions = CodecOption.parse(options.getCodecOptions()); + List codecOptions = options.getCodecOptions(); Thread initThread = startInitThread(options); @@ -204,7 +204,7 @@ public final class Server { boolean stayAwake = Boolean.parseBoolean(args[12]); options.setStayAwake(stayAwake); - String codecOptions = args[13]; + List codecOptions = CodecOption.parse(args[13]); options.setCodecOptions(codecOptions); String encoderName = "-".equals(args[14]) ? null : args[14];