On 11/28/2024 10:13 AM, Anton Khirnov wrote:
Quoting James Almer (2024-11-28 13:58:46)
On 11/28/2024 9:57 AM, Anton Khirnov wrote:
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.

It still checks a bunch of fields in codecpar/avctx (read only), not
just side data, so it needs one of those.

Right, but that can be made const, and you avoid nuking and overwriting
the entire source context just because one side data instance changed.

Well, in here I'm doing par_int -> avctx -> par_out, which behaves like how the bsf API expects the in/out codecpar should be handled, even though yes, par_out side data gets nuked because it was already filled by the generic code.

But ok, I'll just make ff_dovi_configure_ext take a const avctx and a side data array.

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to