From 5c4852d1730c415fc9311a39c6f7003d9c914792 Mon Sep 17 00:00:00 2001 From: rcombs Date: Fri, 25 Jun 2021 02:36:05 -0500 Subject: [PATCH] command: add sub-forced-only-cur prop --- DOCS/man/input.rst | 3 +++ player/command.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index ce14015792..07a689106e 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -2712,6 +2712,9 @@ Property list ``secondary-sub-end`` Same as ``sub-end``, but for the secondary subtitles. +``sub-forced-only-cur`` + Read-only - whether the current subtitle track is being shown in forced-only mode. + ``playlist-pos`` (RW) Current position on playlist. The first entry is on position 0. Writing to this property may start playback at the new position. diff --git a/player/command.c b/player/command.c index 3155b1afd6..0eb13a7eed 100644 --- a/player/command.c +++ b/player/command.c @@ -2943,6 +2943,18 @@ static int mp_property_sub_end(void *ctx, struct m_property *prop, return m_property_double_ro(action, arg, end); } +static int mp_property_sub_forced_only_cur(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + int ret = mpctx->opts->subs_rend->forced_subs_only; + if (ret == -1) { + struct track *track = mpctx->current_track[0][STREAM_SUB]; + ret = track && track->forced_only_def; + } + return m_property_bool_ro(action, arg, ret); +} + static int mp_property_playlist_current_pos(void *ctx, struct m_property *prop, int action, void *arg) { @@ -3899,6 +3911,7 @@ static const struct m_property mp_properties_base[] = { .priv = (void *)&(const int){0}}, {"secondary-sub-end", mp_property_sub_end, .priv = (void *)&(const int){1}}, + {"sub-forced-only-cur", mp_property_sub_forced_only_cur}, {"vf", mp_property_vf}, {"af", mp_property_af},