From 0d3176e32f351d18d6174d8b05796829a75a4c6b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 7 Nov 2016 13:34:21 +0100 Subject: hwcontext_dxva2: do not assume the destination format during mapping is always the right one Handle the cases where it is unsupported or unset. --- libavutil/hwcontext_dxva2.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libavutil/hwcontext_dxva2.c') diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c index 600cf0eec7..8a050719b7 100644 --- a/libavutil/hwcontext_dxva2.c +++ b/libavutil/hwcontext_dxva2.c @@ -345,6 +345,10 @@ static int dxva2_map_from(AVHWFramesContext *ctx, { int err; + if (dst->format != AV_PIX_FMT_NONE && dst->format != ctx->sw_format) + return AVERROR(ENOSYS); + dst->format = ctx->sw_format; + err = dxva2_map_frame(ctx, dst, src, flags); if (err < 0) return err; -- cgit v1.2.3