diff options
author | wm4 <nfxjfg@googlemail.com> | 2017-06-22 14:52:56 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2017-06-27 00:23:12 +0200 |
commit | 5030e3856c2126fb829edb828f5aae011d178eb4 (patch) | |
tree | 42468d567d3fe69893e9d452cc7313e7ca21b79d /libavutil/hwcontext_d3d11va.c | |
parent | 98d73e4174333b37d961b79e1182be5a02156c02 (diff) | |
download | ffmpeg-5030e3856c2126fb829edb828f5aae011d178eb4.tar.gz |
dxva: support DXGI_FORMAT_420_OPAQUE decoding
Some devices (some phones, apparently) will support only this opaque
format. Of course this won't work with CLI, because copying data
directly is not supported.
Automatic frame allocation (setting AVCodecContext.hw_device_ctx) does
not support this mode, even if it's the only supported mode. But since
opaque surfaces are generally less useful, that's probably ok.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavutil/hwcontext_d3d11va.c')
-rw-r--r-- | libavutil/hwcontext_d3d11va.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 523a6d2dc6..376c76e5cf 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -83,8 +83,11 @@ static const struct { DXGI_FORMAT d3d_format; enum AVPixelFormat pix_fmt; } supported_formats[] = { - { DXGI_FORMAT_NV12, AV_PIX_FMT_NV12 }, - { DXGI_FORMAT_P010, AV_PIX_FMT_P010 }, + { DXGI_FORMAT_NV12, AV_PIX_FMT_NV12 }, + { DXGI_FORMAT_P010, AV_PIX_FMT_P010 }, + // Special opaque formats. The pix_fmt is merely a place holder, as the + // opaque format cannot be accessed directly. + { DXGI_FORMAT_420_OPAQUE, AV_PIX_FMT_YUV420P }, }; static void d3d11va_default_lock(void *ctx) @@ -270,6 +273,7 @@ static int d3d11va_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats) { + D3D11VAFramesContext *s = ctx->internal->priv; enum AVPixelFormat *fmts; fmts = av_malloc_array(2, sizeof(*fmts)); @@ -279,6 +283,10 @@ static int d3d11va_transfer_get_formats(AVHWFramesContext *ctx, fmts[0] = ctx->sw_format; fmts[1] = AV_PIX_FMT_NONE; + // Don't signal support for opaque formats. Actual access would fail. + if (s->format == DXGI_FORMAT_420_OPAQUE) + fmts[0] = AV_PIX_FMT_NONE; + *formats = fmts; return 0; |