summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-08-22 17:01:35 +0200
committerwm4 <wm4@nowhere>2017-08-22 17:01:35 +0200
commit03cf150ff3516789d581214177f291d46310aaf4 (patch)
tree2f352bf9c6d36e10001accdb72cef2d7683ab04a /player
parentd67aa6da6bbd3cba9eabd12cda4703821fecc7a1 (diff)
downloadmpv-03cf150ff3516789d581214177f291d46310aaf4.tar.bz2
mpv-03cf150ff3516789d581214177f291d46310aaf4.tar.xz
video: redo video equalizer option handling
I really wouldn't care much about this, but some parts of the core code are under HAVE_GPL, so there's some need to get rid of it. Simply turn the video equalizer from its current fine-grained handling with vf/vo fallbacks into global options. This makes updating them much simpler. This removes any possibility of applying video equalizers in filters, which affects vf_scale, and the previously removed vf_eq. Not a big loss, since the preferred VOs have this builtin. Remove video equalizer handling from vo_direct3d, vo_sdl, vo_vaapi, and vo_xv. I'm not going to waste my time on these legacy VOs. vo.eq_opts_cache exists _only_ to send a VOCTRL_SET_EQUALIZER, which exists _only_ to trigger a redraw. This seems silly, but for now I feel like this is less of a pain. The rest of the equalizer using code is self-updating. See commit 96b906a51d5 for how some video equalizer code was GPL only. Some command line option names and ranges can probably be traced back to a GPL only committer, but we don't consider these copyrightable.
Diffstat (limited to 'player')
-rw-r--r--player/command.c38
-rw-r--r--player/video.c75
2 files changed, 1 insertions, 112 deletions
diff --git a/player/command.c b/player/command.c
index 80c0c970fa..d94f819992 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2613,35 +2613,6 @@ static int mp_property_frame_count(void *ctx, struct m_property *prop,
return m_property_int_ro(action, arg, frames);
}
-#if HAVE_GPL
-static int mp_property_video_color(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- const char *name = prop->priv ? prop->priv : prop->name;
- MPContext *mpctx = ctx;
- if (!mpctx->vo_chain)
- return mp_property_generic_option(mpctx, prop, action, arg);
-
- switch (action) {
- case M_PROPERTY_SET: {
- if (video_set_colors(mpctx->vo_chain, name, *(int *) arg) <= 0)
- return M_PROPERTY_UNAVAILABLE;
- break;
- }
- case M_PROPERTY_GET:
- if (video_get_colors(mpctx->vo_chain, name, (int *)arg) <= 0)
- return M_PROPERTY_UNAVAILABLE;
- // Write new value to option variable
- mp_property_generic_option(mpctx, prop, M_PROPERTY_SET, arg);
- return M_PROPERTY_OK;
- case M_PROPERTY_GET_NEUTRAL:
- *(int *)arg = 0;
- return M_PROPERTY_OK;
- }
- return mp_property_generic_option(mpctx, prop, action, arg);
-}
-#endif
-
/// Video codec tag (RO)
static int mp_property_video_format(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -4041,15 +4012,6 @@ static const struct m_property mp_properties_base[] = {
{"ontop", mp_property_ontop},
{"border", mp_property_border},
{"on-all-workspaces", mp_property_all_workspaces},
-#if HAVE_GPL
- {"gamma", mp_property_video_color},
- {"brightness", mp_property_video_color},
- {"contrast", mp_property_video_color},
- {"saturation", mp_property_video_color},
- {"hue", mp_property_video_color},
- {"video-output-levels", mp_property_video_color,
- .priv = (void *)"output-levels"},
-#endif
{"video-out-params", mp_property_vo_imgparams},
{"video-dec-params", mp_property_dec_imgparams},
{"video-params", mp_property_vd_imgparams},
diff --git a/player/video.c b/player/video.c
index 3a9941d8e0..1fdf69042e 100644
--- a/player/video.c
+++ b/player/video.c
@@ -70,37 +70,6 @@ static const char av_desync_help_text[] =
"position will not match to the video (see A-V status field).\n"
"\n";
-#if HAVE_GPL
-int video_set_colors(struct vo_chain *vo_c, const char *item, int value)
-{
- vf_equalizer_t data;
-
- data.item = item;
- data.value = value;
-
- MP_VERBOSE(vo_c, "set video colors %s=%d \n", item, value);
- if (video_vf_vo_control(vo_c, VFCTRL_SET_EQUALIZER, &data) == CONTROL_TRUE)
- return 1;
- MP_VERBOSE(vo_c, "Video attribute '%s' is not supported by selected vo.\n",
- item);
- return 0;
-}
-
-int video_get_colors(struct vo_chain *vo_c, const char *item, int *value)
-{
- vf_equalizer_t data;
-
- data.item = item;
-
- MP_VERBOSE(vo_c, "get video colors %s \n", item);
- if (video_vf_vo_control(vo_c, VFCTRL_GET_EQUALIZER, &data) == CONTROL_TRUE) {
- *value = data.value;
- return 1;
- }
- return 0;
-}
-#endif
-
// Send a VCTRL, or if it doesn't work, translate it to a VOCTRL and try the VO.
int video_vf_vo_control(struct vo_chain *vo_c, int vf_cmd, void *data)
{
@@ -110,26 +79,6 @@ int video_vf_vo_control(struct vo_chain *vo_c, int vf_cmd, void *data)
return r;
}
- switch (vf_cmd) {
- case VFCTRL_SET_EQUALIZER: {
- vf_equalizer_t *eq = data;
- if (!vo_c->vo->config_ok)
- return CONTROL_FALSE; // vo not configured?
- struct voctrl_set_equalizer_args param = {
- eq->item, eq->value
- };
- return vo_control(vo_c->vo, VOCTRL_SET_EQUALIZER, &param) == VO_TRUE;
- }
- case VFCTRL_GET_EQUALIZER: {
- vf_equalizer_t *eq = data;
- if (!vo_c->vo->config_ok)
- return CONTROL_FALSE; // vo not configured?
- struct voctrl_get_equalizer_args param = {
- eq->item, &eq->value
- };
- return vo_control(vo_c->vo, VOCTRL_GET_EQUALIZER, &param) == VO_TRUE;
- }
- }
return CONTROL_UNKNOWN;
}
@@ -980,28 +929,6 @@ static void update_av_diff(struct MPContext *mpctx, double offset)
}
}
-static void init_vo(struct MPContext *mpctx)
-{
- struct MPOpts *opts = mpctx->opts;
- struct vo_chain *vo_c = mpctx->vo_chain;
-
-#if HAVE_GPL
- if (opts->gamma_gamma != 0)
- video_set_colors(vo_c, "gamma", opts->gamma_gamma);
- if (opts->gamma_brightness != 0)
- video_set_colors(vo_c, "brightness", opts->gamma_brightness);
- if (opts->gamma_contrast != 0)
- video_set_colors(vo_c, "contrast", opts->gamma_contrast);
- if (opts->gamma_saturation != 0)
- video_set_colors(vo_c, "saturation", opts->gamma_saturation);
- if (opts->gamma_hue != 0)
- video_set_colors(vo_c, "hue", opts->gamma_hue);
- video_set_colors(vo_c, "output-levels", opts->video_output_levels);
-#endif
-
- mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL);
-}
-
double calc_average_frame_duration(struct MPContext *mpctx)
{
double total = 0;
@@ -1445,7 +1372,7 @@ void write_video(struct MPContext *mpctx)
mpctx->error_playing = MPV_ERROR_VO_INIT_FAILED;
goto error;
}
- init_vo(mpctx);
+ mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL);
}
mpctx->time_frame -= get_relative_time(mpctx);