Skip to content

4.5.0 — disposition-ranked subtitle pick + native-subtitle bitmap fix (#73)

Choose a tag to compare

@superuser404notfound superuser404notfound released this 26 Jun 11:08

Added

Subtitle-language pick ranks by disposition; TrackInfo surfaces forced / SDH / commentary (#73)

LoadOptions.preferredSubtitleLanguages (4.4.0) activated the first track in a matching language. It now activates the best track within the first matching preference, using container dispositions:

  • Descriptor rank (dominant): full subtitles > SDH (HEARING_IMPAIRED) > forced > commentary (COMMENT).
  • Codec tiebreaker: text over bitmap (host styling only applies to text cues).
  • Preference order still dominates rank, so an earlier preference on a later track still wins.

New TrackInfo.isForced / isHearingImpaired / isCommentary (read alongside the existing isDefault) surface those container dispositions for audio and subtitle tracks, so a host can rank or filter subtitleTracks exactly the same way. The pure selectSubtitleIndex, subtitlePickRank, and isBitmapSubtitleCodec helpers are exposed and unit-tested.

This is additive and default-empty: nothing changes until a host sets preferredSubtitleLanguages or reads the new flags.

Fixed

Bitmap subtitles leaked into the native mov_text rendition (#55)

With prepareNativeSubtitles set, two sites matched TrackInfo.codec (the libavcodec decoder name, e.g. pgssub) against an exact-match set of descriptor names (hdmv_pgs_subtitle, dvb_subtitle, dvd_subtitle, xsub), so PGS / DVB / DVD bitmap tracks were not excluded (only xsub matched by coincidence). They leaked into the mov_text trak table and the native-store-attach set, producing phantom entries in the AVMediaSelection legible group and a store/reader index mismatch. Both sites now use a shared decoder-name isBitmapSubtitleCodec classifier that agrees with the reader's enum classifier, so only true text tracks become native mov_text traks. Hosts that do not use prepareNativeSubtitles are unaffected.


193 tests green.

Full diff: 4.4.0...4.5.0