summaryrefslogtreecommitdiffstats
path: root/video/out/vo_opengl.c
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2015-01-07 18:47:27 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2015-01-07 18:47:27 +0100
commitf811348d0caabccdc72100c7d7d2f9df8332518a (patch)
tree99d41cf5ad4ffcda57f1b3fa4b8fe3d87d3f8fa5 /video/out/vo_opengl.c
parentd66598eeed10175b946fda8c76712714f578bb56 (diff)
downloadmpv-f811348d0caabccdc72100c7d7d2f9df8332518a.tar.bz2
mpv-f811348d0caabccdc72100c7d7d2f9df8332518a.tar.xz
vo_opengl: add support for in memory icc profiles
Previously we just forced loading a profile from file, but that has poor integration for querying the OS / display server for an ICC profile, and generating profiles on the fly (which we might use in the future for creating preset 3dluts). Also changed the previous icc-profile-auto code to use this mechanism, and moved gl_lcms to be an opaque type with state instead of just providing pure functions.
Diffstat (limited to 'video/out/vo_opengl.c')
-rw-r--r--video/out/vo_opengl.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index b4e5ecd660..2ed3785154 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -59,6 +59,7 @@ struct gl_priv {
GL *gl;
struct gl_video *renderer;
+ struct gl_lcms *cms;
struct gl_hwdec *hwdec;
struct mp_hwdec_info hwdec_info;
@@ -242,13 +243,9 @@ static void call_request_hwdec_api(struct mp_hwdec_info *info,
static bool update_icc_profile(struct gl_priv *p)
{
- struct mp_icc_opts *opts = p->icc_opts;
struct lut3d *lut3d = NULL;
- if (opts->profile) {
- lut3d = mp_load_icc(opts, p->vo->log, p->vo->global);
- if (!lut3d)
- return false;
- }
+ if (gl_lcms_get_lut3d(p->cms, &lut3d) && !lut3d)
+ return false;
gl_video_set_lut3d(p->renderer, lut3d);
talloc_free(lut3d);
return true;
@@ -256,20 +253,19 @@ static bool update_icc_profile(struct gl_priv *p)
static bool get_and_update_icc_profile(struct gl_priv *p)
{
- if (!p->icc_opts->profile_auto)
- return update_icc_profile(p);
+ bstr icc;
+ int r = p->glctx->vo_control(p->vo, NULL, VOCTRL_GET_ICC_PROFILE, &icc);
- char *icc = NULL;
- int r = p->glctx->vo_control(p->vo, NULL, VOCTRL_GET_ICC_PROFILE_PATH, &icc);
- if (r != VO_TRUE) {
+ if (r == VO_FALSE) {
MP_WARN(p->vo, "Could not retrieve an ICC profile.\n");
- return true; // no error if the system doesn't have any
+ return false;
}
- if (mp_icc_set_profile(p->icc_opts, icc))
- return update_icc_profile(p);
+ if (r == VO_TRUE) {
+ gl_lcms_set_memory_profile(p->cms, &icc);
+ }
- return true;
+ return update_icc_profile(p);
}
static bool reparse_cmdline(struct gl_priv *p, char *args)
@@ -430,6 +426,11 @@ static int preinit(struct vo *vo)
gl_video_set_output_depth(p->renderer, p->glctx->depth_r, p->glctx->depth_g,
p->glctx->depth_b);
gl_video_set_options(p->renderer, p->renderer_opts);
+
+ p->cms = gl_lcms_init(p, vo->log, vo->global);
+ if (!p->cms)
+ goto err_out;
+ gl_lcms_set_options(p->cms, p->icc_opts);
if (!get_and_update_icc_profile(p))
goto err_out;