summaryrefslogtreecommitdiffstats
path: root/video/out
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 /video/out
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 'video/out')
-rw-r--r--video/out/opengl/video.c23
-rw-r--r--video/out/opengl/video.h3
-rw-r--r--video/out/vo.c11
-rw-r--r--video/out/vo.h1
-rw-r--r--video/out/vo_direct3d.c19
-rw-r--r--video/out/vo_opengl.c19
-rw-r--r--video/out/vo_opengl_cb.c37
-rw-r--r--video/out/vo_sdl.c85
-rw-r--r--video/out/vo_vaapi.c92
-rw-r--r--video/out/vo_vdpau.c40
-rw-r--r--video/out/vo_xv.c9
11 files changed, 27 insertions, 312 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index bbf88e2747..f95222081c 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -242,7 +242,7 @@ struct gl_video {
// state for configured scalers
struct scaler scaler[SCALER_COUNT];
- struct mp_csp_equalizer video_eq;
+ struct mp_csp_equalizer_state *video_eq;
struct mp_rect src_rect; // displayed part of the source video
struct mp_rect dst_rect; // video rectangle on output window
@@ -848,13 +848,6 @@ static void init_video(struct gl_video *p)
mp_image_params_guess_csp(&p->image_params);
- int eq_caps = MP_CSP_EQ_CAPS_GAMMA;
- if (p->image_params.color.space != MP_CSP_BT_2020_C)
- eq_caps |= MP_CSP_EQ_CAPS_COLORMATRIX;
- if (p->image_params.color.space == MP_CSP_XYZ)
- eq_caps |= MP_CSP_EQ_CAPS_BRIGHTNESS;
- p->video_eq.capabilities = eq_caps;
-
av_lfg_init(&p->lfg, 1);
debug_check_gl(p, "before video texture creation");
@@ -2173,7 +2166,7 @@ static void pass_convert_yuv(struct gl_video *p)
struct mp_csp_params cparams = MP_CSP_PARAMS_DEFAULTS;
cparams.gray = p->is_gray;
mp_csp_set_image_params(&cparams, &p->image_params);
- mp_csp_copy_equalizer_values(&cparams, &p->video_eq);
+ mp_csp_equalizer_state_get(p->video_eq, &cparams);
p->user_gamma = 1.0 / (cparams.gamma * p->opts.gamma);
pass_describe(p, "color conversion");
@@ -3582,6 +3575,7 @@ struct gl_video *gl_video_init(struct ra *ra, struct mp_log *log,
.global = g,
.log = log,
.sc = gl_sc_create(ra, g, log),
+ .video_eq = mp_csp_equalizer_create(p, g),
.opts_cache = m_config_cache_alloc(p, g, &gl_video_conf),
};
// make sure this variable is initialized to *something*
@@ -3674,16 +3668,6 @@ void gl_video_configure_queue(struct gl_video *p, struct vo *vo)
vo_set_queue_params(vo, 0, queue_size);
}
-struct mp_csp_equalizer *gl_video_eq_ptr(struct gl_video *p)
-{
- return &p->video_eq;
-}
-
-// Call when the mp_csp_equalizer returned by gl_video_eq_ptr() was changed.
-void gl_video_eq_update(struct gl_video *p)
-{
-}
-
static int validate_scaler_opt(struct mp_log *log, const m_option_t *opt,
struct bstr name, struct bstr param)
{
@@ -3758,7 +3742,6 @@ void gl_video_set_ambient_lux(struct gl_video *p, int lux)
float gamma = gl_video_scale_ambient_lux(16.0, 64.0, 2.40, 1.961, lux);
MP_VERBOSE(p, "ambient light changed: %dlux (gamma: %f)\n", lux, gamma);
p->opts.gamma = MPMIN(1.0, 1.961 / gamma);
- gl_video_eq_update(p);
}
}
diff --git a/video/out/opengl/video.h b/video/out/opengl/video.h
index 0db9773712..e5e7ae70ec 100644
--- a/video/out/opengl/video.h
+++ b/video/out/opengl/video.h
@@ -165,9 +165,6 @@ void gl_video_resize(struct gl_video *p,
void gl_video_set_fb_depth(struct gl_video *p, int fb_depth);
struct voctrl_performance_data;
void gl_video_perfdata(struct gl_video *p, struct voctrl_performance_data *out);
-struct mp_csp_equalizer;
-struct mp_csp_equalizer *gl_video_eq_ptr(struct gl_video *p);
-void gl_video_eq_update(struct gl_video *p);
void gl_video_set_clear_color(struct gl_video *p, struct m_color color);
void gl_video_set_osd_pts(struct gl_video *p, double pts);
bool gl_video_check_osd_change(struct gl_video *p, struct mp_osd_res *osd,
diff --git a/video/out/vo.c b/video/out/vo.c
index 217baac632..f9c5d04e24 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -228,6 +228,12 @@ static void update_opts(void *p)
if (vo->driver->control)
vo->driver->control(vo, VOCTRL_UPDATE_RENDER_OPTS, NULL);
}
+
+ if (m_config_cache_update(vo->eq_opts_cache)) {
+ // "Legacy" update of video equalizer related options.
+ if (vo->driver->control)
+ vo->driver->control(vo, VOCTRL_SET_EQUALIZER, NULL);
+ }
}
// Does not include thread- and VO uninit.
@@ -238,6 +244,7 @@ static void dealloc_vo(struct vo *vo)
// These must be free'd before vo->in->dispatch.
talloc_free(vo->opts_cache);
talloc_free(vo->gl_opts_cache);
+ talloc_free(vo->eq_opts_cache);
pthread_mutex_destroy(&vo->in->lock);
pthread_cond_destroy(&vo->in->wakeup);
@@ -291,6 +298,10 @@ static struct vo *vo_create(bool probing, struct mpv_global *global,
update_opts, vo);
#endif
+ vo->eq_opts_cache = m_config_cache_alloc(NULL, global, &mp_csp_equalizer_conf);
+ m_config_cache_set_dispatch_change_cb(vo->eq_opts_cache, vo->in->dispatch,
+ update_opts, vo);
+
mp_input_set_mouse_transform(vo->input_ctx, NULL, NULL);
if (vo->driver->encode != !!vo->encode_lavc_ctx)
goto error;
diff --git a/video/out/vo.h b/video/out/vo.h
index c3145d5a5d..c6751c7524 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -401,6 +401,7 @@ struct vo {
struct m_config_cache *opts_cache; // cache for ->opts
struct mp_vo_opts *opts;
struct m_config_cache *gl_opts_cache;
+ struct m_config_cache *eq_opts_cache;
bool want_redraw; // redraw as soon as possible
diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c
index e18cf8e4e0..687bb972a9 100644
--- a/video/out/vo_direct3d.c
+++ b/video/out/vo_direct3d.c
@@ -185,7 +185,6 @@ typedef struct d3d_priv {
D3DFORMAT osd_fmt_table[SUBBITMAP_COUNT];
D3DMATRIX d3d_colormatrix;
- struct mp_csp_equalizer video_eq;
struct osdpart *osd[MAX_OSD_PARTS];
} d3d_priv;
@@ -1171,7 +1170,6 @@ static void update_colorspace(d3d_priv *priv)
{
struct mp_csp_params csp = MP_CSP_PARAMS_DEFAULTS;
mp_csp_set_image_params(&csp, &priv->params);
- mp_csp_copy_equalizer_values(&csp, &priv->video_eq);
if (priv->use_shaders) {
csp.input_bits = priv->planes[0].bits_per_pixel;
@@ -1245,23 +1243,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_REDRAW_FRAME:
d3d_draw_frame(priv);
return VO_TRUE;
- case VOCTRL_SET_EQUALIZER: {
- if (!priv->use_shaders)
- break;
- struct voctrl_set_equalizer_args *args = data;
- if (mp_csp_equalizer_set(&priv->video_eq, args->name, args->value) < 0)
- return VO_NOTIMPL;
- update_colorspace(priv);
- vo->want_redraw = true;
- return VO_TRUE;
- }
- case VOCTRL_GET_EQUALIZER: {
- if (!priv->use_shaders)
- break;
- struct voctrl_get_equalizer_args *args = data;
- return mp_csp_equalizer_get(&priv->video_eq, args->name, args->valueptr)
- >= 0 ? VO_TRUE : VO_NOTIMPL;
- }
case VOCTRL_SET_PANSCAN:
calc_fs_rect(priv);
priv->vo->want_redraw = true;
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index 02a7318970..72691e56c2 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -262,22 +262,9 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_SET_PANSCAN:
resize(p);
return VO_TRUE;
- case VOCTRL_GET_EQUALIZER: {
- struct voctrl_get_equalizer_args *args = data;
- struct mp_csp_equalizer *eq = gl_video_eq_ptr(p->renderer);
- bool r = mp_csp_equalizer_get(eq, args->name, args->valueptr) >= 0;
- return r ? VO_TRUE : VO_NOTIMPL;
- }
- case VOCTRL_SET_EQUALIZER: {
- struct voctrl_set_equalizer_args *args = data;
- struct mp_csp_equalizer *eq = gl_video_eq_ptr(p->renderer);
- if (mp_csp_equalizer_set(eq, args->name, args->value) >= 0) {
- gl_video_eq_update(p->renderer);
- vo->want_redraw = true;
- return VO_TRUE;
- }
- return VO_NOTIMPL;
- }
+ case VOCTRL_SET_EQUALIZER:
+ vo->want_redraw = true;
+ return VO_TRUE;
case VOCTRL_SCREENSHOT_WIN: {
struct mp_image *screen = gl_read_fbo_contents(p->gl, p->glctx->main_fb,
vo->dwidth, vo->dheight);
diff --git a/video/out/vo_opengl_cb.c b/video/out/vo_opengl_cb.c
index 4a9b60d4ff..ea6aaa9048 100644
--- a/video/out/vo_opengl_cb.c
+++ b/video/out/vo_opengl_cb.c
@@ -76,8 +76,6 @@ struct mpv_opengl_cb_context {
bool force_update;
bool imgfmt_supported[IMGFMT_END - IMGFMT_START];
bool update_new_opts;
- bool eq_changed;
- struct mp_csp_equalizer eq;
struct vo *active;
// --- This is only mutable while initialized=false, during which nothing
@@ -187,10 +185,6 @@ int mpv_opengl_cb_init_gl(struct mpv_opengl_cb_context *ctx, const char *exts,
gl_video_set_hwdec(ctx->renderer, ctx->hwdec);
pthread_mutex_lock(&ctx->lock);
- // We don't know the exact caps yet - use a known superset
- ctx->eq.capabilities = MP_CSP_EQ_CAPS_GAMMA | MP_CSP_EQ_CAPS_BRIGHTNESS |
- MP_CSP_EQ_CAPS_COLORMATRIX;
- ctx->eq_changed = true;
for (int n = IMGFMT_START; n < IMGFMT_END; n++) {
ctx->imgfmt_supported[n - IMGFMT_START] =
gl_video_check_format(ctx->renderer, n);
@@ -277,7 +271,6 @@ int mpv_opengl_cb_draw(mpv_opengl_cb_context *ctx, int fbo, int vp_w, int vp_h)
if (ctx->reconfigured) {
gl_video_set_osd_source(ctx->renderer, vo ? vo->osd : NULL);
gl_video_config(ctx->renderer, &ctx->img_params);
- ctx->eq_changed = true;
}
if (ctx->update_new_opts) {
gl_video_update_options(ctx->renderer);
@@ -301,13 +294,6 @@ int mpv_opengl_cb_draw(mpv_opengl_cb_context *ctx, int fbo, int vp_w, int vp_h)
ctx->cur_frame->still = true;
}
- struct mp_csp_equalizer *eq = gl_video_eq_ptr(ctx->renderer);
- if (ctx->eq_changed) {
- memcpy(eq->values, ctx->eq.values, sizeof(eq->values));
- gl_video_eq_update(ctx->renderer);
- }
- ctx->eq_changed = false;
-
struct vo_frame *frame = ctx->next_frame;
int64_t wait_present_count = ctx->present_count;
if (frame) {
@@ -469,24 +455,9 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_PAUSE:
vo->want_redraw = true;
return VO_TRUE;
- case VOCTRL_GET_EQUALIZER: {
- struct voctrl_get_equalizer_args *args = data;
- pthread_mutex_lock(&p->ctx->lock);
- bool r = mp_csp_equalizer_get(&p->ctx->eq, args->name, args->valueptr) >= 0;
- pthread_mutex_unlock(&p->ctx->lock);
- return r ? VO_TRUE : VO_NOTIMPL;
- }
- case VOCTRL_SET_EQUALIZER: {
- struct voctrl_set_equalizer_args *args = data;
- pthread_mutex_lock(&p->ctx->lock);
- bool r = mp_csp_equalizer_set(&p->ctx->eq, args->name, args->value) >= 0;
- if (r) {
- p->ctx->eq_changed = true;
- update(p);
- }
- pthread_mutex_unlock(&p->ctx->lock);
- return r ? VO_TRUE : VO_NOTIMPL;
- }
+ case VOCTRL_SET_EQUALIZER:
+ vo->want_redraw = true;
+ return VO_TRUE;
case VOCTRL_SET_PANSCAN:
pthread_mutex_lock(&p->ctx->lock);
p->ctx->force_update = true;
@@ -535,8 +506,6 @@ static int preinit(struct vo *vo)
p->ctx->active = vo;
p->ctx->reconfigured = true;
p->ctx->update_new_opts = true;
- memset(p->ctx->eq.values, 0, sizeof(p->ctx->eq.values));
- p->ctx->eq_changed = true;
pthread_mutex_unlock(&p->ctx->lock);
vo->hwdec_devs = p->ctx->hwdec_devs;
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c
index a1d0b248eb..d902c09cad 100644
--- a/video/out/vo_sdl.c
+++ b/video/out/vo_sdl.c
@@ -844,44 +844,11 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
{
struct priv *vc = vo->priv;
- // decode brightness/contrast
- int color_add = 0;
- int color_mod = 255;
- int brightness = vc->brightness;
- int contrast = vc->contrast;
-
- // only in this range it is possible to do brightness/contrast control
- // properly, using just additive render operations and color modding
- // (SDL2 provides no subtractive rendering, sorry)
- if (2 * brightness < contrast) {
- //brightness = (brightness + 2 * contrast) / 5; // closest point
- brightness = (brightness + contrast) / 3; // equal adjustment
- contrast = 2 * brightness;
- }
-
- // convert to values SDL2 likes
- color_mod = ((contrast + 100) * 255 + 50) / 100;
- color_add = ((2 * brightness - contrast) * 255 + 100) / 200;
-
- // clamp
- if (color_mod < 0)
- color_mod = 0;
- if (color_mod > 255)
- color_mod = 255;
- // color_add can't be < 0
- if (color_add > 255)
- color_add = 255;
-
// typically this runs in parallel with the following mp_image_copy call
- SDL_SetRenderDrawColor(vc->renderer, color_add, color_add, color_add, 255);
+ SDL_SetRenderDrawColor(vc->renderer, 0, 0, 0, 255);
SDL_RenderClear(vc->renderer);
- // use additive blending for the video texture only if the clear color is
- // not black (faster especially for the software renderer)
- if (color_add)
- SDL_SetTextureBlendMode(vc->tex, SDL_BLENDMODE_ADD);
- else
- SDL_SetTextureBlendMode(vc->tex, SDL_BLENDMODE_NONE);
+ SDL_SetTextureBlendMode(vc->tex, SDL_BLENDMODE_NONE);
if (mpi) {
vc->osd_pts = mpi->pts;
@@ -909,15 +876,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
dst.w = vc->dst_rect.x1 - vc->dst_rect.x0;
dst.h = vc->dst_rect.y1 - vc->dst_rect.y0;
- // typically this runs in parallel with the following mp_image_copy call
- if (color_mod > 255) {
- SDL_SetTextureColorMod(vc->tex, color_mod / 2, color_mod / 2, color_mod / 2);
- SDL_RenderCopy(vc->renderer, vc->tex, &src, &dst);
- SDL_RenderCopy(vc->renderer, vc->tex, &src, &dst);
- } else {
- SDL_SetTextureColorMod(vc->tex, color_mod, color_mod, color_mod);
- SDL_RenderCopy(vc->renderer, vc->tex, &src, &dst);
- }
+ SDL_RenderCopy(vc->renderer, vc->tex, &src, &dst);
draw_osd(vo);
}
@@ -938,36 +897,6 @@ static struct mp_image *get_window_screenshot(struct vo *vo)
return image;
}
-static int set_eq(struct vo *vo, const char *name, int value)
-{
- struct priv *vc = vo->priv;
-
- if (!strcmp(name, "brightness"))
- vc->brightness = value;
- else if (!strcmp(name, "contrast"))
- vc->contrast = value;
- else
- return VO_NOTIMPL;
-
- vo->want_redraw = true;
-
- return VO_TRUE;
-}
-
-static int get_eq(struct vo *vo, const char *name, int *value)
-{
- struct priv *vc = vo->priv;
-
- if (!strcmp(name, "brightness"))
- *value = vc->brightness;
- else if (!strcmp(name, "contrast"))
- *value = vc->contrast;
- else
- return VO_NOTIMPL;
-
- return VO_TRUE;
-}
-
static int control(struct vo *vo, uint32_t request, void *data)
{
struct priv *vc = vo->priv;
@@ -982,14 +911,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_SET_PANSCAN:
force_resize(vo);
return VO_TRUE;
- case VOCTRL_SET_EQUALIZER: {
- struct voctrl_set_equalizer_args *args = data;
- return set_eq(vo, args->name, args->value);
- }
- case VOCTRL_GET_EQUALIZER: {
- struct voctrl_get_equalizer_args *args = data;
- return get_eq(vo, args->name, args->valueptr);
- }
case VOCTRL_SCREENSHOT_WIN:
*(struct mp_image **)data = get_window_screenshot(vo);
return true;
diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c
index 85b8159f68..3468ac6643 100644
--- a/video/out/vo_vaapi.c
+++ b/video/out/vo_vaapi.c
@@ -434,103 +434,11 @@ static void draw_osd(struct vo *vo)
osd_draw(vo->osd, *res, pts, 0, osd_formats, draw_osd_cb, p);
}
-static int get_displayattribtype(const char *name)
-{
- if (!strcmp(name, "brightness"))
- return VADisplayAttribBrightness;
- else if (!strcmp(name, "contrast"))
- return VADisplayAttribContrast;
- else if (!strcmp(name, "saturation"))
- return VADisplayAttribSaturation;
- else if (!strcmp(name, "hue"))
- return VADisplayAttribHue;
- return -1;
-}
-
-static int get_display_attribute(struct priv *p, const char *name)
-{
- int type = get_displayattribtype(name);
- for (int n = 0; n < p->va_num_display_attrs; n++) {
- VADisplayAttribute *attr = &p->va_display_attrs[n];
- if (attr->type == type)
- return n;
- }
- return -1;
-}
-
-static int mp_eq_to_va(VADisplayAttribute * const attr, int mpvalue)
-{
- /* normalize to attribute value range */
- int r = attr->max_value - attr->min_value;
- if (r == 0)
- return INT_MIN; // assume INT_MIN is outside allowed min/max range
- return ((mpvalue + 100) * r + 100) / 200 + attr->min_value;
-}
-
-static int get_equalizer(struct priv *p, const char *name, int *value)
-{
- int index = get_display_attribute(p, name);
- if (index < 0)
- return VO_NOTIMPL;
-
- VADisplayAttribute *attr = &p->va_display_attrs[index];
-
- if (!(attr->flags & VA_DISPLAY_ATTRIB_GETTABLE))
- return VO_NOTIMPL;
-
- /* normalize to -100 .. 100 range */
- int r = attr->max_value - attr->min_value;
- if (r == 0)
- return VO_NOTIMPL;
-
- *value = ((attr->value - attr->min_value) * 200 + r / 2) / r - 100;
- if (mp_eq_to_va(attr, p->mp_display_attr[index]) == attr->value)
- *value = p->mp_display_attr[index];
-
- return VO_TRUE;
-}
-
-static int set_equalizer(struct priv *p, const char *name, int value)
-{
- VAStatus status;
- int index = get_display_attribute(p, name);
- if (index < 0)
- return VO_NOTIMPL;
-
- VADisplayAttribute *attr = &p->va_display_attrs[index];
-
- if (!(attr->flags & VA_DISPLAY_ATTRIB_SETTABLE))
- return VO_NOTIMPL;
-
- int r = mp_eq_to_va(attr, value);
- if (r == INT_MIN)
- return VO_NOTIMPL;
-
- attr->value = r;
- p->mp_display_attr[index] = value;
-
- MP_VERBOSE(p, "Changing '%s' (range [%d, %d]) to %d\n", name,
- attr->max_value, attr->min_value, attr->value);
-
- status = vaSetDisplayAttributes(p->display, attr, 1);
- if (!CHECK_VA_STATUS(p, "vaSetDisplayAttributes()"))
- return VO_FALSE;
- return VO_TRUE;
-}
-
static int control(struct vo *vo, uint32_t request, void *data)
{
struct priv *p = vo->priv;
switch (request) {
- case VOCTRL_SET_EQUALIZER: {
- struct voctrl_set_equalizer_args *eq = data;
- return set_equalizer(p, eq->name, eq->value);
- }
- case VOCTRL_GET_EQUALIZER: {
- struct voctrl_get_equalizer_args *eq = data;
- return get_equalizer(p, eq->name, eq->valueptr);
- }
case VOCTRL_REDRAW_FRAME:
p->output_surface = p->visible_surface;
draw_osd(vo);
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index eb89301e94..ada3fb805b 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -135,9 +135,6 @@ struct vdpctx {
int render_count;
int change_id;
} osd_surfaces[MAX_OSD_PARTS];
-
- // Video equalizer
- struct mp_csp_equalizer video_eq;
};
static bool status_ok(struct vo *vo);
@@ -1026,6 +1023,7 @@ static int preinit(struct vo *vo)
hwdec_devices_add(vo->hwdec_devs, &vc->mpvdp->hwctx);
vc->video_mixer = mp_vdpau_mixer_create(vc->mpvdp, vo->log);
+ vc->video_mixer->video_eq = mp_csp_equalizer_create(vo, vo->global);
if (mp_vdpau_guess_if_emulated(vc->mpvdp)) {
MP_WARN(vo, "VDPAU is most likely emulated via VA-API.\n"
@@ -1044,35 +1042,9 @@ static int preinit(struct vo *vo)
vc->vdp->bitmap_surface_query_capabilities(vc->vdp_device, VDP_RGBA_FORMAT_A8,
&vc->supports_a8, &(uint32_t){0}, &(uint32_t){0});
- vc->video_eq.capabilities = MP_CSP_EQ_CAPS_COLORMATRIX;
-
return 0;
}
-static int get_equalizer(struct vo *vo, const char *name, int *value)
-{
- struct vdpctx *vc = vo->priv;
-
- if (vc->rgb_mode)
- return false;
-
- return mp_csp_equalizer_get(&vc->video_mixer->video_eq, name, value) >= 0 ?
- VO_TRUE : VO_NOTIMPL;
-}
-
-static int set_equalizer(struct vo *vo, const char *name, int value)
-{
- struct vdpctx *vc = vo->priv;
-
- if (vc->rgb_mode)
- return false;
-
- if (mp_csp_equalizer_set(&vc->video_mixer->video_eq, name, value) < 0)
- return VO_NOTIMPL;
- vc->video_mixer->initialized = false;
- return true;
-}
-
static void checked_resize(struct vo *vo)
{
if (!status_ok(vo))
@@ -1090,15 +1062,9 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_SET_PANSCAN:
checked_resize(vo);
return VO_TRUE;
- case VOCTRL_SET_EQUALIZER: {
+ case VOCTRL_SET_EQUALIZER:
vo->want_redraw = true;
- struct voctrl_set_equalizer_args *args = data;
- return set_equalizer(vo, args->name, args->value);
- }
- case VOCTRL_GET_EQUALIZER: {
- struct voctrl_get_equalizer_args *args = data;
- return get_equalizer(vo, args->name, args->valueptr);
- }
+ return true;
case VOCTRL_RESET:
forget_frames(vo, true);
return true;
diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c
index 82d7c8bd7c..7c710f20ac 100644
--- a/video/out/vo_xv.c
+++ b/video/out/vo_xv.c
@@ -878,15 +878,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_SET_PANSCAN:
resize(vo);
return VO_TRUE;
- case VOCTRL_SET_EQUALIZER: {
- vo->want_redraw = true;
- struct voctrl_set_equalizer_args *args = data;
- return xv_set_eq(vo, ctx->xv_port, args->name, args->value);
- }
- case VOCTRL_GET_EQUALIZER: {
- struct voctrl_get_equalizer_args *args = data;
- return xv_get_eq(vo, ctx->xv_port, args->name, args->valueptr);
- }
case VOCTRL_REDRAW_FRAME:
draw_image(vo, ctx->original_image);
return true;