mirror of https://github.com/mpv-player/mpv
screenshots: check for AVFrame csp support
Apparently, libav stable is old enough to not have these fields.
This commit is contained in:
parent
729c8b3f64
commit
653b0dd529
|
@ -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 \
|
||||
|
|
|
@ -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;
|
||||
|
|
7
wscript
7
wscript
|
@ -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')
|
||||
}
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue