[FFmpeg-devel] [PATCH] avcodec/dovi_rpu: make ff_dovi_configure_ext() take an AVCodecContext as input argument

Anton Khirnov anton at khirnov.net
Thu Nov 28 14:57:01 EET 2024


Quoting James Almer (2024-11-27 14:31:35)
> @@ -222,10 +223,25 @@ static int dovi_rpu_init(AVBSFContext *bsf)
>  
>              s->enc.cfg = *cfg;
>          } else {
> +            AVCodecContext *avctx;
>              av_log(bsf, AV_LOG_WARNING, "No Dolby Vision configuration record "
>                     "found? Generating one, but results may be invalid.\n");
> -            ret = ff_dovi_configure_ext(&s->enc, bsf->par_out, NULL, s->compression,
> +            avctx = avcodec_alloc_context3(NULL);
> +            if (!avctx)
> +                return AVERROR(ENOMEM);
> +            ret = avcodec_parameters_to_context(avctx, bsf->par_in);
> +            if (ret < 0) {
> +                avcodec_free_context(&avctx);
> +                return ret;
> +            }
> +            ret = ff_dovi_configure_ext(&s->enc, avctx, NULL, s->compression,
>                                          FF_COMPLIANCE_NORMAL);
> +            if (ret < 0) {
> +                avcodec_free_context(&avctx);
> +                return ret;
> +            }
> +            ret = avcodec_parameters_from_context(bsf->par_out, avctx);

This still seems a bit too scorched-earth to me. I'd prefer to give
ff_dovi_configure_ext() a side data list as a parameter and have it
modify that.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list