[Android] Improve the resolution shown in the video list

Nicolas Pomepuy git at videolan.org
Thu Dec 15 07:46:02 UTC 2022


vlc-android | branch: refs/tags/3.5.4-beta01-test3 | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Dec 12 10:33:11 2022 +0100| [7b2a0aa0af5809121e27d0a72def20d96a4936f6] | committer: Duncan McNamara

Improve the resolution shown in the video list

Fixes #2797

> https://code.videolan.org/videolan/vlc-android/commit/7b2a0aa0af5809121e27d0a72def20d96a4936f6
---

 .../vlc-android/src/org/videolan/vlc/util/Kextensions.kt      | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/util/Kextensions.kt b/application/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
index d8d80636f4..58cc57d91b 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
@@ -373,12 +373,13 @@ fun generateResolutionClass(width: Int, height: Int): String? = if (width <= 0 |
     null
 } else {
     val realHeight = min(height, width)
+    val realWidth = max(height, width)
     when {
-        realHeight >= 4320 -> "8K"
-        realHeight >= 2160 -> "4K"
-        realHeight >= 1440 -> "1440p"
-        realHeight >= 1080 -> "1080p"
-        realHeight >= 720 -> "720p"
+        realHeight >= 4320 || realWidth >= 4320.0 * (16.0 / 9.0) -> "8K"
+        realHeight >= 2160 || realWidth >= 2160.0 * (16.0 / 9.0) -> "4K"
+        realHeight >= 1440 || realWidth >= 1440.0 * (16.0 / 9.0) -> "1440p"
+        realHeight >= 1080 || realWidth >= 1080.0 * (16.0 / 9.0) -> "1080p"
+        realHeight >= 720 || realWidth >= 720.0 * (16.0 / 9.0) -> "720p"
         else -> "SD"
     }
 }



More information about the Android mailing list