From 9c9e448a8cbca7273b4836070877dd3a34e07520 Mon Sep 17 00:00:00 2001
From: MoojMidge <56883549+MoojMidge@users.noreply.github.com>
Date: Thu, 18 Apr 2024 02:37:34 +1000
Subject: [PATCH] Re-enable Opus audio by default, but only use it with Kodi
v21+
- Closes #537
- Underlying issue fixed by xbmc/xbmc#24748
---
.../kodion/context/xbmc/xbmc_context.py | 4 ++--
.../youtube/helper/yt_setup_wizard.py | 14 +++++++-------
resources/settings.xml | 3 +--
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py b/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
index ea3403aba..d22419e23 100644
--- a/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
+++ b/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
@@ -610,8 +610,8 @@ def use_inputstream_adaptive(self):
'ttml': loose_version('20.0.0'),
# audio codecs
'vorbis': loose_version('2.3.14'),
- # unknown when Opus audio support was implemented
- 'opus': loose_version('19.0.0'),
+ # Opus audio enabled in Kodi v21+ which fixes stalls after seek
+ 'opus': loose_version('21.0.0'),
'mp4a': True,
'ac-3': loose_version('2.1.15'),
'ec-3': loose_version('2.1.15'),
diff --git a/resources/lib/youtube_plugin/youtube/helper/yt_setup_wizard.py b/resources/lib/youtube_plugin/youtube/helper/yt_setup_wizard.py
index a7fbe306e..77422f836 100644
--- a/resources/lib/youtube_plugin/youtube/helper/yt_setup_wizard.py
+++ b/resources/lib/youtube_plugin/youtube/helper/yt_setup_wizard.py
@@ -373,7 +373,7 @@ def process_performance_settings(_provider, context, step, steps):
},
'1080p30_avc': {
'max_resolution': 4, # 1080p
- 'stream_features': ('avc1', 'vorbis', 'mp4a', 'filter'),
+ 'stream_features': ('avc1', 'vorbis', 'opus', 'mp4a', 'filter'),
'num_items': 10,
'settings': (
(settings.client_selection, (2,)),
@@ -381,32 +381,32 @@ def process_performance_settings(_provider, context, step, steps):
},
'1080p30': {
'max_resolution': 4, # 1080p
- 'stream_features': ('avc1', 'vp9', 'vorbis', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
+ 'stream_features': ('avc1', 'vp9', 'vorbis', 'opus', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
'num_items': 20,
},
'1080p60': {
'max_resolution': 4, # 1080p
- 'stream_features': ('avc1', 'vp9', 'hfr', 'vorbis', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
+ 'stream_features': ('avc1', 'vp9', 'hfr', 'vorbis', 'opus', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
'num_items': 30,
},
'4k30': {
'max_resolution': 6, # 4k
- 'stream_features': ('avc1', 'vp9', 'hdr', 'hfr', 'no_hfr_max', 'vorbis', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
+ 'stream_features': ('avc1', 'vp9', 'hdr', 'hfr', 'no_hfr_max', 'vorbis', 'opus', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
'num_items': 50,
},
'4k60': {
'max_resolution': 6, # 4k
- 'stream_features': ('avc1', 'vp9', 'hdr', 'hfr', 'vorbis', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
+ 'stream_features': ('avc1', 'vp9', 'hdr', 'hfr', 'vorbis', 'opus', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
'num_items': 50,
},
'4k60_av1': {
'max_resolution': 6, # 4k
- 'stream_features': ('avc1', 'vp9', 'av01', 'hdr', 'hfr', 'vorbis', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
+ 'stream_features': ('avc1', 'vp9', 'av01', 'hdr', 'hfr', 'vorbis', 'opus', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
'num_items': 50,
},
'max': {
'max_resolution': 7, # 8k
- 'stream_features': ('avc1', 'vp9', 'av01', 'hdr', 'hfr', 'vorbis', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
+ 'stream_features': ('avc1', 'vp9', 'av01', 'hdr', 'hfr', 'vorbis', 'opus', 'mp4a', 'ssa', 'ac-3', 'ec-3', 'dts', 'filter'),
'num_items': 50,
},
}
diff --git a/resources/settings.xml b/resources/settings.xml
index c2a28f30d..8c250954a 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -115,12 +115,11 @@
0
- avc1,vp9,av01,hdr,hfr,vorbis,mp4a,ssa,ac-3,ec-3,dts,filter
+ avc1,vp9,av01,hdr,hfr,vorbis,opus,mp4a,ssa,ac-3,ec-3,dts,filter