Ignore unknown audio track types

Co-authored-by: AudricV <74829229+AudricV@users.noreply.github.com>
This commit is contained in:
Bnyro 2023-07-16 17:33:37 +02:00
parent 9d25d32bff
commit df4df4fccc
2 changed files with 14 additions and 14 deletions

View File

@ -115,14 +115,18 @@ object DashHelper {
adapSetElement.setAttribute("lang", adapSet.audioLocale)
}
// Only add the Role element if there is a track type set
// This allows distinction between formats marked as original on YouTube and
// formats without track type info set
if (adapSet.audioTrackType != null) {
val roleElement = doc.createElement("Role")
roleElement.setAttribute("schemeIdUri", "urn:mpeg:dash:role:2011")
roleElement.setAttribute(
"value",
getRoleValueFromAudioTrackType(adapSet.audioTrackType)
)
adapSetElement.appendChild(roleElement)
}
val isVideo = adapSet.mimeType.contains("video")
@ -198,11 +202,7 @@ object DashHelper {
return segmentBase
}
private fun getRoleValueFromAudioTrackType(audioTrackType: String?): String {
if (audioTrackType == null) {
return "main"
}
private fun getRoleValueFromAudioTrackType(audioTrackType: String): String {
return when (audioTrackType.lowercase()) {
"descriptive" -> "description"
"dubbed" -> "dub"