[FFmpeg-cvslog] lavc: set sw_pix_fmt for hwaccel encoding

Anton Khirnov git at videolan.org
Sun Mar 12 14:23:48 EET 2017


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Jul 14 12:13:53 2016 +0200| [f65285aba0df7d46298abe0c945dfee05cbc6028] | committer: Anton Khirnov

lavc: set sw_pix_fmt for hwaccel encoding

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f65285aba0df7d46298abe0c945dfee05cbc6028
---

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

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index bc1beee..4184b95 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1113,6 +1113,17 @@ 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 (%s) "
+                       "and AVHWFramesContext.sw_format (%s)\n",
+                       av_get_pix_fmt_name(avctx->sw_pix_fmt),
+                       av_get_pix_fmt_name(frames_ctx->sw_format));
+                ret = AVERROR(EINVAL);
+                goto free_and_end;
+            }
+            avctx->sw_pix_fmt = frames_ctx->sw_format;
         }
     }
 



More information about the ffmpeg-cvslog mailing list