---
 libavcodec/utils.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index bc1beee..8fe1771 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1113,6 +1113,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
                 ret = AVERROR(EINVAL);
                 goto free_and_end;
             }
+            if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE &&
+                avctx->sw_pix_fmt != frames_ctx->sw_format) {
+                av_log(avctx, AV_LOG_ERROR,
+                       "Mismatching AVCodecContext.sw_pix_fmt and 
AVHWFramesContext.sw_format\n");
+                ret = AVERROR(EINVAL);
+                goto free_and_end;
+            }
+            avctx->sw_pix_fmt = frames_ctx->sw_format;
         }
     }
 
-- 
2.0.0

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

Reply via email to