From a6c8db6c2cbc3517e2a3163850c2230bde68057b Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 29 Nov 2022 19:10:19 -0600 Subject: [PATCH] Introduce full range color option --- .../limelight/binding/video/MediaCodecDecoderRenderer.java | 7 ++++++- .../com/limelight/preferences/PreferenceConfiguration.java | 5 +++++ app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/preferences.xml | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/limelight/binding/video/MediaCodecDecoderRenderer.java b/app/src/main/java/com/limelight/binding/video/MediaCodecDecoderRenderer.java index 887f79b0..c6b11cdc 100644 --- a/app/src/main/java/com/limelight/binding/video/MediaCodecDecoderRenderer.java +++ b/app/src/main/java/com/limelight/binding/video/MediaCodecDecoderRenderer.java @@ -344,7 +344,12 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C } public int getPreferredColorRange() { - return MoonBridge.COLOR_RANGE_LIMITED; + if (prefs.fullRange) { + return MoonBridge.COLOR_RANGE_FULL; + } + else { + return MoonBridge.COLOR_RANGE_LIMITED; + } } public void notifyVideoForeground() { diff --git a/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java b/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java index 3e248564..36c26483 100644 --- a/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java +++ b/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java @@ -48,6 +48,7 @@ public class PreferenceConfiguration { private static final String ABSOLUTE_MOUSE_MODE_PREF_STRING = "checkbox_absolute_mouse_mode"; private static final String ENABLE_AUDIO_FX_PREF_STRING = "checkbox_enable_audiofx"; private static final String REDUCE_REFRESH_RATE_PREF_STRING = "checkbox_reduce_refresh_rate"; + private static final String FULL_RANGE_PREF_STRING = "checkbox_full_range"; static final String DEFAULT_RESOLUTION = "1280x720"; static final String DEFAULT_FPS = "60"; @@ -80,6 +81,7 @@ public class PreferenceConfiguration { private static final boolean DEFAULT_ABSOLUTE_MOUSE_MODE = false; private static final boolean DEFAULT_ENABLE_AUDIO_FX = false; private static final boolean DEFAULT_REDUCE_REFRESH_RATE = false; + private static final boolean DEFAULT_FULL_RANGE = false; public static final int FORCE_H265_ON = -1; public static final int AUTOSELECT_H265 = 0; @@ -124,6 +126,7 @@ public class PreferenceConfiguration { public boolean absoluteMouseMode; public boolean enableAudioFx; public boolean reduceRefreshRate; + public boolean fullRange; public static boolean isNativeResolution(int width, int height) { // It's not a native resolution if it matches an existing resolution option @@ -348,6 +351,7 @@ public class PreferenceConfiguration { .remove(VIDEO_FORMAT_PREF_STRING) .remove(ENABLE_HDR_PREF_STRING) .remove(UNLOCK_FPS_STRING) + .remove(FULL_RANGE_PREF_STRING) .apply(); } @@ -505,6 +509,7 @@ public class PreferenceConfiguration { config.absoluteMouseMode = prefs.getBoolean(ABSOLUTE_MOUSE_MODE_PREF_STRING, DEFAULT_ABSOLUTE_MOUSE_MODE); config.enableAudioFx = prefs.getBoolean(ENABLE_AUDIO_FX_PREF_STRING, DEFAULT_ENABLE_AUDIO_FX); config.reduceRefreshRate = prefs.getBoolean(REDUCE_REFRESH_RATE_PREF_STRING, DEFAULT_REDUCE_REFRESH_RATE); + config.fullRange = prefs.getBoolean(FULL_RANGE_PREF_STRING, DEFAULT_FULL_RANGE); return config; } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 600db6ad..0ff9d3dc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -229,6 +229,8 @@ HEVC lowers video bandwidth requirements but requires a newer device Enable HDR (Experimental) Stream HDR when the game and PC GPU support it. HDR requires a GTX 1000 series GPU or later. + Use full (0–255) color range + This may cause video issues or crashes if your device or display doesn\'t properly handle full range content. Show performance stats while streaming Display real-time stream performance information while streaming Show latency message after streaming diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 82424008..7c1becf8 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -211,6 +211,11 @@ android:title="@string/title_enable_hdr" android:summary="@string/summary_enable_hdr" android:defaultValue="false" /> +