diff options
author | wm4 <wm4@nowhere> | 2015-01-26 02:11:14 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-26 02:11:14 +0100 |
commit | 73d5e396fee7de11c525495d066f40d28e3c242b (patch) | |
tree | 6f0ff331be1a437ccc82b0c208d89fd05f16611a /video/out/vo_opengl.c | |
parent | 9fc15e5e1c97984b428eaf4c60004fa7ddbcfde2 (diff) | |
download | mpv-73d5e396fee7de11c525495d066f40d28e3c242b.tar.bz2 mpv-73d5e396fee7de11c525495d066f40d28e3c242b.tar.xz |
vo_opengl: minor changes to ICC update code
Merge update_icc_profile() into get_and_update_icc_profile() - there's
no reason anymore to keep them separate. The former is only called by
the latter, and the separation of responsibilities between them is
blurry a best.
Query the ICC profile only if the corresponding feature is actually
enabled. Additionally, change the error behavior of this code. Make
loading failure non-fatal, and distinguish between runtime error and
unimplemented functionality.
Fix a memory leak in gl_lcms.c (although the changes in vo_opengl.c
already take care of this, it's just logical and cleaner).
Diffstat (limited to 'video/out/vo_opengl.c')
-rw-r--r-- | video/out/vo_opengl.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index 0cd8d49343..329a022ab0 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -54,6 +54,7 @@ struct gl_priv { struct vo *vo; + struct mp_log *log; MPGLContext *glctx; GL *gl; @@ -248,8 +249,22 @@ static void call_request_hwdec_api(struct mp_hwdec_info *info, vo_control(vo, VOCTRL_LOAD_HWDEC_API, (void *)api_name); } -static bool update_icc_profile(struct gl_priv *p) +static bool get_and_update_icc_profile(struct gl_priv *p, int *events) { + if (p->icc_opts->profile_auto) { + MP_VERBOSE(p, "Querying ICC profile...\n"); + bstr icc; + int r = p->glctx->vo_control(p->vo, events, VOCTRL_GET_ICC_PROFILE, &icc); + + if (r == VO_TRUE) { + gl_lcms_set_memory_profile(p->cms, &icc); + } else if (r == VO_NOTIMPL) { + MP_ERR(p, "icc-profile-auto not implemented on this platform.\n"); + } else { + MP_ERR(p, "Could not retrieve an ICC profile.\n"); + } + } + struct lut3d *lut3d = NULL; if (!gl_lcms_has_changed(p->cms)) return true; @@ -260,23 +275,6 @@ static bool update_icc_profile(struct gl_priv *p) return true; } -static bool get_and_update_icc_profile(struct gl_priv *p, int *events) -{ - bstr icc; - int r = p->glctx->vo_control(p->vo, events, VOCTRL_GET_ICC_PROFILE, &icc); - - if (r == VO_FALSE) { - MP_WARN(p->vo, "Could not retrieve an ICC profile.\n"); - return false; - } - - if (r == VO_TRUE) { - gl_lcms_set_memory_profile(p->cms, &icc); - } - - return update_icc_profile(p); -} - static bool reparse_cmdline(struct gl_priv *p, char *args) { struct m_config *cfg = NULL; @@ -407,6 +405,7 @@ static int preinit(struct vo *vo) { struct gl_priv *p = vo->priv; p->vo = vo; + p->log = vo->log; int vo_flags = 0; |