Module: libav
Branch: master
Commit: 0d3176e32f351d18d6174d8b05796829a75a4c6b

Author:    Anton Khirnov <[email protected]>
Committer: Anton Khirnov <[email protected]>
Date:      Mon Nov  7 13:34:21 2016 +0100

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(+)

diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c
index 600cf0e..8a05071 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;

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to