From 4367729103ce241e0b343333e2809c276bad292c Mon Sep 17 00:00:00 2001 From: Frederik Kriewitz <frederik@kriewitz.eu> Date: Sun, 12 Apr 2015 10:55:16 +0200 Subject: [PATCH 1/4] restore videoBitRate option --- resources/settings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/settings.xml b/resources/settings.xml index ae2bf36a..545177ab 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -7,6 +7,7 @@ <setting id="https" type="bool" label="30243" visible="true" enable="true" default="false" /> <setting type="sep" /> <setting id="deviceName" type="text" label="30016" default="Kodi" /> + <setting id="videoBitRate" type="enum" label="30160" values="664 Kbps SD|996 Kbps HD|1.3 Mbps HD|2.0 Mbps HD|3.2 Mbps HD|4.7 Mbps HD|6.2 Mbps HD|7.7 Mbps HD|9.2 Mbps HD|10.7 Mbps HD|12.2 Mbps HD|13.7 Mbps HD|15.2 Mbps HD|16.7 Mbps HD|18.2 Mbps HD|20.0 Mbps HD|40.0 Mbps HD|100.0 Mbps HD [default]|1000.0 Mbps HD" default="17" /> <setting id="playFromStream" type="bool" label="30002" visible="true" enable="true" default="false" /> </category> <!-- <category label="Manual sync"> <setting label="Run manual full sync now" type="action" action="RunScript(plugin.video.mbsync, fullsync)" /> <setting label="Run manual incremental sync now" type="action" action="RunScript(plugin.video.mbsync, incrementalsync)" /> <setting label="Reset entire local library" type="action" action="RunScript(plugin.video.mbsync, reset)" /> </category> --> From 3343d2bbdd9cc765dca303e18c6519a59f93edb2 Mon Sep 17 00:00:00 2001 From: Frederik Kriewitz <frederik@kriewitz.eu> Date: Sun, 12 Apr 2015 11:07:04 +0200 Subject: [PATCH 2/4] fix getVideoBitRate default value setting VideoBitrate to > 2147483647 causes a RequestBindingException on the server. --- resources/lib/PlayUtils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/PlayUtils.py b/resources/lib/PlayUtils.py index 8deff44b..0eb711c9 100644 --- a/resources/lib/PlayUtils.py +++ b/resources/lib/PlayUtils.py @@ -144,7 +144,7 @@ class PlayUtils(): elif (videoQuality == "18"): return '1000000' else: - return '10000000' + return '2147483' # max bit rate supported by server (max signed 32bit integer) def fileExists(self, result): path=result.get("Path").encode('utf-8') From 2c7d50e3a6819e84a74511d57caad7e827f2694a Mon Sep 17 00:00:00 2001 From: Frederik Kriewitz <frederik@kriewitz.eu> Date: Sun, 12 Apr 2015 13:13:33 +0200 Subject: [PATCH 3/4] add forceTranscodingCodecs option The Force Transcoding Codecs option can be used to enforce transcoding for specific codecs. It's a coma separated list of codecs which should be transcoded. Example: forceTranscodingCodecs="hevc,vp9,dca" --- resources/settings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/settings.xml b/resources/settings.xml index 545177ab..65c894f0 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -9,6 +9,7 @@ <setting id="deviceName" type="text" label="30016" default="Kodi" /> <setting id="videoBitRate" type="enum" label="30160" values="664 Kbps SD|996 Kbps HD|1.3 Mbps HD|2.0 Mbps HD|3.2 Mbps HD|4.7 Mbps HD|6.2 Mbps HD|7.7 Mbps HD|9.2 Mbps HD|10.7 Mbps HD|12.2 Mbps HD|13.7 Mbps HD|15.2 Mbps HD|16.7 Mbps HD|18.2 Mbps HD|20.0 Mbps HD|40.0 Mbps HD|100.0 Mbps HD [default]|1000.0 Mbps HD" default="17" /> <setting id="playFromStream" type="bool" label="30002" visible="true" enable="true" default="false" /> + <setting id="forceTranscodingCodecs" type="text" label="30244" /> </category> <!-- <category label="Manual sync"> <setting label="Run manual full sync now" type="action" action="RunScript(plugin.video.mbsync, fullsync)" /> <setting label="Run manual incremental sync now" type="action" action="RunScript(plugin.video.mbsync, incrementalsync)" /> <setting label="Reset entire local library" type="action" action="RunScript(plugin.video.mbsync, reset)" /> </category> --> <category label="Sync Options"> From 88ef0da5a609a48da55ced24fbc42d6c12eb3e80 Mon Sep 17 00:00:00 2001 From: Frederik Kriewitz <frederik@kriewitz.eu> Date: Sun, 12 Apr 2015 13:19:42 +0200 Subject: [PATCH 4/4] implementation of the forceTranscodingCodecs option --- resources/language/English/strings.xml | 1 + resources/lib/PlayUtils.py | 12 ++++++++++++ resources/settings.xml | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 990356ac..f4d776b5 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -244,6 +244,7 @@ <string id="30242">Play Count Sync Indication:</string> <string id="30243">Enable HTTPS</string> <string id="30244">Use Season 100 for TV Show Specials (Requires Reset)</string> + <string id="30245">Force Transcoding Codecs</string> <!-- Default views --> <string id="30300">Active</string> diff --git a/resources/lib/PlayUtils.py b/resources/lib/PlayUtils.py index 0eb711c9..e64b7d3d 100644 --- a/resources/lib/PlayUtils.py +++ b/resources/lib/PlayUtils.py @@ -76,6 +76,18 @@ class PlayUtils(): # Works out if we are direct playing or not def isDirectPlay(self, result): + addonSettings = xbmcaddon.Addon(id='plugin.video.emby') + + # check if we should force encoding due to the forceTranscodingCodecs setting + forceTranscodingCodecs = addonSettings.getSetting('forceTranscodingCodecs') + if forceTranscodingCodecs: + forceTranscodingCodecsSet = frozenset(forceTranscodingCodecs.lower().split(',')) + codecs = frozenset([mediaStream.get('Codec', None) for mediaStream in result.get('MediaStreams', [])]) + commonCodecs = forceTranscodingCodecsSet & codecs + #xbmc.log("emby isDirectPlay MediaStreams codecs: %s forceTranscodingCodecs: %s, common: %s" % (codecs, forceTranscodingCodecsSet, commonCodecs)) + if commonCodecs: + return False + if (self.fileExists(result) or (result.get("LocationType") == "FileSystem" and self.isNetworkQualitySufficient(result) == True and self.isLocalPath(result) == False)): return True else: diff --git a/resources/settings.xml b/resources/settings.xml index 65c894f0..df8664ad 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -9,7 +9,7 @@ <setting id="deviceName" type="text" label="30016" default="Kodi" /> <setting id="videoBitRate" type="enum" label="30160" values="664 Kbps SD|996 Kbps HD|1.3 Mbps HD|2.0 Mbps HD|3.2 Mbps HD|4.7 Mbps HD|6.2 Mbps HD|7.7 Mbps HD|9.2 Mbps HD|10.7 Mbps HD|12.2 Mbps HD|13.7 Mbps HD|15.2 Mbps HD|16.7 Mbps HD|18.2 Mbps HD|20.0 Mbps HD|40.0 Mbps HD|100.0 Mbps HD [default]|1000.0 Mbps HD" default="17" /> <setting id="playFromStream" type="bool" label="30002" visible="true" enable="true" default="false" /> - <setting id="forceTranscodingCodecs" type="text" label="30244" /> + <setting id="forceTranscodingCodecs" type="text" label="30245" /> </category> <!-- <category label="Manual sync"> <setting label="Run manual full sync now" type="action" action="RunScript(plugin.video.mbsync, fullsync)" /> <setting label="Run manual incremental sync now" type="action" action="RunScript(plugin.video.mbsync, incrementalsync)" /> <setting label="Reset entire local library" type="action" action="RunScript(plugin.video.mbsync, reset)" /> </category> --> <category label="Sync Options">