diff options
author | softworkz <softworkz@hotmail.com> | 2025-04-29 01:35:50 +0200 |
---|---|---|
committer | softworkz <softworkz@hotmail.com> | 2025-05-15 23:04:44 +0200 |
commit | cee7b8a051739d9fa6b41f961ecec480cdaa02bd (patch) | |
tree | e6e29b87d6ec9aa4b45a77988ce81e750109bbb4 /fftools/textformat/tf_ini.c | |
parent | e4830b8c5e589ae77d4e1c9dc68a1a6240cfc3c3 (diff) | |
download | ffmpeg-cee7b8a051739d9fa6b41f961ecec480cdaa02bd.tar.gz |
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>
Diffstat (limited to 'fftools/textformat/tf_ini.c')
-rw-r--r-- | fftools/textformat/tf_ini.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/fftools/textformat/tf_ini.c b/fftools/textformat/tf_ini.c index dd77d0e8bf..8959785295 100644 --- a/fftools/textformat/tf_ini.c +++ b/fftools/textformat/tf_ini.c @@ -28,21 +28,7 @@ #include "libavutil/bprint.h" #include "libavutil/opt.h" - -#define writer_w8(wctx_, b_) (wctx_)->writer->writer->writer_w8((wctx_)->writer, b_) -#define writer_put_str(wctx_, str_) (wctx_)->writer->writer->writer_put_str((wctx_)->writer, str_) -#define writer_printf(wctx_, fmt_, ...) (wctx_)->writer->writer->writer_printf((wctx_)->writer, fmt_, __VA_ARGS__) - -#define DEFINE_FORMATTER_CLASS(name) \ -static const char *name##_get_name(void *ctx) \ -{ \ - return #name ; \ -} \ -static const AVClass name##_class = { \ - .class_name = #name, \ - .item_name = name##_get_name, \ - .option = name##_options \ -} +#include "tf_internal.h" /* Default output */ @@ -104,9 +90,11 @@ static void ini_print_section_header(AVTextFormatContext *wctx, const void *data { INIContext *ini = wctx->priv; AVBPrint *buf = &wctx->section_pbuf[wctx->level]; - const struct AVTextFormatSection *section = wctx->section[wctx->level]; - const struct AVTextFormatSection *parent_section = wctx->level ? - wctx->section[wctx->level-1] : NULL; + const AVTextFormatSection *section = tf_get_section(wctx, wctx->level); + const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level); + + if (!section) + return; av_bprint_clear(buf); if (!parent_section) { |