diff --git a/android/app/src/main/java/tv/orbit/classic/BoxDecoders.kt b/android/app/src/main/java/tv/orbit/classic/BoxDecoders.kt index d7e1727f..3738a9c1 100644 --- a/android/app/src/main/java/tv/orbit/classic/BoxDecoders.kt +++ b/android/app/src/main/java/tv/orbit/classic/BoxDecoders.kt @@ -15,14 +15,18 @@ internal fun videoMimeFor(codec: String): String? = when (codec.trim().lowercase "msmpeg4v1", "msmpeg4v2", "msmpeg4v3", "msmpeg4", "div3" -> "video/x-ms-mpeg4" "h263" -> "video/3gpp" "vc1", "wmv3" -> "video/wvc1" + "dolby-vision", "dvhe", "dvh1" -> "video/dolby-vision" else -> null } /** The video format of a media source, if it says. */ internal fun sourceVideoCodec(source: org.json.JSONObject): String? { val streams = source.optJSONArray("MediaStreams") ?: return null - return (0 until minOf(streams.length(), 32)).mapNotNull { streams.optJSONObject(it) } - .firstOrNull { it.optString("Type") == "Video" }?.optString("Codec")?.takeIf { it.isNotBlank() } + val video = (0 until minOf(streams.length(), 32)).mapNotNull { streams.optJSONObject(it) }.firstOrNull { it.optString("Type") == "Video" } ?: return null + // Dolby Vision with no plain picture underneath (profiles 5 and 7) needs a Dolby Vision decoder; profile 8 falls back to + // HEVC on any box (1.0 RC1, 13 November 2026: a profile 7.6 copy of Night of the Comet gave sound and no picture). + if (video.optString("ExtendedVideoSubType").let { it.startsWith("DoviProfile5") || it.startsWith("DoviProfile7") }) return "dolby-vision" + return video.optString("Codec").takeIf { it.isNotBlank() } } /** False only when a source's sound is all tagged as other languages. Untagged sound gets the benefit of the doubt. */ diff --git a/android/app/src/test/java/tv/orbit/classic/RefiledTest.kt b/android/app/src/test/java/tv/orbit/classic/RefiledTest.kt index d870b5ee..a6584786 100644 --- a/android/app/src/test/java/tv/orbit/classic/RefiledTest.kt +++ b/android/app/src/test/java/tv/orbit/classic/RefiledTest.kt @@ -49,3 +49,17 @@ class RefiledTest { assertNull(session.refiledEpisode(gone.copy(type = "Movie"))) } } + +/** 13 November 2026: a Dolby Vision profile 7.6 copy gave sound and no picture; profiles 5 and 7 need a DV decoder. */ +class DolbyVisionCopyTest { + private fun source(sub: String, codec: String = "hevc") = JSONObject().put("MediaStreams", JSONArray().put(JSONObject().put("Type", "Video").put("Codec", codec).put("ExtendedVideoSubType", sub))) + @Test fun dualLayerDolbyVisionNeedsItsOwnDecoder() { + assertEquals("dolby-vision", sourceVideoCodec(source("DoviProfile76"))) + assertEquals("dolby-vision", sourceVideoCodec(source("DoviProfile5"))) + assertEquals("video/dolby-vision", videoMimeFor("dolby-vision")) + // Profile 8 has a plain HEVC picture underneath; HDR10 and SDR are plain HEVC. + assertEquals("hevc", sourceVideoCodec(source("DoviProfile81"))) + assertEquals("hevc", sourceVideoCodec(source("Hdr10"))) + assertEquals("h264", sourceVideoCodec(source("None", "h264"))) + } +}