mirror of
https://github.com/mpv-player/mpv
synced 2025-02-05 14:42:24 +00:00
vo_opengl: minor renderer option access refactor
Reduce accesses to the renderer opts in vo_opengl.c, and instead add accessors for them to video.c. I suppose gamma and maybe icc-auto could be moved to vo_opengl.c options. Also, the output colorspace could probably be adjusted to what is really used, not just the options (although it's possible that this commit changes this, due to video.c mutating its own copy of the options according to actual renderer capapbilities). But don't deal with this now.
This commit is contained in:
parent
4fa6bcbb90
commit
b2657814c9
@ -594,6 +594,19 @@ static void uninit_rendering(struct gl_video *p)
|
||||
gl_sc_reset_error(p->sc);
|
||||
}
|
||||
|
||||
bool gl_video_gamma_auto_enabled(struct gl_video *p)
|
||||
{
|
||||
return p->opts.gamma_auto;
|
||||
}
|
||||
|
||||
struct mp_colorspace gl_video_get_output_colorspace(struct gl_video *p)
|
||||
{
|
||||
return (struct mp_colorspace) {
|
||||
.primaries = p->opts.target_prim,
|
||||
.gamma = p->opts.target_trc,
|
||||
};
|
||||
}
|
||||
|
||||
// Warning: profile.start must point to a ta allocation, and the function
|
||||
// takes over ownership.
|
||||
void gl_video_set_icc_profile(struct gl_video *p, bstr icc_data)
|
||||
|
@ -167,6 +167,8 @@ float gl_video_scale_ambient_lux(float lmin, float lmax,
|
||||
void gl_video_set_ambient_lux(struct gl_video *p, int lux);
|
||||
void gl_video_set_icc_profile(struct gl_video *p, bstr icc_data);
|
||||
bool gl_video_icc_auto_enabled(struct gl_video *p);
|
||||
bool gl_video_gamma_auto_enabled(struct gl_video *p);
|
||||
struct mp_colorspace gl_video_get_output_colorspace(struct gl_video *p);
|
||||
|
||||
void gl_video_set_gl_state(struct gl_video *p);
|
||||
void gl_video_unset_gl_state(struct gl_video *p);
|
||||
|
@ -242,7 +242,7 @@ static void get_and_update_ambient_lighting(struct gl_priv *p)
|
||||
if (r == VO_TRUE) {
|
||||
gl_video_set_ambient_lux(p->renderer, lux);
|
||||
}
|
||||
if (r != VO_TRUE && p->renderer_opts->gamma_auto) {
|
||||
if (r != VO_TRUE && gl_video_gamma_auto_enabled(p->renderer)) {
|
||||
MP_ERR(p, "gamma_auto option provided, but querying for ambient"
|
||||
" lighting is not supported on this platform\n");
|
||||
}
|
||||
@ -306,10 +306,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||
struct mp_image *screen = gl_read_window_contents(p->gl);
|
||||
// set image parameters according to the display, if possible
|
||||
if (screen) {
|
||||
screen->params.color = (struct mp_colorspace) {
|
||||
.primaries = p->renderer_opts->target_prim,
|
||||
.gamma = p->renderer_opts->target_trc,
|
||||
};
|
||||
screen->params.color = gl_video_get_output_colorspace(p->renderer);
|
||||
if (p->glctx->flip_v)
|
||||
mp_image_vflip(screen);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user