mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
playutils: Always honor manual transcoding bitrates
* Override VideoBitrate option in transcoding url (previously calced in backend) * Use manual AudioBitrate when user has track selection dialog disabled * Fix bad loop-and-remove
This commit is contained in:
parent
e651b66ddc
commit
fea6fc4cf1
1 changed files with 12 additions and 6 deletions
|
@ -241,15 +241,22 @@ class PlayUtils(object):
|
|||
|
||||
if self.item['MediaType'] == 'Video':
|
||||
base, params = source['TranscodingUrl'].split('?')
|
||||
url_parsed = params.split('&')
|
||||
manual_tracks = ''
|
||||
|
||||
# manual bitrate
|
||||
url_parsed = [p for p in url_parsed if 'AudioBitrate' not in p and 'VideoBitrate' not in p]
|
||||
|
||||
if settings('skipDialogTranscode') != "3" and source.get('MediaStreams'):
|
||||
url_parsed = params.split('&')
|
||||
# manual tracks
|
||||
url_parsed = [p for p in url_parsed if 'AudioStreamIndex' not in p and 'SubtitleStreamIndex' not in p]
|
||||
manual_tracks = self.get_audio_subs(source, audio, subtitle)
|
||||
|
||||
for i in url_parsed:
|
||||
if 'AudioStreamIndex' in i or 'AudioBitrate' in i or 'SubtitleStreamIndex' in i: # handle manually
|
||||
url_parsed.remove(i)
|
||||
audio_bitrate = self.get_transcoding_audio_bitrate()
|
||||
video_bitrate = self.get_max_bitrate() - audio_bitrate
|
||||
|
||||
params = "%s%s" % ('&'.join(url_parsed), self.get_audio_subs(source, audio, subtitle))
|
||||
params = "%s%s" % ('&'.join(url_parsed), manual_tracks)
|
||||
params += "&VideoBitrate=%s&AudioBitrate=%s" % (video_bitrate, audio_bitrate)
|
||||
|
||||
video_type = 'live' if source['Protocol'] == 'LiveTV' else 'master'
|
||||
base = base.replace('stream' if 'stream' in base else 'master', video_type, 1)
|
||||
|
@ -643,7 +650,6 @@ class PlayUtils(object):
|
|||
|
||||
self.info['AudioStreamIndex'] = audio_selected
|
||||
prefs += "&AudioStreamIndex=%s" % audio_selected
|
||||
prefs += "&AudioBitrate=%d" % self.get_transcoding_audio_bitrate()
|
||||
|
||||
if subtitle:
|
||||
|
||||
|
|
Loading…
Reference in a new issue