From 6acb0e4f0e2f28beaaa892a4362f103a0a5730f1 Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Wed, 22 Jul 2020 20:30:13 +0100 Subject: [PATCH] Use CanDecodeAudio() instead of depreciated GetAudioDecodeInfo() --- source/VideoPlayer.brs | 18 ------------------ source/utils/deviceCapabilities.brs | 26 ++++++++++++-------------- 2 files changed, 12 insertions(+), 32 deletions(-) diff --git a/source/VideoPlayer.brs b/source/VideoPlayer.brs index 441a3c06..167fd7bf 100644 --- a/source/VideoPlayer.brs +++ b/source/VideoPlayer.brs @@ -229,24 +229,6 @@ function decodeAudioSupported(meta as object) as boolean 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 - - '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 diff --git a/source/utils/deviceCapabilities.brs b/source/utils/deviceCapabilities.brs index 849b4300..a167a09a 100644 --- a/source/utils/deviceCapabilities.brs +++ b/source/utils/deviceCapabilities.brs @@ -155,53 +155,51 @@ function GetDirectPlayProfiles() as object end if ' Check for supported Audio - audioDecoders = di.GetAudioDecodeInfo() - - if audioDecoders.doesexist("AC3") then + if di.CanDecodeAudio({ Codec: "ac3"}).result then mkvAudio = mkvAudio + ",ac3" mp4Audio = mp4Audio + ",ac3" audio = audio + ",ac3" end if - if audioDecoders.doesexist("WMA") then + if di.CanDecodeAudio({ Codec: "wma"}).result then audio = audio + ",wma" end if - if audioDecoders.doesexist("FLAC") then + if di.CanDecodeAudio({ Codec: "flac"}).result then mkvAudio = mkvAudio + ",flac" audio = audio + ",flac" end if - if audioDecoders.doesexist("ALAC") then + if di.CanDecodeAudio({ Codec: "alac"}).result then mkvAudio = mkvAudio + ",alac" mp4Audio = mp4Audio + ",alac" audio = audio + ",alac" end if - if audioDecoders.doesexist("AAC") then + if di.CanDecodeAudio({ Codec: "aac"}).result then mkvAudio = mkvAudio + ",aac" mp4Audio = mp4Audio + ",aac" audio = audio + ",aac" end if - if audioDecoders.doesexist("OPUS") then + if di.CanDecodeAudio({ Codec: "opus"}).result then mkvAudio = mkvAudio + ",opus" end if - if audioDecoders.doesexist("DTS") then - mkvAudio = mkvAudio + ",dts,dca" - audio = audio + ",dts,dca" + if di.CanDecodeAudio({ Codec: "dts"}).result then + mkvAudio = mkvAudio + ",dts" + audio = audio + ",dts" end if - if audioDecoders.doesexist("WMAPRO") then + if di.CanDecodeAudio({ Codec: "wmapro"}).result then audio = audio + ",wmapro" end if - if audioDecoders.doesexist("VORBIS") then + if di.CanDecodeAudio({ Codec: "vorbis"}).result then mkvAudio = mkvAudio + ",vorbis" end if - if audioDecoders.doesexist("DD+") then + if di.CanDecodeAudio({ Codec: "eac3"}).result then mkvAudio = mkvAudio + ",eac3" end if