mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-02-13 19:05:37 +00:00
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@gmx.at>
This commit is contained in:
parent
74080ded96
commit
3393cd8545
1 changed files with 3 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue