From b62150bd6ba55cda3bd74a2db6d64ea5acd84f8e Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 23 Aug 2017 14:23:37 +0200 Subject: command: restore OSD marker for video equalizer properties Commit 03cf150ff3516 accidentally dropped these. Readd them in a simpler way (so only a property_osd_display[] entry is enough). This commit doesn't actually touch the video equalizer properties, because the default value of 0 for the marker is what they require anyway. --- options/m_property.h | 5 ----- player/command.c | 15 ++++++++------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/options/m_property.h b/options/m_property.h index 0e2d13c7e2..35d704ad97 100644 --- a/options/m_property.h +++ b/options/m_property.h @@ -82,11 +82,6 @@ enum mp_property_action { // Pass down an action to a sub-property. // arg: struct m_property_action_arg* M_PROPERTY_KEY_ACTION, - - // Get the (usually constant) value that indicates no change. Obscure - // special functionality for things like the volume property. - // Otherwise works like M_PROPERTY_GET. - M_PROPERTY_GET_NEUTRAL, }; // Argument for M_PROPERTY_SWITCH diff --git a/player/command.c b/player/command.c index 124b029c3d..184d7d51d2 100644 --- a/player/command.c +++ b/player/command.c @@ -1805,9 +1805,6 @@ static int mp_property_volume(void *ctx, struct m_property *prop, .max = opts->softvol_max, }; return M_PROPERTY_OK; - case M_PROPERTY_GET_NEUTRAL: - *(float *)arg = 100; - return M_PROPERTY_OK; case M_PROPERTY_PRINT: *(char **)arg = talloc_asprintf(NULL, "%i", (int)opts->softvol_volume); return M_PROPERTY_OK; @@ -4301,6 +4298,8 @@ static const struct property_osd_display { int osd_progbar; // Needs special ways to display the new value (seeks are delayed) int seek_msg, seek_bar; + // Show a marker thing on OSD bar. Ignored if osd_progbar==0. + float marker; // Free-form message (if NULL, osd_name or the property name is used) const char *msg; } property_osd_display[] = { @@ -4315,10 +4314,10 @@ static const struct property_osd_display { // audio { "volume", "Volume", .msg = "Volume: ${?volume:${volume}% ${?mute==yes:(Muted)}}${!volume:${volume}}", - .osd_progbar = OSD_VOLUME }, + .osd_progbar = OSD_VOLUME, .marker = 100 }, { "ao-volume", "AO Volume", .msg = "AO Volume: ${?ao-volume:${ao-volume}% ${?ao-mute==yes:(Muted)}}${!ao-volume:${ao-volume}}", - .osd_progbar = OSD_VOLUME }, + .osd_progbar = OSD_VOLUME, .marker = 100 }, { "mute", "Mute" }, { "ao-mute", "AO Mute" }, { "audio-delay", "A-V delay" }, @@ -4416,13 +4415,15 @@ static void show_property_osd(MPContext *mpctx, const char *name, int osd_mode) if ((osd_mode & MP_ON_OSD_BAR) && (prop.flags & CONF_RANGE) == CONF_RANGE) { if (prop.type == CONF_TYPE_INT) { int n = prop.min; - mp_property_do(name, M_PROPERTY_GET_NEUTRAL, &n, mpctx); + if (disp.osd_progbar) + n = disp.marker; int i; if (mp_property_do(name, M_PROPERTY_GET, &i, mpctx) > 0) set_osd_bar(mpctx, disp.osd_progbar, prop.min, prop.max, n, i); } else if (prop.type == CONF_TYPE_FLOAT) { float n = prop.min; - mp_property_do(name, M_PROPERTY_GET_NEUTRAL, &n, mpctx); + if (disp.osd_progbar) + n = disp.marker; float f; if (mp_property_do(name, M_PROPERTY_GET, &f, mpctx) > 0) set_osd_bar(mpctx, disp.osd_progbar, prop.min, prop.max, n, f); -- cgit v1.2.3