summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2022-02-25 14:21:31 +0100
committerNiklas Haas <git@haasn.dev>2022-02-25 14:22:03 +0100
commit626fa506d5237cd178e3fb5dbd524e73ad449ee8 (patch)
treefb18a3492223e9b15be8010a33ca84b277065464 /video/out
parente6c18641bd52375bc3429ec2771f4fdfede5dc1e (diff)
downloadmpv-626fa506d5237cd178e3fb5dbd524e73ad449ee8.tar.bz2
mpv-626fa506d5237cd178e3fb5dbd524e73ad449ee8.tar.xz
vo_gpu_next: avoid rendering subtitles as HDR/wide gamut
Fixes #9911
Diffstat (limited to 'video/out')
-rw-r--r--video/out/vo_gpu_next.c10
1 files changed, 9 insertions, 1 deletions
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;