This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit ccb51e6bf062d7138650209bcce47e789af7a1ed
Author:     Lynne <[email protected]>
AuthorDate: Sun Jul 19 18:39:45 2026 +0800
Commit:     Lynne <[email protected]>
CommitDate: Mon Aug 17 14:57:07 2026 +0900

    hw_base_encode: allow allocating reconstruction frames via a callback
    
    APIs which do not use a frames context for reconstruction images can
    provide them through it instead of recon_frames_ref.
---
 libavcodec/hw_base_encode.c | 8 ++++++--
 libavcodec/hw_base_encode.h | 3 +++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index 927aeb4bad..307e76ed79 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -441,14 +441,18 @@ static int hw_base_encode_send_frame(AVCodecContext 
*avctx, FFHWBaseEncodeContex
             goto fail;
         }
 
-        if (ctx->recon_frames_ref) {
+        if (ctx->recon_frames_ref || ctx->get_recon_frame) {
             pic->recon_image = av_frame_alloc();
             if (!pic->recon_image) {
                 err = AVERROR(ENOMEM);
                 goto fail;
             }
 
-            err = av_hwframe_get_buffer(ctx->recon_frames_ref, 
pic->recon_image, 0);
+            if (ctx->get_recon_frame)
+                err = ctx->get_recon_frame(avctx, pic->recon_image);
+            else
+                err = av_hwframe_get_buffer(ctx->recon_frames_ref,
+                                            pic->recon_image, 0);
             if (err < 0) {
                 err = AVERROR(ENOMEM);
                 goto fail;
diff --git a/libavcodec/hw_base_encode.h b/libavcodec/hw_base_encode.h
index e768579722..6b84bd0b5a 100644
--- a/libavcodec/hw_base_encode.h
+++ b/libavcodec/hw_base_encode.h
@@ -156,6 +156,9 @@ typedef struct FFHWBaseEncodeContext {
     AVBufferRef    *recon_frames_ref;
     AVHWFramesContext *recon_frames;
 
+    /* Allocates a reconstruction frame; used instead of recon_frames_ref */
+    int          (*get_recon_frame)(AVCodecContext *avctx, AVFrame *frame);
+
     // Current encoding window, in display (input) order.
     FFHWBaseEncodePicture *pic_start, *pic_end;
     // The next picture to use as the previous reference picture in

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to