[FFmpeg-devel] [PATCH v2 7/7] avcodec: add AV_CODEC_FLAG_CLEAR

Vittorio Giovara vittorio.giovara at gmail.com
Thu Dec 7 04:37:30 EET 2023


On Wed, Dec 6, 2023 at 3:23 AM Marton Balint <cus at passwd.hu> wrote:

> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 2cfb3fcf97..f9b18a2c35 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1675,6 +1675,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
>
>      validate_avframe_allocation(avctx, frame);
>
> +    if (avctx->flags & AV_CODEC_FLAG_CLEAR && avctx->codec_type ==
> AVMEDIA_TYPE_VIDEO) {
> +        uint32_t color[4] = {0};
> +        ptrdiff_t linesize[4] = {frame->linesize[0], frame->linesize[1],
> frame->linesize[2], frame->linesize[3]};
> +        av_image_fill_color(frame->data, linesize, frame->format, color,
> frame->width, frame->height);
>

I think it's be safer to add a return check here
-- 
Vittorio


More information about the ffmpeg-devel mailing list