0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

vo_vaapi: round equalizer values

Probably fixes #1647 (if it's correct at all). I couldn't reproduce with
the vdpau libva driver, but a driver can use different ranges.

(cherry picked from commit 4e3f8ccb9d)
This commit is contained in:
wm4 2015-03-05 12:49:18 +01:00 committed by Diogo Franco (Kovensky)
parent 5734cd7063
commit cced4bf4d6

View File

@ -469,7 +469,7 @@ static int get_equalizer(struct priv *p, const char *name, int *value)
int r = attr->max_value - attr->min_value;
if (r == 0)
return VO_NOTIMPL;
*value = ((attr->value - attr->min_value) * 200) / r - 100;
*value = ((attr->value - attr->min_value) * 200 + r / 2) / r - 100;
return VO_TRUE;
}
@ -485,7 +485,10 @@ static int set_equalizer(struct priv *p, const char *name, int value)
int r = attr->max_value - attr->min_value;
if (r == 0)
return VO_NOTIMPL;
attr->value = ((value + 100) * r) / 200 + attr->min_value;
attr->value = ((value + 100) * r + 100) / 200 + attr->min_value;
MP_VERBOSE(p, "Changing '%s' (range [%d, %d]) to %d\n", name,
attr->max_value, attr->min_value, attr->value);
va_lock(p->mpvaapi);
status = vaSetDisplayAttributes(p->display, attr, 1);