Skip to content

Commit

Permalink
don't add aac directly to transcode profile when surround sound is su…
Browse files Browse the repository at this point in the history
…pported
  • Loading branch information
cewert committed Sep 28, 2023
1 parent 5408784 commit 9ea0466
Showing 1 changed file with 52 additions and 51 deletions.
103 changes: 52 additions & 51 deletions source/utils/deviceCapabilities.brs
Original file line number Diff line number Diff line change
Expand Up @@ -396,57 +396,10 @@ function getDeviceProfile() as object
"Protocol": "http",
"MaxAudioChannels": maxAudioChannels
})
' add aac to TranscodingProfile for stereo audio
' NOTE: multichannel aac is not supported. only decode to stereo on some devices
deviceProfile.TranscodingProfiles.push({
"Container": "ts",
"Type": "Audio",
"AudioCodec": "aac",
"Context": "Streaming",
"Protocol": "http",
"MaxAudioChannels": "2"
})
deviceProfile.TranscodingProfiles.push({
"Container": "ts",
"Type": "Audio",
"AudioCodec": "aac",
"Context": "Static",
"Protocol": "http",
"MaxAudioChannels": "2"
})

tsArray = {
"Container": "ts",
"Context": "Streaming",
"Protocol": "hls",
"Type": "Video",
"AudioCodec": tsAudioCodecs,
"VideoCodec": tsVideoCodecs,
"MaxAudioChannels": maxAudioChannels,
"MinSegments": 1,
"BreakOnNonKeyFrames": false
}
mp4Array = {
"Container": "mp4",
"Context": "Streaming",
"Protocol": "hls",
"Type": "Video",
"AudioCodec": mp4AudioCodecs,
"VideoCodec": mp4VideoCodecs,
"MaxAudioChannels": maxAudioChannels,
"MinSegments": 1,
"BreakOnNonKeyFrames": false
}

' apply max res to transcoding profile
if maxResSetting <> "off"
tsArray.Conditions = [maxVideoHeightArray, maxVideoWidthArray]
mp4Array.Conditions = [maxVideoHeightArray, maxVideoWidthArray]
end if

' surround sound
if surroundSoundCodec <> invalid
' add preferred surround sound codec to TranscodingProfile
' set preferred audio codec for transcoding
if isValid(surroundSoundCodec)
' use preferred surround sound codec
deviceProfile.TranscodingProfiles.push({
"Container": surroundSoundCodec,
"Type": "Audio",
Expand All @@ -464,7 +417,7 @@ function getDeviceProfile() as object
"MaxAudioChannels": maxAudioChannels
})

' put codec in front of AudioCodec string
' put preferred surround sound codec in the front of AudioCodec strings
if tsArray.AudioCodec = ""
tsArray.AudioCodec = surroundSoundCodec
else
Expand All @@ -476,6 +429,54 @@ function getDeviceProfile() as object
else
mp4Array.AudioCodec = surroundSoundCodec + "," + mp4Array.AudioCodec
end if
else
' add aac for stereo audio.
' stereo aac is supported on all devices
deviceProfile.TranscodingProfiles.push({
"Container": "ts",
"Type": "Audio",
"AudioCodec": "aac",
"Context": "Streaming",
"Protocol": "http",
"MaxAudioChannels": "2"
})
deviceProfile.TranscodingProfiles.push({
"Container": "ts",
"Type": "Audio",
"AudioCodec": "aac",
"Context": "Static",
"Protocol": "http",
"MaxAudioChannels": "2"
})
end if

tsArray = {
"Container": "ts",
"Context": "Streaming",
"Protocol": "hls",
"Type": "Video",
"AudioCodec": tsAudioCodecs,
"VideoCodec": tsVideoCodecs,
"MaxAudioChannels": maxAudioChannels,
"MinSegments": 1,
"BreakOnNonKeyFrames": false
}
mp4Array = {
"Container": "mp4",
"Context": "Streaming",
"Protocol": "hls",
"Type": "Video",
"AudioCodec": mp4AudioCodecs,
"VideoCodec": mp4VideoCodecs,
"MaxAudioChannels": maxAudioChannels,
"MinSegments": 1,
"BreakOnNonKeyFrames": false
}

' apply max res to transcoding profile
if maxResSetting <> "off"
tsArray.Conditions = [maxVideoHeightArray, maxVideoWidthArray]
mp4Array.Conditions = [maxVideoHeightArray, maxVideoWidthArray]
end if

deviceProfile.TranscodingProfiles.push(tsArray)
Expand Down

0 comments on commit 9ea0466

Please sign in to comment.