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

Git pushed a commit to branch master
in repository ffmpeg.

commit 1bbac3643b79a52a154170620530fb5ea4dd38d7
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Mon Feb 23 23:14:52 2026 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Tue Mar 10 13:52:19 2026 +0100

    avfilter/avf_showspectrum: Avoid allocation
    
    Also fixes an instance of shadowing.
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavfilter/avf_showspectrum.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 2d87660fa4..0345b4458d 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -30,6 +30,7 @@
 
 #include <float.h>
 #include <math.h>
+#include <stdio.h>
 
 #include "libavutil/mem.h"
 #include "libavutil/tx.h"
@@ -951,17 +952,13 @@ static int draw_legend(AVFilterContext *ctx, uint64_t 
samples)
         }
 
         for (y = 0; ch == 0 && y < h + 5; y += 25) {
-            static const char *log_fmt = "%.0f";
-            static const char *lin_fmt = "%.3f";
             const float a = av_clipf(1.f - y / (float)(h - 1), 0.f, 1.f);
             const float value = s->scale == LOG ? log10f(get_iscale(ctx, 
s->scale, a)) * 20.f : get_iscale(ctx, s->scale, a);
-            char *text;
+            char scale_fmt[32];
 
-            text = av_asprintf(s->scale == LOG ? log_fmt : lin_fmt, value);
-            if (!text)
-                continue;
-            drawtext(s->outpicref, s->w + s->start_x + 35, s->start_y + y - 3, 
text, 0);
-            av_free(text);
+            snprintf(scale_fmt, sizeof(scale_fmt),
+                     s->scale == LOG ? "%.0f" : "%.3f", value);
+            drawtext(s->outpicref, s->w + s->start_x + 35, s->start_y + y - 3, 
scale_fmt, 0);
         }
     }
 

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

Reply via email to