From a960b756045f37eccec43bfb06e9e51c4f245f55 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 17 Jul 2023 23:16:46 +0200 Subject: [PATCH] image_writer: move tag_csp check into image_writer_flexible_csp() This ensures the sRGB fallback to happen in all situations involving the image writer code, notably --screenshot-sw. fixes: cbbe2e52210d9885a0897e9c7833267a60456c56 --- DOCS/man/options.rst | 8 ++++---- player/screenshot.c | 2 +- video/image_writer.c | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index a40d6befb0..fab91dd3d2 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -4334,11 +4334,11 @@ Screenshot :avif: AVIF ``--screenshot-tag-colorspace=`` - Tag screenshots with the appropriate colorspace. + Tag screenshots with the appropriate colorspace (default: yes). - Note that not all formats are supported. - - Default: ``yes``. + Note that not all formats support this. When it is unsupported, or when + this option is disabled, screenshots will be converted to sRGB before + being written. ``--screenshot-high-bit-depth=`` If possible, write screenshots with a bit depth similar to the source diff --git a/player/screenshot.c b/player/screenshot.c index 1feeba2133..30810e3d6f 100644 --- a/player/screenshot.c +++ b/player/screenshot.c @@ -350,7 +350,7 @@ static struct mp_image *screenshot_get(struct MPContext *mpctx, int mode, .subs = mode != 0, .osd = mode == MODE_FULL_WINDOW, .high_bit_depth = high_depth && imgopts->high_bit_depth, - .native_csp = imgopts->tag_csp && image_writer_flexible_csp(imgopts), + .native_csp = image_writer_flexible_csp(imgopts), }; if (!mpctx->opts->screenshot_sw) vo_control(mpctx->video_out, VOCTRL_SCREENSHOT, &ctrl); diff --git a/video/image_writer.c b/video/image_writer.c index 6edd79ae31..9d3087c461 100644 --- a/video/image_writer.c +++ b/video/image_writer.c @@ -587,6 +587,8 @@ bool image_writer_high_depth(const struct image_writer_opts *opts) bool image_writer_flexible_csp(const struct image_writer_opts *opts) { + if (!opts->tag_csp) + return false; return false #if HAVE_JPEGXL || opts->format == AV_CODEC_ID_JPEGXL