Skip to content

Commit

Permalink
Merge pull request #1468 from cewert/transcode-opus-audio
Browse files Browse the repository at this point in the history
Don't direct play opus audio files + transcode audio to AAC
  • Loading branch information
1hitsong authored Nov 5, 2023
2 parents 01ed047 + 64a21f9 commit 51a455a
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions source/utils/deviceCapabilities.brs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ function GetDirectPlayProfiles() as object
end for
end for

' remove audio codecs not supported as standalone audio files (opus)
' also add aac back to the list so it gets added to the direct play profile
audioCodecs = ["aac", "mp3", "mp2", "pcm", "lpcm", "wav", "ac3", "ac4", "aiff", "wma", "flac", "alac", "aac", "dts", "wmapro", "vorbis", "eac3", "mpg123"]

' check audio codecs with no container
supportedAudio = []
for each audioCodec in audioCodecs
Expand Down Expand Up @@ -368,40 +372,40 @@ function getTranscodingProfiles() as object
end for
end for

' add mp3 to TranscodingProfile for music
' add aac to TranscodingProfile for stereo audio
' NOTE: multichannel aac is not supported. only decode to stereo on some devices
transcodingProfiles.push({
"Container": "mp3",
"Container": "aac",
"Type": "Audio",
"AudioCodec": "mp3",
"AudioCodec": "aac",
"Context": "Streaming",
"Protocol": "http",
"MaxAudioChannels": maxAudioChannels
"MaxAudioChannels": "2"
})
transcodingProfiles.push({
"Container": "mp3",
"Container": "aac",
"Type": "Audio",
"AudioCodec": "mp3",
"AudioCodec": "aac",
"Context": "Static",
"Protocol": "http",
"MaxAudioChannels": maxAudioChannels
"MaxAudioChannels": "2"
})
' add aac to TranscodingProfile for stereo audio
' NOTE: multichannel aac is not supported. only decode to stereo on some devices
' add mp3 to TranscodingProfile for multichannel music
transcodingProfiles.push({
"Container": "ts",
"Container": "mp3",
"Type": "Audio",
"AudioCodec": "aac",
"AudioCodec": "mp3",
"Context": "Streaming",
"Protocol": "http",
"MaxAudioChannels": "2"
"MaxAudioChannels": maxAudioChannels
})
transcodingProfiles.push({
"Container": "ts",
"Container": "mp3",
"Type": "Audio",
"AudioCodec": "aac",
"AudioCodec": "mp3",
"Context": "Static",
"Protocol": "http",
"MaxAudioChannels": "2"
"MaxAudioChannels": maxAudioChannels
})

tsArray = {
Expand Down Expand Up @@ -506,19 +510,22 @@ function getCodecProfiles() as object
if di.CanDecodeAudio({ Codec: audioCodec, ChCnt: audioChannel }).Result
channelSupportFound = true
for each codecType in ["VideoAudio", "Audio"]
codecProfiles.push({
"Type": codecType,
"Codec": audioCodec,
"Conditions": [
{
"Condition": "LessThanEqual",
"Property": "AudioChannels",
"Value": audioChannel,
"IsRequired": true
}
]
})

if audioCodec = "opus" and codecType = "Audio"
' opus audio files not supported by roku
else
codecProfiles.push({
"Type": codecType,
"Codec": audioCodec,
"Conditions": [
{
"Condition": "LessThanEqual",
"Property": "AudioChannels",
"Value": audioChannel,
"IsRequired": true
}
]
})
end if
end for
end if
if channelSupportFound
Expand Down

0 comments on commit 51a455a

Please sign in to comment.