Merge pull request #244 from neilsb/dynamic-device-capability
Build Device Capability Dynamically
This commit is contained in:
commit
e1d42ca1b4
|
@ -212,7 +212,7 @@ function directPlaySupported(meta as object) as boolean
|
|||
end if
|
||||
streamInfo = { Codec: meta.json.MediaStreams[0].codec }
|
||||
if meta.json.MediaStreams[0].Profile <> invalid and meta.json.MediaStreams[0].Profile.len() > 0 then
|
||||
streamInfo.Profile = meta.json.MediaStreams[0].Profile
|
||||
streamInfo.Profile = LCase(meta.json.MediaStreams[0].Profile)
|
||||
end if
|
||||
if meta.json.MediaSources[0].container <> invalid and meta.json.MediaSources[0].container.len() > 0 then
|
||||
streamInfo.Container = meta.json.MediaSources[0].container
|
||||
|
@ -222,11 +222,30 @@ end function
|
|||
|
||||
function decodeAudioSupported(meta as object) as boolean
|
||||
devinfo = CreateObject("roDeviceInfo")
|
||||
streamInfo = { Codec: meta.json.MediaStreams[1].codec, ChCnt: meta.json.MediaStreams[1].channels }
|
||||
if meta.json.MediaStreams[1].Bitrate <> invalid then
|
||||
streamInfo.BitRate = meta.json.MediaStreams[1].Bitrate
|
||||
codec = meta.json.MediaStreams[1].codec
|
||||
streamInfo = { Codec: codec, ChCnt: meta.json.MediaStreams[1].channels }
|
||||
|
||||
'Check for Passthrough
|
||||
audioDecoders = devinfo.GetAudioDecodeInfo()
|
||||
|
||||
'DTS
|
||||
if (codec = "dts" or codec = "dca") and audioDecoders.doesexist("dts") then
|
||||
return true
|
||||
end if
|
||||
return devinfo.CanDecodeAudio(streamInfo).result
|
||||
|
||||
'DD
|
||||
if codec = "ac3" and audioDecoders.doesexist("ac3") then
|
||||
return true
|
||||
end if
|
||||
|
||||
'DD+
|
||||
if codec = "eac3" and audioDecoders.doesexist("DD+") then
|
||||
return true
|
||||
end if
|
||||
|
||||
'Otherwise check Roku can decode stream and channels
|
||||
canDecode = devinfo.CanDecodeVideo(streamInfo)
|
||||
return canDecode.result
|
||||
end function
|
||||
|
||||
function getContainerType(meta as object) as string
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
'Device Capabilities for Roku.
|
||||
'This may need tweaking or be dynamically created if devices vary
|
||||
'significantly
|
||||
'This will likely need further tweaking
|
||||
|
||||
function getDeviceCapabilities() as object
|
||||
|
||||
|
@ -26,54 +25,11 @@ function getDeviceProfile() as object
|
|||
maxAudioChannels = 6
|
||||
end if
|
||||
|
||||
'Check for Supported Codecs
|
||||
deviceSpecificCodecs = ""
|
||||
if di.CanDecodeVideo({Codec: "hevc"}).Result = true
|
||||
deviceSpecificCodecs = ",h265"
|
||||
end if
|
||||
|
||||
if di.CanDecodeVideo({Codec: "vp9"}).Result = true
|
||||
deviceSpecificCodecs = deviceSpecificCodecs + ",vp9"
|
||||
end if
|
||||
|
||||
|
||||
|
||||
return {
|
||||
"MaxStreamingBitrate": 120000000,
|
||||
"MaxStaticBitrate": 100000000,
|
||||
"MusicStreamingTranscodingBitrate": 192000,
|
||||
"DirectPlayProfiles": [
|
||||
{
|
||||
"Container": "mp4,m4v,mov",
|
||||
"Type": "Video",
|
||||
"VideoCodec": "h264" + deviceSpecificCodecs,
|
||||
"AudioCodec": "aac,opus,flac,vorbis"
|
||||
},
|
||||
{
|
||||
"Container": "mkv,webm",
|
||||
"Type": "Video",
|
||||
"VideoCodec": "h264,vp8" + deviceSpecificCodecs,
|
||||
"AudioCodec": "aac,opus,flac,vorbis"
|
||||
},
|
||||
{
|
||||
"Container": "mp3",
|
||||
"Type": "Audio",
|
||||
"AudioCodec": "mp3"
|
||||
},
|
||||
{
|
||||
"Container": "aac",
|
||||
"Type": "Audio"
|
||||
},
|
||||
{
|
||||
"Container": "m4a",
|
||||
"AudioCodec": "aac",
|
||||
"Type": "Audio"
|
||||
},
|
||||
{
|
||||
"Container": "flac",
|
||||
"Type": "Audio"
|
||||
}
|
||||
],
|
||||
"DirectPlayProfiles": GetDirectPlayProfiles(),
|
||||
"TranscodingProfiles": [
|
||||
{
|
||||
"Container": "aac",
|
||||
|
@ -166,20 +122,106 @@ function getDeviceProfile() as object
|
|||
"Method": "External"
|
||||
},
|
||||
{
|
||||
"Format": "ass",
|
||||
"Format": "srt",
|
||||
"Method": "External"
|
||||
},
|
||||
{
|
||||
"Format": "ssa",
|
||||
"Format": "ttml",
|
||||
"Method": "External"
|
||||
}
|
||||
],
|
||||
"ResponseProfiles": [
|
||||
{
|
||||
"Type": "Video",
|
||||
"Container": "m4v",
|
||||
"MimeType": "video/mp4"
|
||||
}
|
||||
]
|
||||
}
|
||||
end function
|
||||
|
||||
|
||||
function GetDirectPlayProfiles() as object
|
||||
|
||||
mp4Video = "h264"
|
||||
mp4Audio = "mp3,pcm,lpcm,wav"
|
||||
mkvVideo = "h264,vp8"
|
||||
mkvAudio = "mp3,pcm,lpcm,wav"
|
||||
audio = "mp3,pcm,lpcm,wav"
|
||||
|
||||
di = CreateObject("roDeviceInfo")
|
||||
|
||||
'Check for Supported Video Codecs
|
||||
if di.CanDecodeVideo({Codec: "hevc"}).Result = true
|
||||
mp4Video = mp4Video + ",h265"
|
||||
mkvVideo =mkvVideo + ",h265"
|
||||
end if
|
||||
|
||||
if di.CanDecodeVideo({Codec: "vp9"}).Result = true
|
||||
mkvVideo =mkvVideo + ",vp9"
|
||||
end if
|
||||
|
||||
' Check for supported Audio
|
||||
audioDecoders = di.GetAudioDecodeInfo()
|
||||
|
||||
if audioDecoders.doesexist("AC3") then
|
||||
mkvAudio = mkvAudio + ",ac3"
|
||||
mp4Audio = mp4Audio + ",ac3"
|
||||
audio = audio + ",ac3"
|
||||
end if
|
||||
|
||||
if audioDecoders.doesexist("WMA") then
|
||||
audio = audio + ",wma"
|
||||
end if
|
||||
|
||||
if audioDecoders.doesexist("FLAC") then
|
||||
mkvAudio = mkvAudio + ",flac"
|
||||
audio = audio + ",flac"
|
||||
end if
|
||||
|
||||
if audioDecoders.doesexist("ALAC") then
|
||||
mkvAudio = mkvAudio + ",alac"
|
||||
mp4Audio = mp4Audio + ",alac"
|
||||
audio = audio + ",alac"
|
||||
end if
|
||||
|
||||
if audioDecoders.doesexist("AAC") then
|
||||
mkvAudio = mkvAudio + ",aac"
|
||||
mp4Audio = mp4Audio + ",aac"
|
||||
audio = audio + ",aac"
|
||||
end if
|
||||
|
||||
if audioDecoders.doesexist("OPUS") then
|
||||
mkvAudio = mkvAudio + ",opus"
|
||||
end if
|
||||
|
||||
if audioDecoders.doesexist("DTS") then
|
||||
mkvAudio = mkvAudio + ",dts,dca"
|
||||
audio = audio + ",dts,dca"
|
||||
end if
|
||||
|
||||
if audioDecoders.doesexist("WMAPRO") then
|
||||
audio = audio + ",wmapro"
|
||||
end if
|
||||
|
||||
if audioDecoders.doesexist("VORBIS") then
|
||||
mkvAudio = mkvAudio + ",vorbis"
|
||||
end if
|
||||
|
||||
if audioDecoders.doesexist("DD+") then
|
||||
mkvAudio = mkvAudio + ",eac3"
|
||||
end if
|
||||
|
||||
return [
|
||||
{
|
||||
"Container": "mp4,m4v,mov",
|
||||
"Type": "Video",
|
||||
"VideoCodec": mp4Video,
|
||||
"AudioCodec": mp4Audio
|
||||
},
|
||||
{
|
||||
"Container": "mkv,webm",
|
||||
"Type": "Video",
|
||||
"VideoCodec": mkvVideo,
|
||||
"AudioCodec": mkvAudio
|
||||
},
|
||||
{
|
||||
"Container": audio,
|
||||
"Type": "Audio",
|
||||
}
|
||||
]
|
||||
|
||||
end function
|
Loading…
Reference in New Issue
Block a user