Currently, when populating subtitleTracks, we assume that the ordering
and list of populated subtitle tracks will not change when Roku moves
the list into availableSubtitleTracks. This causes an issue with some
videos as it is not always consistent.
This patch modifies the logic to no-longer inject assumed final indices
into our list of text-based subtitles, but instead search through the
availableSubtitleTracks array and locate the actual subtitle that
refers to the same URL as in our list. In this way we are guaranteed
to always tell Roku to play the subtitle we want, no matter how re-
ordered the options get.
NOTE: The URL gets mildly mangled in the process of copying from
subtitleTracks to availableSubtitleTracks, so we need so search via
substring, rather than doing a full string comparison.
On other players (web/andriod app) the user perferences for
subtitle behavior are taken into account, and used to make an
assumption about subtitle behavior.
This patch ports most of that logic here. "Smart" selection is not
yet fully-featured, as it requires additional knowledge about audio
language preferences. Rather it uses the fallback mechanism, which
emulates the "Default" subtitle option.
The logic for the different options was based on the main jellyfin
repo (specifically sha 49d5fdb33fc9792147c1df03e1d1b051e6b7ec79 in
file Emby.Server.Implementations/Library/MediaStreamSelector.cs)
Additionally, this implementation specifically prefers text-based
subtitles (assuming they match the user's preference) as they are
the only ones natively supported by Roku.
Also, the subtitle changing mechanism is reworked slightly to make
use of the new implementation herein
Support playing video using the MPEG-2 codec when supported by the device. Enabled
by option since MPEG-2 requires high bandwidth and some users report issues with
MPEG-2 decoding on some Roku models.