mirror of
https://github.com/mpv-player/mpv
synced 2024-12-28 18:12:22 +00:00
vo_opengl_cb: fix passing through some video equalizer properties
The equalizer code as it exists in vo_opengl works perfectly fine. The situation in vo_opengl_cb is pretty different. The playback thread can't communicate with the renderer thread synchronously (essentially to give the API user more flexibility). So the equalizer communication has to be done in an asynchronous way too. There were two problems. First, the eq capabilities can change with the pixel format, and the renderer initializes them on config only. This means equalizers were disabled on the first config run, and options like --video-output-levels or --brightness would not work. So we just initialize the caps with a known superset. The player will not correctly indicate when setting an eq doesn't work, but we're fine with it, as it is a relatively cosmetic issue. Second, it copied back the eq settings in the "wrong" moment (what for?), which overwrote the settings in some cases. Third, the eq was not reset correctly on vo init. This is needed to make it behave the same as vo_opengl.
This commit is contained in:
parent
878f12885b
commit
53c720d412
@ -241,7 +241,10 @@ int mpv_opengl_cb_init_gl(struct mpv_opengl_cb_context *ctx, const char *exts,
|
||||
ctx->hwdec_info.hwctx = ctx->hwdec->hwctx;
|
||||
|
||||
pthread_mutex_lock(&ctx->lock);
|
||||
ctx->eq = *gl_video_eq_ptr(ctx->renderer);
|
||||
// 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);
|
||||
@ -324,6 +327,7 @@ 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) {
|
||||
struct vo_priv *p = vo ? vo->priv : NULL;
|
||||
@ -352,7 +356,6 @@ int mpv_opengl_cb_draw(mpv_opengl_cb_context *ctx, int fbo, int vp_w, int vp_h)
|
||||
gl_video_eq_update(ctx->renderer);
|
||||
}
|
||||
ctx->eq_changed = false;
|
||||
ctx->eq = *eq;
|
||||
|
||||
struct vo_frame *frame = frame_queue_pop(ctx);
|
||||
if (frame) {
|
||||
@ -613,6 +616,8 @@ static int preinit(struct vo *vo)
|
||||
p->ctx->reconfigured = true;
|
||||
p->ctx->update_new_opts = true;
|
||||
copy_vo_opts(vo);
|
||||
memset(p->ctx->eq.values, 0, sizeof(p->ctx->eq.values));
|
||||
p->ctx->eq_changed = true;
|
||||
pthread_mutex_unlock(&p->ctx->lock);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user