Merge pull request #1964 from cewert/maxvideodecoderesolution
Some checks are pending
Automation 🤖 / Project board 📊 (push) Waiting to run
Automation 🤖 / Labeling 🏷️ (push) Waiting to run
build-dev / dev (push) Waiting to run
build-prod / prod (push) Waiting to run
roku-analysis / static (push) Waiting to run

This commit is contained in:
Charles Ewert 2024-10-04 13:15:14 -07:00 committed by GitHub
commit d17a8d921e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 16 deletions

View File

@ -79,6 +79,16 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
end if
session.video.Update(meta)
if isValid(meta.json.MediaSources[0].RunTimeTicks)
if meta.json.MediaSources[0].RunTimeTicks = 0
video.length = 0
else
video.length = meta.json.MediaSources[0].RunTimeTicks / 10000000
end if
end if
video.MaxVideoDecodeResolution = [meta.json.MediaSources[0].MediaStreams[0].Width, meta.json.MediaSources[0].MediaStreams[0].Height]
subtitle_idx = m.top.selectedSubtitleIndex
videotype = LCase(meta.type)
@ -183,6 +193,11 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
end if
video.container = getContainerType(meta)
if video.container = "mp4"
video.content.StreamFormat = "mp4"
else if video.container = "mkv"
video.content.StreamFormat = "mkv"
end if
if not isValid(m.playbackInfo.MediaSources[0])
m.playbackInfo = meta.json

View File

@ -38,28 +38,31 @@ function ItemPostPlaybackInfo(id as string, mediaSourceId = "" as string, audioT
end if
if audioTrackIndex > -1
params.AudioStreamIndex = audioTrackIndex
' force the server to transcode AAC profiles we don't support to MP3 instead of the usual AAC
' TODO: Remove this after server adds support for transcoding AAC from one profile to another
selectedAudioStream = m.global.session.video.json.MediaStreams[audioTrackIndex]
if LCase(selectedAudioStream.Codec) = "aac"
if LCase(selectedAudioStream.Profile) = "main" or LCase(selectedAudioStream.Profile) = "he-aac"
for each rule in deviceProfile.TranscodingProfiles
if rule.Container = "ts" or rule.Container = "mp4"
if rule.AudioCodec = "aac"
rule.AudioCodec = "mp3"
else if rule.AudioCodec.Left(4) = "aac,"
rule.AudioCodec = mid(rule.AudioCodec, 5)
if selectedAudioStream <> invalid
params.AudioStreamIndex = audioTrackIndex
if rule.AudioCodec.Left(3) <> "mp3"
rule.AudioCodec = "mp3," + rule.AudioCodec
' force the server to transcode AAC profiles we don't support to MP3 instead of the usual AAC
' TODO: Remove this after server adds support for transcoding AAC from one profile to another
if LCase(selectedAudioStream.Codec) = "aac"
if LCase(selectedAudioStream.Profile) = "main" or LCase(selectedAudioStream.Profile) = "he-aac"
for each rule in deviceProfile.TranscodingProfiles
if rule.Container = "ts" or rule.Container = "mp4"
if rule.AudioCodec = "aac"
rule.AudioCodec = "mp3"
else if rule.AudioCodec.Left(4) = "aac,"
rule.AudioCodec = mid(rule.AudioCodec, 5)
if rule.AudioCodec.Left(3) <> "mp3"
rule.AudioCodec = "mp3," + rule.AudioCodec
end if
end if
end if
end if
end for
end for
end if
end if
end if
end if