summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-03-02 11:33:05 +0100
committerwm4 <wm4@nowhere>2017-03-02 11:49:12 +0100
commit85c8556eef9ccdb6b172f64a0016bc16f8a092fb (patch)
tree54d1201411ba937c47d7567b5cedca326b31d91d /video
parent0aa01ca7434ba94bcc3d4093458701d596690d50 (diff)
downloadmpv-85c8556eef9ccdb6b172f64a0016bc16f8a092fb.tar.bz2
mpv-85c8556eef9ccdb6b172f64a0016bc16f8a092fb.tar.xz
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.
Diffstat (limited to 'video')
-rw-r--r--video/decode/hw_videotoolbox.c10
1 files changed, 8 insertions, 2 deletions
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) {