1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

fftools/textformat: Introduce common header and deduplicate code

Also change writer_printf signature in AVTextWriter to use va_list,
so that it can be called by the new function writer_printf()
in tf_internal.h.

Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
This commit is contained in:
softworkz
2025-04-29 01:35:50 +02:00
parent e4830b8c5e
commit cee7b8a051
11 changed files with 160 additions and 141 deletions

View File

@@ -56,14 +56,11 @@ static void buffer_put_str(AVTextWriterContext *wctx, const char *str)
av_bprintf(ctx->buffer, "%s", str);
}
static void buffer_printf(AVTextWriterContext *wctx, const char *fmt, ...)
static void buffer_vprintf(AVTextWriterContext *wctx, const char *fmt, va_list vl)
{
BufferWriterContext *ctx = wctx->priv;
va_list vargs;
va_start(vargs, fmt);
av_vbprintf(ctx->buffer, fmt, vargs);
va_end(vargs);
av_vbprintf(ctx->buffer, fmt, vl);
}
@@ -72,7 +69,7 @@ const AVTextWriter avtextwriter_buffer = {
.priv_size = sizeof(BufferWriterContext),
.priv_class = &bufferwriter_class,
.writer_put_str = buffer_put_str,
.writer_printf = buffer_printf,
.writer_vprintf = buffer_vprintf,
.writer_w8 = buffer_w8
};