Merge pull request #580 from neilsb/handle-missing-media-streams

This commit is contained in:
Neil Burrows 2022-04-29 08:04:02 +01:00 committed by GitHub
commit f70af28352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 10 deletions

View File

@ -101,7 +101,15 @@ sub SetUpVideoOptions(streams)
for i = 0 to streams.Count() - 1
if streams[i].VideoType = "VideoFile"
videos.push({ "Title": streams[i].Name, "Description": tr("Video"), "Selected": m.top.selectedVideoStreamId = streams[i].id, "StreamID": streams[i].id, "video_codec": streams[i].mediaStreams[0].displayTitle })
codec = ""
if streams[i].mediaStreams <> invalid and streams[i].mediaStreams.Count() > 0 then codec = streams[i].mediaStreams[0].displayTitle
videos.push({
"Title": streams[i].Name,
"Description": tr("Video"),
"Selected": m.top.selectedVideoStreamId = streams[i].id,
"StreamID": streams[i].id,
"video_codec": codec
})
end if
end for

View File

@ -30,25 +30,23 @@ sub itemContentChanged()
m.top.findNode("star").visible = false
end if
videoIdx = invalid
audioIdx = invalid
if itemData.MediaStreams <> invalid
videoIdx = invalid
audioIdx = invalid
for i = 0 to itemData.MediaStreams.Count() - 1
if itemData.MediaStreams[i].Type = "Video" and videoIdx = invalid
videoIdx = i
m.top.findNode("video_codec").text = tr("Video") + ": " + itemData.mediaStreams[i].DisplayTitle
else if itemData.MediaStreams[i].Type = "Audio" and audioIdx = invalid
audioIdx = i
m.top.findNode("audio_codec").text = tr("Audio") + ": " + itemData.mediaStreams[i].DisplayTitle
end if
if videoIdx <> invalid and audioIdx <> invalid then exit for
end for
m.top.findNode("video_codec").text = tr("Video") + ": " + itemData.mediaStreams[videoIdx].DisplayTitle
m.top.findNode("audio_codec").text = tr("Audio") + ": " + itemData.mediaStreams[audioIdx].DisplayTitle
m.top.findNode("video_codec").visible = true
m.top.findNode("audio_codec").visible = true
else
m.top.findNode("video_codec").visible = false
m.top.findNode("audio_codec").visible = false
end if
m.top.findNode("video_codec").visible = videoIdx <> invalid
m.top.findNode("audio_codec").visible = audioIdx <> invalid
end sub
function getRuntime() as integer