From 3422a00d9182ceedf25467c6dc24035143b97182 Mon Sep 17 00:00:00 2001 From: Rakshith Bhat Date: Thu, 10 Sep 2026 18:34:57 +0530 Subject: [PATCH] fix(subtitles): remove the subtitle outline when it is disabled The desktop and iOS bridges pushed the outline as --sub-outline-size and --sub-outline-color. The bundled mpv revision (c0dd2b32) does not define those properties, so both writes failed silently and mpv kept drawing its default outline whenever custom styling was on; the outline color setting was dead for the same reason. --sub-border-size and --sub-border-color carry the outline on this revision and on newer mpv builds, where those names are aliases of --sub-outline-*. --- composeApp/src/desktopMain/native/macos/player_bridge.mm | 7 +++++-- .../src/desktopMain/native/windows/player_bridge.cpp | 6 ++++-- iosApp/iosApp/Player/MPVPlayerBridge.swift | 6 ++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/composeApp/src/desktopMain/native/macos/player_bridge.mm b/composeApp/src/desktopMain/native/macos/player_bridge.mm index 24e0e8790..10f5a60ae 100644 --- a/composeApp/src/desktopMain/native/macos/player_bridge.mm +++ b/composeApp/src/desktopMain/native/macos/player_bridge.mm @@ -2101,13 +2101,16 @@ - (void)applySubtitleStyleWithTextColor:(NSString *)textColor value:[resolvedBackgroundColor hasPrefix:@"#00"] ? @"outline-and-shadow" : @"opaque-box"]; } if (modeChanged || outlineColorChanged) { - [self setStringProperty:"sub-outline-color" value:resolvedOutlineColor]; + // The bundled mpv exposes the outline only as --sub-border-color; + // --sub-outline-color fails silently here. + [self setStringProperty:"sub-border-color" value:resolvedOutlineColor]; } if (modeChanged || boldChanged) { [self setStringProperty:"sub-bold" value:bold ? @"yes" : @"no"]; } if (modeChanged || outlineSizeChanged) { - mpv_set_property(_mpv, "sub-outline-size", MPV_FORMAT_DOUBLE, &outline); + // Outline size uses the same --sub-border-* naming as the color. + mpv_set_property(_mpv, "sub-border-size", MPV_FORMAT_DOUBLE, &outline); } } if (stripSdhChanged) { diff --git a/composeApp/src/desktopMain/native/windows/player_bridge.cpp b/composeApp/src/desktopMain/native/windows/player_bridge.cpp index 0ee85c27d..937b0e3ec 100644 --- a/composeApp/src/desktopMain/native/windows/player_bridge.cpp +++ b/composeApp/src/desktopMain/native/windows/player_bridge.cpp @@ -1220,7 +1220,9 @@ class WindowsMpvWebPlayer : public std::enable_shared_from_this lock(mpvMutex); if (!mpv) return; - mpvApi().setProperty(mpv, "sub-outline-size", MPV_FORMAT_DOUBLE, &outline); + mpvApi().setProperty(mpv, "sub-border-size", MPV_FORMAT_DOUBLE, &outline); } } if (stripSdhChanged) { diff --git a/iosApp/iosApp/Player/MPVPlayerBridge.swift b/iosApp/iosApp/Player/MPVPlayerBridge.swift index c0124b1db..f8e4e38e9 100644 --- a/iosApp/iosApp/Player/MPVPlayerBridge.swift +++ b/iosApp/iosApp/Player/MPVPlayerBridge.swift @@ -830,12 +830,14 @@ final class MPVPlayerViewController: UIViewController { checkError(mpv_set_property_string(mpv, "sub-ass-override", "no")) checkError(mpv_set_property_string(mpv, "sub-color", textColor)) checkError(mpv_set_property_string(mpv, "sub-back-color", backgroundColor)) - checkError(mpv_set_property_string(mpv, "sub-outline-color", outlineColor)) + // --sub-border-color/--sub-border-size work on every mpv revision, unlike + // the --sub-outline-* names used by newer builds. + checkError(mpv_set_property_string(mpv, "sub-border-color", outlineColor)) checkError(mpv_set_property_string(mpv, "sub-border-style", backgroundColor.hasPrefix("#00") ? "outline-and-shadow" : "opaque-box")) setStringProperty("sub-bold", bold ? "yes" : "no") var outline = Double(outlineSize) - checkError(mpv_set_property(mpv, "sub-outline-size", MPV_FORMAT_DOUBLE, &outline)) + checkError(mpv_set_property(mpv, "sub-border-size", MPV_FORMAT_DOUBLE, &outline)) var size = Double(fontSize) checkError(mpv_set_property(mpv, "sub-font-size", MPV_FORMAT_DOUBLE, &size))