This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new 5b9a3ad71a avfilter/vf_signature: remove dependency on libavformat
5b9a3ad71a is described below
commit 5b9a3ad71a4b54979e7afc3a1a4269763c4f41fc
Author: James Almer <[email protected]>
AuthorDate: Wed Sep 9 17:31:36 2026 -0300
Commit: James Almer <[email protected]>
CommitDate: Tue Sep 15 00:24:07 2026 -0300
avfilter/vf_signature: remove dependency on libavformat
av_get_frame_filename() is a trivial function that uses no lavf API, only
lavu,
so it can be duplicated here to save an unnecessary dependency.
Signed-off-by: James Almer <[email protected]>
---
configure | 4 ++--
libavfilter/vf_signature.c | 59 +++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 58 insertions(+), 5 deletions(-)
diff --git a/configure b/configure
index 8108198565..046a0bd005 100755
--- a/configure
+++ b/configure
@@ -4246,7 +4246,7 @@ select_filter_select="scene_sad"
sharpness_vaapi_filter_deps="vaapi"
showcqt_filter_deps="avformat swscale"
showcqt_filter_suggest="libfontconfig libfreetype"
-signature_filter_deps="gpl avcodec avformat"
+signature_filter_deps="gpl avcodec"
smartblur_filter_deps="gpl swscale"
sobel_opencl_filter_deps="opencl"
sofalizer_filter_deps="libmysofa"
@@ -8217,7 +8217,7 @@ enabled sab_filter && prepend avfilter_deps
"swscale"
enabled scale_filter && prepend avfilter_deps "swscale"
enabled scale2ref_filter && prepend avfilter_deps "swscale"
enabled showcqt_filter && prepend avfilter_deps "avformat swscale"
-enabled signature_filter && prepend avfilter_deps "avcodec avformat"
+enabled signature_filter && prepend avfilter_deps "avcodec"
enabled smartblur_filter && prepend avfilter_deps "swscale"
enabled spp_filter && prepend avfilter_deps "avcodec"
enabled sr_filter && prepend avfilter_deps "avformat swscale"
diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
index 76fab4d6fa..b655b08a87 100644
--- a/libavfilter/vf_signature.c
+++ b/libavfilter/vf_signature.c
@@ -25,8 +25,8 @@
*/
#include "libavcodec/put_bits.h"
-#include "libavformat/avformat.h"
#include "libavutil/mem.h"
+#include "libavutil/bprint.h"
#include "libavutil/opt.h"
#include "libavutil/avstring.h"
#include "libavutil/file_open.h"
@@ -555,6 +555,59 @@ static int binary_export(AVFilterContext *ctx,
StreamContext *sc, const char* fi
return 0;
}
+static int get_frame_filename(char *buf, int buf_size, const char *path,
int64_t number)
+{
+ AVBPrint bp;
+ const char *p;
+ char c;
+ int nd, percentd_found;
+
+ av_bprint_init_for_buffer(&bp, buf, buf_size);
+ p = path;
+ percentd_found = 0;
+ for (;;) {
+ c = *p++;
+ if (c == '\0')
+ break;
+ if (c == '%') {
+ do {
+ nd = 0;
+ while (av_isdigit(*p)) {
+ if (nd >= INT_MAX / 10 - 255)
+ goto fail;
+ nd = nd * 10 + *p++ - '0';
+ }
+ c = *p++;
+ } while (av_isdigit(c));
+
+ switch (c) {
+ case '%':
+ goto addchar;
+ case 'd':
+ if (!percentd_found)
+ goto fail;
+ percentd_found = 1;
+ if (number < 0)
+ nd += 1;
+ av_bprintf(&bp, "%0*" PRId64, nd, number);
+ break;
+ default:
+ goto fail;
+ }
+ } else {
+addchar:
+ av_bprint_chars(&bp, c, 1);
+ }
+ }
+ if (!percentd_found)
+ goto fail;
+ if (!av_bprint_is_complete(&bp))
+ return AVERROR(ENOMEM);
+ return 0;
+fail:
+ return AVERROR(EINVAL);
+}
+
static int export(AVFilterContext *ctx, StreamContext *sc, int input)
{
SignatureContext* sic = ctx->priv;
@@ -562,7 +615,7 @@ static int export(AVFilterContext *ctx, StreamContext *sc,
int input)
if (sic->nb_inputs > 1) {
/* error already handled */
- av_assert0(av_get_frame_filename(filename, sizeof(filename),
sic->filename, input) == 0);
+ av_assert0(get_frame_filename(filename, sizeof(filename),
sic->filename, input) == 0);
} else {
if (av_strlcpy(filename, sic->filename, sizeof(filename)) >=
sizeof(filename))
return AVERROR(EINVAL);
@@ -673,7 +726,7 @@ static av_cold int init(AVFilterContext *ctx)
}
/* check filename */
- if (sic->nb_inputs > 1 && strlen(sic->filename) > 0 &&
av_get_frame_filename(tmp, sizeof(tmp), sic->filename, 0) == -1) {
+ if (sic->nb_inputs > 1 && strlen(sic->filename) > 0 &&
get_frame_filename(tmp, sizeof(tmp), sic->filename, 0) == -1) {
av_log(ctx, AV_LOG_ERROR, "The filename must contain %%d or %%0nd, if
you have more than one input.\n");
return AVERROR(EINVAL);
}
--
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]