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

Git pushed a commit to branch master
in repository ffmpeg.

commit d6a22cda380385b453c1753aa8cc0289ab8227fd
Author:     James Almer <[email protected]>
AuthorDate: Fri Mar 27 19:31:38 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Sat Mar 28 20:14:13 2026 +0000

    avcodec/decode: add a hwaccel specific post_process callback to 
FrameDecodeData
    
    Leave the existing one for non decoder-specific, post processing usage.
    With this, scenarios like nvdec decoding can work algonside lcevc 
enhancement application.
    
    Signed-off-by: James Almer <[email protected]>
---
 libavcodec/decode.c       | 8 ++++++++
 libavcodec/decode.h       | 4 ++++
 libavcodec/nvdec.c        | 2 +-
 libavcodec/videotoolbox.c | 2 +-
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 4ce05ea820..6923db6a6f 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -692,6 +692,14 @@ static int decode_receive_frame_internal(AVCodecContext 
*avctx, AVFrame *frame,
         if (frame->private_ref) {
             FrameDecodeData *fdd = frame->private_ref;
 
+            if (fdd->hwaccel_priv_post_process) {
+                ret = fdd->hwaccel_priv_post_process(avctx, frame);
+                if (ret < 0) {
+                    av_frame_unref(frame);
+                    return ret;
+                }
+            }
+
             if (fdd->post_process) {
                 ret = fdd->post_process(avctx, frame);
                 if (ret < 0) {
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index b31ef79166..c74ed5e62c 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -47,7 +47,11 @@ typedef struct FrameDecodeData {
 
     /**
      * Per-frame private data for hwaccels.
+     *
+     * Same as @ref post_process, but used only by some hwaccels to retrieve or
+     * finalize frames, and executed first.
      */
+    int (*hwaccel_priv_post_process)(void *logctx, AVFrame *frame);
     void *hwaccel_priv;
     void (*hwaccel_priv_free)(void *priv);
 } FrameDecodeData;
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 60becd2733..911fc336c7 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -600,7 +600,7 @@ int ff_nvdec_start_frame(AVCodecContext *avctx, AVFrame 
*frame)
 
     fdd->hwaccel_priv      = cf;
     fdd->hwaccel_priv_free = nvdec_fdd_priv_free;
-    fdd->post_process      = nvdec_retrieve_data;
+    fdd->hwaccel_priv_post_process = nvdec_retrieve_data;
 
     return 0;
 fail:
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 2cd22cba1a..7d68a3cd4f 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -168,7 +168,7 @@ int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, 
AVFrame *frame)
     frame->buf[0] = buf;
 
     fdd = frame->private_ref;
-    fdd->post_process = videotoolbox_postproc_frame;
+    fdd->hwaccel_priv_post_process = videotoolbox_postproc_frame;
 
     frame->width  = avctx->width;
     frame->height = avctx->height;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to