-
-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changing codec-profile -> codec-options
- Loading branch information
Tzah Mazuz
committed
Apr 17, 2020
1 parent
eaef1c1
commit c265d63
Showing
5 changed files
with
86 additions
and
25 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
server/src/main/java/com/genymobile/scrcpy/CodecOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.genymobile.scrcpy; | ||
|
||
import java.util.HashMap; | ||
|
||
public class CodecOptions { | ||
static final String PROFILE_OPTION = "profile"; | ||
static final String LEVEL_OPTION = "level"; | ||
|
||
private HashMap<String, String> options; | ||
|
||
CodecOptions(HashMap<String, String> options) { | ||
this.options = options; | ||
} | ||
|
||
Object parseValue(String profileOption) { | ||
String value = options.get(profileOption); | ||
switch (profileOption) { | ||
case PROFILE_OPTION: | ||
case LEVEL_OPTION: | ||
return NumberUtils.tryParseInt(value); | ||
default: | ||
return null; | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
server/src/main/java/com/genymobile/scrcpy/NumberUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.genymobile.scrcpy; | ||
|
||
public class NumberUtils { | ||
|
||
public static int tryParseInt(final String str) { | ||
return tryParseInt(str, 0); | ||
} | ||
|
||
public static int tryParseInt(final String str, int defaultValue) { | ||
try { | ||
return Integer.parseInt(str); | ||
} catch (NumberFormatException e) { | ||
return defaultValue; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters