summaryrefslogtreecommitdiffstats
path: root/video/decode/d3d.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-10-27 17:22:32 +0200
committerwm4 <wm4@nowhere>2017-10-27 18:08:20 +0200
commitf36d152eb7fed4cee9e2f0f37370fddfdfe2cef6 (patch)
treed87cdfccb9bbd7c8c3869c3d8b812a19269d3c35 /video/decode/d3d.c
parent4701c5ba4f87ca35f66d574e89eba8c7d4514783 (diff)
downloadmpv-f36d152eb7fed4cee9e2f0f37370fddfdfe2cef6.tar.bz2
mpv-f36d152eb7fed4cee9e2f0f37370fddfdfe2cef6.tar.xz
vd_lavc: use avcodec_fill_hw_frames_parameters() API
This removes the need for codec- and API-specific knowledge in the libavcodec hardware acceleration API user. For mpv, this removes the need for vd_lavc_hwdec.pixfmt_map and a few other things. (For now, we still keep the "old" parts for the sake of supporting older Libav, and FFgarbage.)
Diffstat (limited to 'video/decode/d3d.c')
-rw-r--r--video/decode/d3d.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/video/decode/d3d.c b/video/decode/d3d.c
index cb323f9b01..a40cc90f7d 100644
--- a/video/decode/d3d.c
+++ b/video/decode/d3d.c
@@ -80,6 +80,18 @@ bool d3d11_check_decoding(ID3D11Device *dev)
return !FAILED(hr) && (supported & D3D11_BIND_DECODER);
}
+#if HAVE_AVCODEC_HW_FRAMES_PARAMS
+void d3d_hwframes_refine(struct lavc_ctx *ctx, AVBufferRef *hw_frames_ctx)
+{
+ AVHWFramesContext *fctx = (void *)hw_frames_ctx->data;
+
+ if (fctx->format == AV_PIX_FMT_D3D11) {
+ AVD3D11VAFramesContext *hwctx = fctx->hwctx;
+
+ hwctx->BindFlags |= D3D11_BIND_SHADER_RESOURCE;
+ }
+}
+#else
void d3d_hwframes_refine(struct lavc_ctx *ctx, AVBufferRef *hw_frames_ctx)
{
AVHWFramesContext *fctx = (void *)hw_frames_ctx->data;
@@ -119,6 +131,7 @@ void d3d_hwframes_refine(struct lavc_ctx *ctx, AVBufferRef *hw_frames_ctx)
hwctx->BindFlags |= D3D11_BIND_SHADER_RESOURCE;
}
}
+#endif
AVBufferRef *d3d11_wrap_device_ref(ID3D11Device *device)
{