summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-03-24 14:20:58 -0400
committersfan5 <sfan5@live.de>2024-03-27 22:08:56 +0100
commitf4a7931c534158d254a4a36f289494c1de6a16b9 (patch)
treed2fa5a5821e7511837f8e31db7db94a27802fd73
parent3f17b18a33f57043b97c590c3fc8ea5385adbd0f (diff)
downloadmpv-f4a7931c534158d254a4a36f289494c1de6a16b9.tar.bz2
mpv-f4a7931c534158d254a4a36f289494c1de6a16b9.tar.xz
vo_gpu: support video-target-params
-rw-r--r--video/out/gpu/video.c21
-rw-r--r--video/out/gpu/video.h1
-rw-r--r--video/out/vo_gpu.c5
3 files changed, 27 insertions, 0 deletions
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 3764e5d712..1478ec4687 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -183,6 +183,7 @@ struct gl_video {
struct mp_image_params real_image_params; // configured format
struct mp_image_params image_params; // texture format (mind hwdec case)
+ struct mp_image_params target_params; // target format
struct ra_imgfmt_desc ra_format; // texture format
int plane_count;
@@ -2726,6 +2727,21 @@ static void pass_colormanage(struct gl_video *p, struct pl_color_space src,
// Adapt from src to dst as necessary
pass_color_map(p->sc, p->use_linear && !osd, src, dst, src_light, dst_light, &tone_map);
+ if (!osd) {
+ struct mp_csp_params cparams = MP_CSP_PARAMS_DEFAULTS;
+ mp_csp_equalizer_state_get(p->video_eq, &cparams);
+ if (cparams.levels_out == PL_COLOR_LEVELS_UNKNOWN)
+ cparams.levels_out = PL_COLOR_LEVELS_FULL;
+ p->target_params = (struct mp_image_params){
+ .imgfmt_name = p->fbo_format ? p->fbo_format->name : "unknown",
+ .w = p->texture_w,
+ .h = p->texture_h,
+ .color = dst,
+ .repr = {.sys = PL_COLOR_SYSTEM_RGB, .levels = cparams.levels_out},
+ .rotate = p->image_params.rotate,
+ };
+ }
+
if (p->use_lut_3d && (flags & RENDER_SCREEN_COLOR)) {
gl_sc_uniform_texture(p->sc, "lut_3d", p->lut_3d_texture);
GLSL(vec3 cpos;)
@@ -4375,3 +4391,8 @@ void gl_video_load_hwdecs_for_img_fmt(struct gl_video *p, struct mp_hwdec_device
assert(p->hwdec_ctx.ra_ctx);
ra_hwdec_ctx_load_fmt(&p->hwdec_ctx, devs, params);
}
+
+struct mp_image_params *gl_video_get_target_params_ptr(struct gl_video *p)
+{
+ return &p->target_params;
+}
diff --git a/video/out/gpu/video.h b/video/out/gpu/video.h
index a929970686..66ccd9c850 100644
--- a/video/out/gpu/video.h
+++ b/video/out/gpu/video.h
@@ -232,5 +232,6 @@ void gl_video_configure_queue(struct gl_video *p, struct vo *vo);
struct mp_image *gl_video_get_image(struct gl_video *p, int imgfmt, int w, int h,
int stride_align, int flags);
+struct mp_image_params *gl_video_get_target_params_ptr(struct gl_video *p);
#endif
diff --git a/video/out/vo_gpu.c b/video/out/vo_gpu.c
index 0d9b488abf..d49a6ba8a2 100644
--- a/video/out/vo_gpu.c
+++ b/video/out/vo_gpu.c
@@ -85,6 +85,11 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
MP_ERR(vo, "Failed presenting frame!\n");
return;
}
+
+ struct mp_image_params *params = gl_video_get_target_params_ptr(p->renderer);
+ mp_mutex_lock(&vo->params_mutex);
+ vo->target_params = params;
+ mp_mutex_unlock(&vo->params_mutex);
}
static void flip_page(struct vo *vo)