summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--video/decode/d3d.c5
-rw-r--r--video/decode/vd_lavc.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/video/decode/d3d.c b/video/decode/d3d.c
index bdc907bd71..c7b2afd470 100644
--- a/video/decode/d3d.c
+++ b/video/decode/d3d.c
@@ -87,7 +87,10 @@ void d3d_hwframes_refine(struct lavc_ctx *ctx, AVBufferRef *hw_frames_ctx)
if (fctx->format == AV_PIX_FMT_D3D11) {
AVD3D11VAFramesContext *hwctx = fctx->hwctx;
- hwctx->BindFlags |= D3D11_BIND_SHADER_RESOURCE;
+ // According to hwcontex_d3d11va.h, yuv420p means DXGI_FORMAT_420_OPAQUE,
+ // which has no shader support.
+ if (fctx->sw_format != AV_PIX_FMT_YUV420P)
+ hwctx->BindFlags |= D3D11_BIND_SHADER_RESOURCE;
}
}
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index c455dbdab6..2e144ac409 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -725,6 +725,8 @@ static int init_generic_hwaccel(struct dec_video *vd, enum AVPixelFormat hw_fmt)
if (hwdec->image_format == IMGFMT_VIDEOTOOLBOX)
new_fctx->sw_format = imgfmt2pixfmt(vd->opts->videotoolbox_format);
+ if (vd->opts->hwdec_image_format)
+ new_fctx->sw_format = imgfmt2pixfmt(vd->opts->hwdec_image_format);
// The video output might not support all formats.
// Note that supported_formats==NULL means any are accepted.