From 626fa506d5237cd178e3fb5dbd524e73ad449ee8 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Fri, 25 Feb 2022 14:21:31 +0100 Subject: vo_gpu_next: avoid rendering subtitles as HDR/wide gamut Fixes #9911 --- video/out/vo_gpu_next.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'video/out') diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 67e44e90cd..5f200663cf 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -280,10 +280,18 @@ static void update_overlays(struct vo *vo, struct mp_osd_res res, double pts, .tex = entry->tex, .parts = entry->parts, .num_parts = entry->num_parts, - .color = frame->color, + .color.primaries = frame->color.primaries, + .color.transfer = frame->color.transfer, .coords = PL_OVERLAY_COORDS_DST_FRAME, }; + // Reject HDR/wide gamut subtitles out of the box, since these are + // probably not intended to match the video color space. + if (pl_color_primaries_is_wide_gamut(ol->color.primaries)) + ol->color.primaries = PL_COLOR_PRIM_UNKNOWN; + if (pl_color_transfer_is_hdr(ol->color.transfer)) + ol->color.transfer = PL_COLOR_TRC_UNKNOWN; + switch (item->format) { case SUBBITMAP_BGRA: ol->mode = PL_OVERLAY_NORMAL; -- cgit v1.2.3