[FFmpeg-cvslog] avcodec/utils: check AVframe.format being set in avcodec_encode_video2()
Michael Niedermayer
git at videolan.org
Sun Dec 7 02:45:05 CET 2014
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Dec 7 02:10:19 2014 +0100| [3393cd85459cb9c23dec90373da91559987000ee] | committer: Michael Niedermayer
avcodec/utils: check AVframe.format being set in avcodec_encode_video2()
We dont fail hard if its not set as the old API allowed this and our examples
did in the distant past not set it, these examples still work with the
current code and some encoders.
Based on suggestion by: funman
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3393cd85459cb9c23dec90373da91559987000ee
---
libavcodec/utils.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 66fe62c..a75fe1a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2088,6 +2088,9 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
if (av_image_check_size(avctx->width, avctx->height, 0, avctx))
return AVERROR(EINVAL);
+ if (frame && frame->format == AV_PIX_FMT_NONE)
+ av_log(avctx, AV_LOG_WARNING, "AVFrame.format is not set\n");
+
av_assert0(avctx->codec->encode2);
ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
More information about the ffmpeg-cvslog
mailing list