diff options
author | Niklas Haas <git@nand.wakku.to> | 2015-02-28 01:05:51 +0100 |
---|---|---|
committer | Niklas Haas <git@nand.wakku.to> | 2015-02-28 01:08:32 +0100 |
commit | 729c8b3f641e633474be612e66388c131a1b5c92 (patch) | |
tree | 9607bdc48f018c64f70911b8e79526b31abbfaa1 /video/image_writer.c | |
parent | fbacd5de31de964f7cd562304ab1c9b4a0d76015 (diff) | |
download | mpv-729c8b3f641e633474be612e66388c131a1b5c92.tar.bz2 mpv-729c8b3f641e633474be612e66388c131a1b5c92.tar.xz |
screenshots: add support for csp tagging
This relies on upstream support in lavc, and will hence basically not
work at all. The intent is to get support for writing this information
into ffmpeg's PNG encoders etc.
Diffstat (limited to 'video/image_writer.c')
-rw-r--r-- | video/image_writer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/video/image_writer.c b/video/image_writer.c index ff321cfd1f..ab00b5bb01 100644 --- a/video/image_writer.c +++ b/video/image_writer.c @@ -50,6 +50,7 @@ const struct image_writer_opts image_writer_opts_defaults = { .jpeg_dpi = 72, .jpeg_progressive = 0, .jpeg_baseline = 1, + .tag_csp = 1, }; #define OPT_BASE_STRUCT struct image_writer_opts @@ -65,6 +66,7 @@ const struct m_sub_options image_writer_conf = { OPT_INTRANGE("png-compression", png_compression, 0, 0, 9), OPT_INTRANGE("png-filter", png_filter, 0, 0, 5), OPT_STRING("format", format, 0), + OPT_FLAG("tag-colorspace", tag_csp, 0), {0}, }, .size = sizeof(struct image_writer_opts), @@ -131,6 +133,10 @@ static int write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp) pic->format = avctx->pix_fmt; pic->width = avctx->width; pic->height = avctx->height; + if (ctx->opts->tag_csp) { + pic->color_primaries = mp_csp_prim_to_avcol_pri(image->params.primaries); + pic->color_trc = mp_csp_trc_to_avcol_trc(image->params.gamma); + } int ret = avcodec_encode_video2(avctx, &pkt, pic, &got_output); if (ret < 0) goto error_exit; |