summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorrcombs <rcombs@rcombs.me>2020-06-22 15:08:42 -0500
committerrcombs <rcombs@rcombs.me>2020-08-19 23:44:54 -0500
commitc9474dc9ed6172a5f17f66f4b7d367da6b077909 (patch)
tree7992ffd7e3b5049415951d8392f206592cb162c0 /sub
parentdb0f9fab67af4776ec82dd491413fe642fb2670a (diff)
downloadmpv-c9474dc9ed6172a5f17f66f4b7d367da6b077909.tar.bz2
mpv-c9474dc9ed6172a5f17f66f4b7d367da6b077909.tar.xz
player: add --subs-with-matching-audio option
This allows users to control whether full dialogue subtitles are displayed with an audio track already in their preferred subtitle language. Additionally, this improves handling for the forced flag, automatically selecting between forced and unforced subtitle streams based on the user's settings and the selected audio.
Diffstat (limited to 'sub')
-rw-r--r--sub/sd_ass.c6
-rw-r--r--sub/sd_lavc.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 7c40a01faf..eae1536df8 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -533,6 +533,12 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res dim,
if (pts == MP_NOPTS_VALUE || !renderer)
goto done;
+ // Currently no supported text sub formats support a distinction between forced
+ // and unforced lines, so we just assume everything's unforced and discard everything.
+ // If we ever see a format that makes this distinction, we can add support here.
+ if (opts->forced_subs_only_current)
+ goto done;
+
double scale = dim.display_par;
if (!converted && (!opts->ass_style_override ||
opts->ass_vsfilter_aspect_compat))
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index 81906ceb23..77877fdbd1 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -191,7 +191,7 @@ static void read_sub_bitmaps(struct sd *sd, struct sub *sub)
MP_ERR(sd, "unsupported subtitle type from libavcodec\n");
continue;
}
- if (!(r->flags & AV_SUBTITLE_FLAG_FORCED) && opts->forced_subs_only)
+ if (!(r->flags & AV_SUBTITLE_FLAG_FORCED) && opts->forced_subs_only_current)
continue;
if (r->w <= 0 || r->h <= 0)
continue;