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: cbbe2e5221
This commit is contained in:
sfan5 2023-07-17 23:16:46 +02:00
parent 157ef77427
commit a960b75604
3 changed files with 7 additions and 5 deletions

View File

@ -4334,11 +4334,11 @@ Screenshot
:avif: AVIF :avif: AVIF
``--screenshot-tag-colorspace=<yes|no>`` ``--screenshot-tag-colorspace=<yes|no>``
Tag screenshots with the appropriate colorspace. Tag screenshots with the appropriate colorspace (default: yes).
Note that not all formats are supported. Note that not all formats support this. When it is unsupported, or when
this option is disabled, screenshots will be converted to sRGB before
Default: ``yes``. being written.
``--screenshot-high-bit-depth=<yes|no>`` ``--screenshot-high-bit-depth=<yes|no>``
If possible, write screenshots with a bit depth similar to the source If possible, write screenshots with a bit depth similar to the source

View File

@ -350,7 +350,7 @@ static struct mp_image *screenshot_get(struct MPContext *mpctx, int mode,
.subs = mode != 0, .subs = mode != 0,
.osd = mode == MODE_FULL_WINDOW, .osd = mode == MODE_FULL_WINDOW,
.high_bit_depth = high_depth && imgopts->high_bit_depth, .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) if (!mpctx->opts->screenshot_sw)
vo_control(mpctx->video_out, VOCTRL_SCREENSHOT, &ctrl); vo_control(mpctx->video_out, VOCTRL_SCREENSHOT, &ctrl);

View File

@ -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) bool image_writer_flexible_csp(const struct image_writer_opts *opts)
{ {
if (!opts->tag_csp)
return false;
return false return false
#if HAVE_JPEGXL #if HAVE_JPEGXL
|| opts->format == AV_CODEC_ID_JPEGXL || opts->format == AV_CODEC_ID_JPEGXL