Skip Dolby Vision profile 5 and 7 copies the box can't decode
13 Nov: the re-filed copy of Night of the Comet chosen on After Dark was a 4K Dolby Vision profile 7.6 file; the box has no DV decoder, so sound and no picture. sourceVideoCodec now reports profiles 5 and 7 as dolby-vision, so copies needing a DV decoder are passed over; profile 8 (HEVC underneath), HDR10 and SDR are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user