diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index 5d214508a3..ba9c3c79e8 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -222,7 +222,7 @@ protected void onCreate(Bundle savedInstanceState) { // Enter landscape unless we're on a square screen setPreferredOrientationForCurrentDisplay(); - if (prefConfig.stretchVideo || shouldIgnoreInsetsForResolution(prefConfig.width, prefConfig.height)) { + if (prefConfig.stretchVideo || prefConfig.zoomVideo || shouldIgnoreInsetsForResolution(prefConfig.width, prefConfig.height)) { // Allow the activity to layout under notches if the fill-screen option // was turned on by the user or it's a full-screen native resolution if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { @@ -943,7 +943,7 @@ else if (!isRefreshRateGoodMatch(candidate.getRefreshRate())) { } } - if (prefConfig.stretchVideo || aspectRatioMatch) { + if (prefConfig.stretchVideo || prefConfig.zoomVideo || aspectRatioMatch) { // Set the surface to the size of the video streamView.getHolder().setFixedSize(prefConfig.width, prefConfig.height); } 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 d24ec0dc72..f42ca78a52 100644 --- a/app/src/main/java/com/limelight/binding/video/MediaCodecDecoderRenderer.java +++ b/app/src/main/java/com/limelight/binding/video/MediaCodecDecoderRenderer.java @@ -553,7 +553,13 @@ else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { LimeLog.info("Input format: "+inputFormat); } - videoDecoder.setVideoScalingMode(MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT); + // Use crop-to-fit when zoom to fill is enabled, otherwise scale to fit + if (prefs != null && prefs.zoomVideo && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + videoDecoder.setVideoScalingMode(MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING); + } + else { + videoDecoder.setVideoScalingMode(MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT); + } // Start the decoder videoDecoder.start(); diff --git a/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java b/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java index 8ed01e3610..648b2814fd 100644 --- a/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java +++ b/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java @@ -32,6 +32,7 @@ public enum AnalogStickForScrolling { private static final String BITRATE_PREF_OLD_STRING = "seekbar_bitrate"; private static final String STRETCH_PREF_STRING = "checkbox_stretch_video"; private static final String SOPS_PREF_STRING = "checkbox_enable_sops"; + private static final String ZOOM_PREF_STRING = "checkbox_zoom_video"; private static final String DISABLE_TOASTS_PREF_STRING = "checkbox_disable_warnings"; private static final String HOST_AUDIO_PREF_STRING = "checkbox_host_audio"; private static final String DEADZONE_PREF_STRING = "seekbar_deadzone"; @@ -127,7 +128,7 @@ public enum AnalogStickForScrolling { public FormatOption videoFormat; public int deadzonePercentage; public int oscOpacity; - public boolean stretchVideo, enableSops, playHostAudio, disableWarnings; + public boolean stretchVideo, zoomVideo, enableSops, playHostAudio, disableWarnings; public String language; public boolean smallIconMode, multiController, usbDriver, flipFaceButtons; public boolean onscreenController; @@ -574,6 +575,7 @@ else if (audioConfig.equals("51")) { config.disableWarnings = prefs.getBoolean(DISABLE_TOASTS_PREF_STRING, DEFAULT_DISABLE_TOASTS); config.enableSops = prefs.getBoolean(SOPS_PREF_STRING, DEFAULT_SOPS); config.stretchVideo = prefs.getBoolean(STRETCH_PREF_STRING, DEFAULT_STRETCH); + config.zoomVideo = prefs.getBoolean(ZOOM_PREF_STRING, false); config.playHostAudio = prefs.getBoolean(HOST_AUDIO_PREF_STRING, DEFAULT_HOST_AUDIO); config.smallIconMode = prefs.getBoolean(SMALL_ICONS_PREF_STRING, getDefaultSmallMode(context)); config.multiController = prefs.getBoolean(MULTI_CONTROLLER_PREF_STRING, DEFAULT_MULTI_CONTROLLER); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9cc2215aaa..a2f7d24c2e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -155,6 +155,7 @@ Increase for better image quality. Decrease to improve performance on slower connections. Mbps Stretch video to full-screen + Zoom video to fill Native Native Full-Screen (Landscape) diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 5b09082b35..116b4fe7d9 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -40,6 +40,10 @@ android:key="checkbox_stretch_video" android:title="@string/title_checkbox_stretch_video" android:defaultValue="false" /> +