diff options
author | wm4 <wm4@nowhere> | 2015-10-23 11:36:17 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-10-23 12:09:14 +0200 |
commit | 53c720d412c5ae20848510b3a51df07305d7b708 (patch) | |
tree | 49c32cd9ff645ab3d2cdb75a9b5d21004bc1d7aa /video/out | |
parent | 878f12885b7c847cda07635ad303db6be33b6684 (diff) | |
download | mpv-53c720d412c5ae20848510b3a51df07305d7b708.tar.bz2 mpv-53c720d412c5ae20848510b3a51df07305d7b708.tar.xz |
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.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/vo_opengl_cb.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/video/out/vo_opengl_cb.c b/video/out/vo_opengl_cb.c index ecf02ff8c3..2be18bb7d7 100644 --- a/video/out/vo_opengl_cb.c +++ b/video/out/vo_opengl_cb.c @@ -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; |