1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-06 07:00:30 +00:00

video/image_writer: add image_writer_flexible_csp

PNG only supports this since the introduction of cICP, so put a version
check on the next API version bump after the cICP writing patch got
merged.
This commit is contained in:
Niklas Haas 2023-02-13 20:59:46 +01:00 committed by Niklas Haas
parent 862be6c237
commit 01351a6412
2 changed files with 16 additions and 0 deletions

View File

@ -332,6 +332,19 @@ bool image_writer_high_depth(const struct image_writer_opts *opts)
;
}
bool image_writer_flexible_csp(const struct image_writer_opts *opts)
{
return false
#if HAVE_JPEGXL
|| opts->format == AV_CODEC_ID_JPEGXL
#endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 58, 100)
// This version added support for cICP tag writing
|| opts->format == AV_CODEC_ID_PNG
#endif
;
}
int image_writer_format_from_ext(const char *ext)
{
for (int n = 0; mp_image_writer_formats[n].name; n++) {

View File

@ -50,6 +50,9 @@ const char *image_writer_file_ext(const struct image_writer_opts *opts);
// Return whether the selected format likely supports >8 bit per component.
bool image_writer_high_depth(const struct image_writer_opts *opts);
// Return whether the selected format likely supports non-sRGB colorspaces
bool image_writer_flexible_csp(const struct image_writer_opts *opts);
// Map file extension to format ID - return 0 (which is invalid) if unknown.
int image_writer_format_from_ext(const char *ext);