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

Git pushed a commit to branch master
in repository ffmpeg.

commit bc5362e327330457aeddf5ec3abd3f0047f974ab
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Oct 19 19:58:57 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Sat Oct 31 13:37:58 2026 +0100

    avfilter/vf_libplacebo: factor out map_output() and unmap_output()
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Sponsored-by: nxtedition AB
    Signed-off-by: Niklas Haas <[email protected]>
---
 libavfilter/vf_libplacebo.c | 53 ++++++++++++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 20 deletions(-)

diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 6189f21c50..ff06171e8a 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -958,14 +958,43 @@ static void update_crops(AVFilterContext *ctx, 
LibplaceboInput *in,
     }
 }
 
+static int map_output(LibplaceboContext *s, AVFrame *out, struct pl_frame 
*target)
+{
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(out->format);
+    bool ok;
+
+    if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
+        ok = pl_map_avframe_ex(s->gpu, target, pl_avframe_params(
+            .frame    = out,
+            .map_dovi = false,
+        ));
+    } else {
+        ok = pl_frame_recreate_from_avframe(s->gpu, target, s->tex, out);
+    }
+
+    return ok ? 0 : AVERROR_EXTERNAL;
+}
+
+static int unmap_output(LibplaceboContext *s, struct pl_frame *target, AVFrame 
*out)
+{
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(out->format);
+
+    if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
+        pl_unmap_avframe(s->gpu, target);
+    } else if (!pl_download_avframe(s->gpu, target, out)) {
+        return AVERROR_EXTERNAL;
+    }
+
+    return 0;
+}
+
 /* Construct and emit an output frame for a given timestamp */
 static int output_frame(AVFilterContext *ctx, int64_t pts)
 {
-    int err = 0, ok, changed = 0;
+    int err = 0, changed = 0;
     LibplaceboContext *s = ctx->priv;
     pl_options opts = s->opts;
     AVFilterLink *outlink = ctx->outputs[0];
-    const AVPixFmtDescriptor *outdesc = av_pix_fmt_desc_get(outlink->format);
     const double target_pts = TS2T(pts, outlink->time_base);
     struct pl_frame target;
     const AVFrame *ref = NULL;
@@ -1048,18 +1077,7 @@ props_done:
         out->duration = 1;
 
     /* Map, render and unmap output frame */
-    if (outdesc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
-        ok = pl_map_avframe_ex(s->gpu, &target, pl_avframe_params(
-            .frame    = out,
-            .map_dovi = false,
-        ));
-    } else {
-        ok = pl_frame_recreate_from_avframe(s->gpu, &target, s->tex, out);
-    }
-    if (!ok) {
-        err = AVERROR_EXTERNAL;
-        goto fail;
-    }
+    RET(map_output(s, out, &target));
 
     struct pl_frame orig_target = target;
     bool use_linear_compositor = false;
@@ -1116,12 +1134,7 @@ props_done:
         pl_render_image(s->linear_rr, NULL, &target, &opts->params);
     }
 
-    if (outdesc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
-        pl_unmap_avframe(s->gpu, &target);
-    } else if (!pl_download_avframe(s->gpu, &target, out)) {
-        err = AVERROR_EXTERNAL;
-        goto fail;
-    }
+    RET(unmap_output(s, &target, out));
     return ff_filter_frame(outlink, out);
 
 fail:

-- 
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