summaryrefslogtreecommitdiffstats
path: root/sub/dec_sub.c
diff options
context:
space:
mode:
authorrcombs <rcombs@rcombs.me>2021-05-27 00:56:41 -0500
committersfan5 <sfan5@live.de>2023-06-25 11:01:58 +0200
commitba7cc071068f4f57ae354e77f64552712fda6855 (patch)
treeeb264b91c1465e149d8d3aefdad7a9813d658b13 /sub/dec_sub.c
parent991a2f79ce381544437791430c91cd026e21d726 (diff)
downloadmpv-ba7cc071068f4f57ae354e77f64552712fda6855.tar.bz2
mpv-ba7cc071068f4f57ae354e77f64552712fda6855.tar.xz
sub: rewrite auto-forced-only support
- No longer has a fake "option" used only internally (which didn't always get propagated properly) - Always overrideable during playback
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r--sub/dec_sub.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index 0fed1e668f..30f5b651b0 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -69,6 +69,8 @@ struct dec_sub {
struct sd *sd;
struct demux_packet *new_segment;
+
+ bool forced_only_def;
};
static void update_subtitle_speed(struct dec_sub *sub)
@@ -142,6 +144,7 @@ static struct sd *init_decoder(struct dec_sub *sub)
.attachments = sub->attachments,
.codec = sub->codec,
.preload_ok = true,
+ .forced_only_def = sub->forced_only_def,
};
if (sd->driver->init(sd) >= 0)
@@ -160,18 +163,18 @@ static struct sd *init_decoder(struct dec_sub *sub)
// do not need to acquire locks.
// Ownership of attachments goes to the callee, and is released with
// talloc_free() (even on failure).
-struct dec_sub *sub_create(struct mpv_global *global, struct sh_stream *sh,
+struct dec_sub *sub_create(struct mpv_global *global, struct track *track,
struct attachment_list *attachments, int order)
{
- assert(sh && sh->type == STREAM_SUB);
+ assert(track->stream && track->stream->type == STREAM_SUB);
struct dec_sub *sub = talloc(NULL, struct dec_sub);
*sub = (struct dec_sub){
.log = mp_log_new(sub, global->log, "sub"),
.global = global,
.opts_cache = m_config_cache_alloc(sub, global, &mp_subtitle_sub_opts),
- .sh = sh,
- .codec = sh->codec,
+ .sh = track->stream,
+ .codec = track->stream->codec,
.attachments = talloc_steal(sub, attachments),
.play_dir = 1,
.order = order,
@@ -179,6 +182,7 @@ struct dec_sub *sub_create(struct mpv_global *global, struct sh_stream *sh,
.last_vo_pts = MP_NOPTS_VALUE,
.start = MP_NOPTS_VALUE,
.end = MP_NOPTS_VALUE,
+ .forced_only_def = track->forced_only_def,
};
sub->opts = sub->opts_cache->opts;
mpthread_mutex_init_recursive(&sub->lock);