Skip to content

fix: Subtitle off and subtitle stream selection logic#893

Merged
PartyDonut merged 1 commit intoDonutWare:developfrom
schembriaiden:fix/subtitles-always-show
Apr 4, 2026
Merged

fix: Subtitle off and subtitle stream selection logic#893
PartyDonut merged 1 commit intoDonutWare:developfrom
schembriaiden:fix/subtitles-always-show

Conversation

@schembriaiden
Copy link
Copy Markdown
Contributor

Pull Request Description

This pull request improves the handling of default subtitle and audio stream selection in the playback models and ensures more robust and consistent behavior when no valid stream is found. The main focus is on returning a default "no stream" object instead of null, and updating the player wrappers to correctly handle these cases.

Improvements to stream selection logic:

  • Updated the PlaybackModelExtension in playback_model.dart so that defaultSubStream and defaultAudioStream return a default "no stream" object (e.g., SubStreamModel.no(), AudioStreamModel.no()) when no valid stream is found, instead of returning null. This makes downstream code safer and more predictable.

Player wrapper updates for subtitle track selection:

  • In LibMDK (lib_mdk.dart), modified setSubtitleTrack to check for both null and the default "no" subtitle stream, disabling external subtitles and returning -1 when appropriate.
  • Cleaned up unreachable code in LibMDK's setSubtitleTrack by removing a redundant return statement.
  • In LibMPV (lib_mpv.dart), consolidated the check for invalid subtitle streams (null or "no" stream), ensuring that the player disables subtitles and returns -1 in these cases, and moved the codec assignment after the check for clarity and correctness.
  • Minor code cleanup in LibMPV to remove unnecessary braces after handling subtitle tracks.

Issue Being Fixed

Resolves #877

Screenshots / Recordings

Checklist

  • If a new package was added, did you ensure it works for all supported platforms? Is the package well maintained
  • Check that any changes are related to the issue at hand.

@schembriaiden schembriaiden force-pushed the fix/subtitles-always-show branch from cb289fb to 66fd49d Compare March 31, 2026 09:59
Copy link
Copy Markdown
Collaborator

@PartyDonut PartyDonut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks

@PartyDonut PartyDonut added the bug Something isn't working label Apr 4, 2026
@PartyDonut PartyDonut changed the title fix: Improve subtitle stream selection logic fix: Subtitle off and subtitle stream selection logic Apr 4, 2026
@PartyDonut PartyDonut merged commit d4f9ef7 into DonutWare:develop Apr 4, 2026
1 check passed
@github-project-automation github-project-automation bot moved this to Done in Fladder Apr 4, 2026
@schembriaiden schembriaiden deleted the fix/subtitles-always-show branch April 4, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛 Subtitles show, even when off is selected

2 participants