diff options
author | wm4 <wm4@nowhere> | 2013-09-30 00:31:10 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-09-30 00:45:58 +0200 |
commit | 00d41cc5b065cc809ab64901aca3dcaae8035869 (patch) | |
tree | bd7bdfd1ece9ee986f6429d4d998e0e2d20db5c9 /video/filter | |
parent | 9488d312c11ab1b4267b33eb85adcb28b25a45ba (diff) | |
download | mpv-00d41cc5b065cc809ab64901aca3dcaae8035869.tar.bz2 mpv-00d41cc5b065cc809ab64901aca3dcaae8035869.tar.xz |
vf_scale: factor out libswscale equalizer control
Will be used by vo_x11.
Diffstat (limited to 'video/filter')
-rw-r--r-- | video/filter/vf_scale.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/video/filter/vf_scale.c b/video/filter/vf_scale.c index 618460965a..3184194a33 100644 --- a/video/filter/vf_scale.c +++ b/video/filter/vf_scale.c @@ -353,37 +353,16 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) static int control(struct vf_instance *vf, int request, void *data) { - int r; - vf_equalizer_t *eq; struct mp_sws_context *sws = vf->priv->sws; switch (request) { case VFCTRL_GET_EQUALIZER: - eq = data; - if (!strcmp(eq->item, "brightness")) - eq->value = ((sws->brightness * 100) + (1 << 15)) >> 16; - else if (!strcmp(eq->item, "contrast")) - eq->value = (((sws->contrast * 100) + (1 << 15)) >> 16) - 100; - else if (!strcmp(eq->item, "saturation")) - eq->value = (((sws->saturation * 100) + (1 << 15)) >> 16) - 100; - else + if (mp_sws_get_vf_equalizer(sws, data) < 1) break; return CONTROL_TRUE; case VFCTRL_SET_EQUALIZER: - eq = data; - if (!strcmp(eq->item, "brightness")) - sws->brightness = ((eq->value << 16) + 50) / 100; - else if (!strcmp(eq->item, "contrast")) - sws->contrast = (((eq->value + 100) << 16) + 50) / 100; - else if (!strcmp(eq->item, "saturation")) - sws->saturation = (((eq->value + 100) << 16) + 50) / 100; - else + if (mp_sws_get_vf_equalizer(sws, data) < 1) break; - - r = mp_sws_reinit(sws); - if (r < 0) - break; - return CONTROL_TRUE; default: break; |