stream.hls: also compare parsed language selection #6469
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See #6467 (comment)
This allows selecting HLS audio streams without having to know the exact value of the
LANGUAGE
attribute of the respectiveEXT-X-MEDIA
tag. Previously, this was even case-sensitive, which language codes definitely are not.Instead of only comparing plain values, parse the user's input (test all language attributes:
alpha_2
,alpha_3
,name
andbibliographic
) and also parse the language data of the media playlists in the HLS multivariant playlist (test all language attributes as well), and then do the comparisons on the resultingLanguage
objects when selecting audio streams. Keep plain value language code comparision, to support selecting audio streams with invalid language codes or languages with reserved codes (qaa-qtz
).The last two commits are simple performance improvements.
So for example,
--hls-audio-select=ger
now allows users to select audio streams which are annotated with the alpha_3 codedeu
(regardless of case), asger
is the bilbiographic attribute of German/Deutsch. Likewise,--hls-audio-select=German
would also work, as the language'sname
attribute is also taken into consideration.pycountry
does not have any data for localized language names,--hls-audio-select=Deutsch
won't work.Since the implementation of the external audio stream selection is still pretty bad (#4902), we should at least improve the logging of the available substreams, as there's no indication of what is available unless low logging levels are set. This is for a future PR though...