Skip to content

Commit

Permalink
Improve handling of HLS ISA stream selection
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed Aug 3, 2024
1 parent d6192e4 commit 0c41d2a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
MPD_STREAM_SELECT = 'kodion.mpd.stream.select' # (int)
MPD_QUALITY_SELECTION = 'kodion.mpd.quality.selection' # (int)
MPD_STREAM_FEATURES = 'kodion.mpd.stream.features' # (list[str])
VIDEO_STREAM_SELECT = 'kodion.video.stream.select' # (int)
VIDEO_QUALITY_ASK = 'kodion.video.quality.ask' # (bool)
VIDEO_QUALITY = 'kodion.video.quality' # (int)
AUDIO_ONLY = 'kodion.audio_only' # (bool)
Expand Down
12 changes: 9 additions & 3 deletions resources/lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,21 @@ def video_playback_item(context, video_item, show_fanart=None, **_kwargs):
}

if video_item.use_isa_video() and context.use_inputstream_adaptive():
if video_item.use_mpd_video():
use_mpd = video_item.use_mpd_video()
if use_mpd:
manifest_type = 'mpd'
mime_type = 'application/dash+xml'
if 'auto' in settings.stream_select():
props['inputstream.adaptive.stream_selection_type'] = 'adaptive'
else:
manifest_type = 'hls'
mime_type = 'application/x-mpegURL'

stream_select = settings.stream_select()
if not use_mpd and 'list' in stream_select:
props['inputstream.adaptive.stream_selection_type'] = 'manual-osd'
elif 'auto' in stream_select:
props['inputstream.adaptive.stream_selection_type'] = 'adaptive'
props['inputstream.adaptive.chooser_resolution_max'] = 'auto'

if current_system_version.compatible(19, 0):
props['inputstream'] = 'inputstream.adaptive'
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,16 @@ def stream_features(self, value=None):
}

def stream_select(self, value=None):
if self.use_mpd_videos():
setting = SETTINGS.MPD_STREAM_SELECT
default = 3
else:
setting = SETTINGS.VIDEO_STREAM_SELECT
default = 2

if value is not None:
return self.set_int(SETTINGS.MPD_STREAM_SELECT, value)
default = 3
value = self.get_int(SETTINGS.MPD_STREAM_SELECT, default)
return self.set_int(setting, value)
value = self.get_int(setting, default)
if value in self._STREAM_SELECT:
return self._STREAM_SELECT[value]
return self._STREAM_SELECT[default]
Expand Down
45 changes: 32 additions & 13 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@
</dependencies>
<control format="string" type="spinner"/>
</setting>
<setting id="kodion.video.quality.ask" type="boolean" label="30009" help="">
<level>0</level>
<default>false</default>
<dependencies>
<dependency type="visible">
<or>
<condition setting="kodion.video.quality.isa" operator="is">false</condition>
<condition setting="kodion.mpd.videos" operator="is">false</condition>
</or>
</dependency>
</dependencies>
<control type="toggle"/>
</setting>
<setting id="kodion.mpd.quality.selection" type="integer" label="30010" help="">
<level>0</level>
<default>4</default> <!-- 1080p (FHD) -->
Expand All @@ -86,6 +73,38 @@
</dependencies>
<control format="string" type="spinner"/>
</setting>
<setting id="kodion.video.stream.select" type="integer" label="30758" help="">
<level>0</level>
<default>2</default> <!-- auto+list -->
<constraints>
<options>
<option label="30583">1</option> <!-- auto -->
<option label="30759">2</option> <!-- list -->
</options>
</constraints>
<dependencies>
<dependency type="visible">
<and>
<condition setting="kodion.video.quality.isa" operator="is">true</condition>
<condition setting="kodion.mpd.videos" operator="is">false</condition>
</and>
</dependency>
</dependencies>
<control format="string" type="spinner"/>
</setting>
<setting id="kodion.video.quality.ask" type="boolean" label="30009" help="">
<level>0</level>
<default>false</default>
<dependencies>
<dependency type="visible">
<or>
<condition setting="kodion.video.quality.isa" operator="is">false</condition>
<condition setting="kodion.mpd.videos" operator="is">false</condition>
</or>
</dependency>
</dependencies>
<control type="toggle"/>
</setting>
<setting id="kodion.video.quality" type="integer" label="30010" help="">
<level>0</level>
<default>3</default> <!-- 720p (HD) -->
Expand Down

0 comments on commit 0c41d2a

Please sign in to comment.