command: add sub-forced-only-cur prop

This commit is contained in:
rcombs 2021-06-25 02:36:05 -05:00 committed by sfan5
parent c6cacea4de
commit 5c4852d173
2 changed files with 16 additions and 0 deletions

View File

@ -2712,6 +2712,9 @@ Property list
``secondary-sub-end`` ``secondary-sub-end``
Same as ``sub-end``, but for the secondary subtitles. 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) ``playlist-pos`` (RW)
Current position on playlist. The first entry is on position 0. Writing to Current position on playlist. The first entry is on position 0. Writing to
this property may start playback at the new position. this property may start playback at the new position.

View File

@ -2943,6 +2943,18 @@ static int mp_property_sub_end(void *ctx, struct m_property *prop,
return m_property_double_ro(action, arg, end); 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, static int mp_property_playlist_current_pos(void *ctx, struct m_property *prop,
int action, void *arg) int action, void *arg)
{ {
@ -3899,6 +3911,7 @@ static const struct m_property mp_properties_base[] = {
.priv = (void *)&(const int){0}}, .priv = (void *)&(const int){0}},
{"secondary-sub-end", mp_property_sub_end, {"secondary-sub-end", mp_property_sub_end,
.priv = (void *)&(const int){1}}, .priv = (void *)&(const int){1}},
{"sub-forced-only-cur", mp_property_sub_forced_only_cur},
{"vf", mp_property_vf}, {"vf", mp_property_vf},
{"af", mp_property_af}, {"af", mp_property_af},