From 85c8556eef9ccdb6b172f64a0016bc16f8a092fb Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 2 Mar 2017 11:33:05 +0100 Subject: hw_videotoolbox: allow using native decoder output format Depends on FFmpeg commit ade7c1a2326e2bb9b. It has yet to show whether it actually does what it should. Probably doesn't. --- video/decode/hw_videotoolbox.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/decode/hw_videotoolbox.c b/video/decode/hw_videotoolbox.c index 8d8c165a84..b343b1de0e 100644 --- a/video/decode/hw_videotoolbox.c +++ b/video/decode/hw_videotoolbox.c @@ -105,8 +105,14 @@ static int init_decoder(struct lavc_ctx *ctx, int w, int h) if (!vtctx) return -1; - vtctx->cv_pix_fmt_type = - mp_imgfmt_to_cvpixelformat(ctx->opts->videotoolbox_format); + int imgfmt = ctx->opts->videotoolbox_format; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 81, 103) + if (!imgfmt) + imgfmt = IMGFMT_NV12; +#endif + vtctx->cv_pix_fmt_type = mp_imgfmt_to_cvpixelformat(imgfmt); + MP_VERBOSE(ctx, "Requesting cv_pix_fmt_type=0x%x\n", + (unsigned)vtctx->cv_pix_fmt_type); int err = av_videotoolbox_default_init2(ctx->avctx, vtctx); if (err < 0) { -- cgit v1.2.3