player/command: remove /100 from sub-pos print

It already prints %, so there's no need for '/100'. Also, use the print
helper while at it.

6ea08be59a added a percent sign but didn't
remove '/100', so we ended up with both, which is redundant.
This commit is contained in:
Kacper Michajłow 2024-11-03 20:59:17 +01:00
parent 3772b8e385
commit 70aaba71d6
1 changed files with 3 additions and 2 deletions

View File

@ -3171,8 +3171,9 @@ static int mp_property_sub_pos(void *ctx, struct m_property *prop,
MPContext *mpctx = ctx; MPContext *mpctx = ctx;
struct MPOpts *opts = mpctx->opts; struct MPOpts *opts = mpctx->opts;
int track_ind = *(int *)prop->priv; int track_ind = *(int *)prop->priv;
if (action == M_PROPERTY_PRINT) { if (action == M_PROPERTY_PRINT || action == M_PROPERTY_FIXED_LEN_PRINT) {
*(char **)arg = talloc_asprintf(NULL, "%4.2f%%/100", opts->subs_shared->sub_pos[track_ind]); *(char **)arg = mp_format_double(NULL, opts->subs_shared->sub_pos[track_ind], 2,
false, true, action != M_PROPERTY_FIXED_LEN_PRINT);
return M_PROPERTY_OK; return M_PROPERTY_OK;
} }
return mp_property_generic_option(mpctx, prop, action, arg); return mp_property_generic_option(mpctx, prop, action, arg);