screenshots: check for AVFrame csp support

Apparently, libav stable is old enough to not have these fields.
This commit is contained in:
Niklas Haas 2015-02-28 01:39:31 +01:00
parent 729c8b3f64
commit 653b0dd529
No known key found for this signature in database
GPG Key ID: 3BA77D4BFDB10BCE
3 changed files with 15 additions and 0 deletions

View File

@ -813,6 +813,12 @@ api_statement_check \
libavutil/frame.h \
'av_frame_get_metadata(NULL)'
api_statement_check \
"libavutil AVFrame colorspace information" \
HAVE_AVFRAME_CSP \
libavutil/frame.h \
'AVFrame frame; frame.color_primaries = frame.color_trc = 0;'
api_statement_check \
"libavutil AVFrame skip samples metadata" \
HAVE_AVFRAME_SKIP_SAMPLES \

View File

@ -133,10 +133,12 @@ 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 HAVE_AVFRAME_CSP
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);
}
#endif
int ret = avcodec_encode_video2(avctx, &pkt, pic, &got_output);
if (ret < 0)
goto error_exit;

View File

@ -462,6 +462,13 @@ Libav libraries ({0}). Aborting.".format(" ".join(libav_pkg_config_checks))
'func': check_statement('libavutil/frame.h',
'enum AVFrameSideDataType type = AV_FRAME_DATA_SKIP_SAMPLES',
use='libav')
}, {
'name': 'avframe-csp',
'desc': 'libavutil AVFrame colorspace information',
'func': check_statement('libavutil/frame.h',
'AVFrame frame;'
'frame.color_primaries = frame.color_trc = 0;',
use='libav')
}
]