Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: softworkz <ffmpegagent-at-gmail.com@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: softworkz <softworkz@hotmail.com>
Subject: [FFmpeg-devel] [PATCH 1/3] fftools/textformat: Rename variables wctx to tctx
Date: Thu, 03 Jul 2025 01:55:23 +0000
Message-ID: <8c97d3273e89af56cef1bd41aafbd7af34c712c0.1751507725.git.ffmpegagent@gmail.com> (raw)
In-Reply-To: <pull.104.ffstaging.FFmpeg.1751507725.ffmpegagent@gmail.com>

From: softworkz <softworkz@hotmail.com>

Signed-off-by: softworkz <softworkz@hotmail.com>
---
 fftools/textformat/tf_compact.c |  74 +++++------
 fftools/textformat/tf_default.c |  46 +++----
 fftools/textformat/tf_flat.c    |  38 +++---
 fftools/textformat/tf_ini.c     |  36 +++---
 fftools/textformat/tf_json.c    |  84 ++++++-------
 fftools/textformat/tf_mermaid.c | 212 ++++++++++++++++----------------
 fftools/textformat/tf_mermaid.h |   2 +-
 fftools/textformat/tf_xml.c     |  82 ++++++------
 8 files changed, 287 insertions(+), 287 deletions(-)

diff --git a/fftools/textformat/tf_compact.c b/fftools/textformat/tf_compact.c
index c6311b5dea..62717bba0a 100644
--- a/fftools/textformat/tf_compact.c
+++ b/fftools/textformat/tf_compact.c
@@ -113,12 +113,12 @@ static const AVOption compact_options[] = {
 
 DEFINE_FORMATTER_CLASS(compact);
 
-static av_cold int compact_init(AVTextFormatContext *wctx)
+static av_cold int compact_init(AVTextFormatContext *tctx)
 {
-    CompactContext *compact = wctx->priv;
+    CompactContext *compact = tctx->priv;
 
     if (strlen(compact->item_sep_str) != 1) {
-        av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
+        av_log(tctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
                compact->item_sep_str);
         return AVERROR(EINVAL);
     }
@@ -131,26 +131,26 @@ static av_cold int compact_init(AVTextFormatContext *wctx)
     } else if (!strcmp(compact->escape_mode_str, "csv" )) {
         compact->escape_str = csv_escape_str;
     } else {
-        av_log(wctx, AV_LOG_ERROR, "Unknown escape mode '%s'\n", compact->escape_mode_str);
+        av_log(tctx, AV_LOG_ERROR, "Unknown escape mode '%s'\n", compact->escape_mode_str);
         return AVERROR(EINVAL);
     }
 
     return 0;
 }
 
-static void compact_print_section_header(AVTextFormatContext *wctx, const void *data)
+static void compact_print_section_header(AVTextFormatContext *tctx, const void *data)
 {
-    CompactContext *compact = wctx->priv;
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
-    const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
+    CompactContext *compact = tctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
+    const AVTextFormatSection *parent_section = tf_get_parent_section(tctx, tctx->level);
 
     if (!section)
         return;
 
-    compact->terminate_line[wctx->level] = 1;
-    compact->has_nested_elems[wctx->level] = 0;
+    compact->terminate_line[tctx->level] = 1;
+    compact->has_nested_elems[tctx->level] = 0;
 
-    av_bprint_clear(&wctx->section_pbuf[wctx->level]);
+    av_bprint_clear(&tctx->section_pbuf[tctx->level]);
     if (parent_section &&
         (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE ||
             (!(section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) &&
@@ -159,13 +159,13 @@ static void compact_print_section_header(AVTextFormatContext *wctx, const void *
         /* define a prefix for elements not contained in an array or
            in a wrapper, or for array elements with a type */
         const char *element_name = (char *)av_x_if_null(section->element_name, section->name);
-        AVBPrint *section_pbuf = &wctx->section_pbuf[wctx->level];
+        AVBPrint *section_pbuf = &tctx->section_pbuf[tctx->level];
 
-        compact->nested_section[wctx->level] = 1;
-        compact->has_nested_elems[wctx->level - 1] = 1;
+        compact->nested_section[tctx->level] = 1;
+        compact->has_nested_elems[tctx->level - 1] = 1;
 
         av_bprintf(section_pbuf, "%s%s",
-                   wctx->section_pbuf[wctx->level - 1].str, element_name);
+                   tctx->section_pbuf[tctx->level - 1].str, element_name);
 
         if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE) {
             // add /TYPE to prefix
@@ -182,58 +182,58 @@ static void compact_print_section_header(AVTextFormatContext *wctx, const void *
         }
         av_bprint_chars(section_pbuf, ':', 1);
 
-        wctx->nb_item[wctx->level] = wctx->nb_item[wctx->level - 1];
+        tctx->nb_item[tctx->level] = tctx->nb_item[tctx->level - 1];
     } else {
         if (parent_section && !(parent_section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)) &&
-            wctx->level && wctx->nb_item[wctx->level - 1])
-            writer_w8(wctx, compact->item_sep);
+            tctx->level && tctx->nb_item[tctx->level - 1])
+            writer_w8(tctx, compact->item_sep);
         if (compact->print_section &&
             !(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
-            writer_printf(wctx, "%s%c", section->name, compact->item_sep);
+            writer_printf(tctx, "%s%c", section->name, compact->item_sep);
     }
 }
 
-static void compact_print_section_footer(AVTextFormatContext *wctx)
+static void compact_print_section_footer(AVTextFormatContext *tctx)
 {
-    CompactContext *compact = wctx->priv;
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
+    CompactContext *compact = tctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
 
     if (!section)
         return;
 
-    if (!compact->nested_section[wctx->level] &&
-        compact->terminate_line[wctx->level] &&
+    if (!compact->nested_section[tctx->level] &&
+        compact->terminate_line[tctx->level] &&
         !(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
-        writer_w8(wctx, '\n');
+        writer_w8(tctx, '\n');
 }
 
-static void compact_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
+static void compact_print_str(AVTextFormatContext *tctx, const char *key, const char *value)
 {
-    CompactContext *compact = wctx->priv;
+    CompactContext *compact = tctx->priv;
     AVBPrint buf;
 
-    if (wctx->nb_item[wctx->level])
-        writer_w8(wctx, compact->item_sep);
+    if (tctx->nb_item[tctx->level])
+        writer_w8(tctx, compact->item_sep);
 
     if (!compact->nokey)
-        writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
+        writer_printf(tctx, "%s%s=", tctx->section_pbuf[tctx->level].str, key);
 
     av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
-    writer_put_str(wctx, compact->escape_str(&buf, value, compact->item_sep, wctx));
+    writer_put_str(tctx, compact->escape_str(&buf, value, compact->item_sep, tctx));
     av_bprint_finalize(&buf, NULL);
 }
 
-static void compact_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
+static void compact_print_int(AVTextFormatContext *tctx, const char *key, int64_t value)
 {
-    CompactContext *compact = wctx->priv;
+    CompactContext *compact = tctx->priv;
 
-    if (wctx->nb_item[wctx->level])
-        writer_w8(wctx, compact->item_sep);
+    if (tctx->nb_item[tctx->level])
+        writer_w8(tctx, compact->item_sep);
 
     if (!compact->nokey)
-        writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
+        writer_printf(tctx, "%s%s=", tctx->section_pbuf[tctx->level].str, key);
 
-    writer_printf(wctx, "%"PRId64, value);
+    writer_printf(tctx, "%"PRId64, value);
 }
 
 const AVTextFormatter avtextformatter_compact = {
diff --git a/fftools/textformat/tf_default.c b/fftools/textformat/tf_default.c
index 019bda9d44..2c91a8dec4 100644
--- a/fftools/textformat/tf_default.c
+++ b/fftools/textformat/tf_default.c
@@ -62,66 +62,66 @@ static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
     return dst;
 }
 
-static void default_print_section_header(AVTextFormatContext *wctx, const void *data)
+static void default_print_section_header(AVTextFormatContext *tctx, const void *data)
 {
-    DefaultContext *def = wctx->priv;
+    DefaultContext *def = tctx->priv;
     char buf[32];
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
-    const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
+    const AVTextFormatSection *parent_section = tf_get_parent_section(tctx, tctx->level);
 
     if (!section)
         return;
 
-    av_bprint_clear(&wctx->section_pbuf[wctx->level]);
+    av_bprint_clear(&tctx->section_pbuf[tctx->level]);
     if (parent_section &&
         !(parent_section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY))) {
-        def->nested_section[wctx->level] = 1;
-        av_bprintf(&wctx->section_pbuf[wctx->level], "%s%s:",
-                   wctx->section_pbuf[wctx->level - 1].str,
+        def->nested_section[tctx->level] = 1;
+        av_bprintf(&tctx->section_pbuf[tctx->level], "%s%s:",
+                   tctx->section_pbuf[tctx->level - 1].str,
                    upcase_string(buf, sizeof(buf),
                                  av_x_if_null(section->element_name, section->name)));
     }
 
-    if (def->noprint_wrappers || def->nested_section[wctx->level])
+    if (def->noprint_wrappers || def->nested_section[tctx->level])
         return;
 
     if (!(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
-        writer_printf(wctx, "[%s]\n", upcase_string(buf, sizeof(buf), section->name));
+        writer_printf(tctx, "[%s]\n", upcase_string(buf, sizeof(buf), section->name));
 }
 
-static void default_print_section_footer(AVTextFormatContext *wctx)
+static void default_print_section_footer(AVTextFormatContext *tctx)
 {
-    DefaultContext *def = wctx->priv;
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
+    DefaultContext *def = tctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
 
     char buf[32];
 
     if (!section)
         return;
 
-    if (def->noprint_wrappers || def->nested_section[wctx->level])
+    if (def->noprint_wrappers || def->nested_section[tctx->level])
         return;
 
     if (!(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
-        writer_printf(wctx, "[/%s]\n", upcase_string(buf, sizeof(buf), section->name));
+        writer_printf(tctx, "[/%s]\n", upcase_string(buf, sizeof(buf), section->name));
 }
 
-static void default_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
+static void default_print_str(AVTextFormatContext *tctx, const char *key, const char *value)
 {
-    DefaultContext *def = wctx->priv;
+    DefaultContext *def = tctx->priv;
 
     if (!def->nokey)
-        writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
-    writer_printf(wctx, "%s\n", value);
+        writer_printf(tctx, "%s%s=", tctx->section_pbuf[tctx->level].str, key);
+    writer_printf(tctx, "%s\n", value);
 }
 
-static void default_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
+static void default_print_int(AVTextFormatContext *tctx, const char *key, int64_t value)
 {
-    DefaultContext *def = wctx->priv;
+    DefaultContext *def = tctx->priv;
 
     if (!def->nokey)
-        writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
-    writer_printf(wctx, "%"PRId64"\n", value);
+        writer_printf(tctx, "%s%s=", tctx->section_pbuf[tctx->level].str, key);
+    writer_printf(tctx, "%"PRId64"\n", value);
 }
 
 const AVTextFormatter avtextformatter_default = {
diff --git a/fftools/textformat/tf_flat.c b/fftools/textformat/tf_flat.c
index d5517f109b..8c93bc4fb2 100644
--- a/fftools/textformat/tf_flat.c
+++ b/fftools/textformat/tf_flat.c
@@ -52,12 +52,12 @@ static const AVOption flat_options[] = {
 
 DEFINE_FORMATTER_CLASS(flat);
 
-static av_cold int flat_init(AVTextFormatContext *wctx)
+static av_cold int flat_init(AVTextFormatContext *tctx)
 {
-    FlatContext *flat = wctx->priv;
+    FlatContext *flat = tctx->priv;
 
     if (strlen(flat->sep_str) != 1) {
-        av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
+        av_log(tctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
                flat->sep_str);
         return AVERROR(EINVAL);
     }
@@ -99,12 +99,12 @@ static const char *flat_escape_value_str(AVBPrint *dst, const char *src)
     return dst->str;
 }
 
-static void flat_print_section_header(AVTextFormatContext *wctx, const void *data)
+static void flat_print_section_header(AVTextFormatContext *tctx, const void *data)
 {
-    FlatContext *flat = wctx->priv;
-    AVBPrint *buf = &wctx->section_pbuf[wctx->level];
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
-    const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
+    FlatContext *flat = tctx->priv;
+    AVBPrint *buf = &tctx->section_pbuf[tctx->level];
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
+    const AVTextFormatSection *parent_section = tf_get_parent_section(tctx, tctx->level);
 
     if (!section)
         return;
@@ -114,37 +114,37 @@ static void flat_print_section_header(AVTextFormatContext *wctx, const void *dat
     if (!parent_section)
         return;
 
-    av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level - 1].str);
+    av_bprintf(buf, "%s", tctx->section_pbuf[tctx->level - 1].str);
 
     if (flat->hierarchical ||
         !(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY | AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER))) {
-        av_bprintf(buf, "%s%s", wctx->section[wctx->level]->name, flat->sep_str);
+        av_bprintf(buf, "%s%s", tctx->section[tctx->level]->name, flat->sep_str);
 
         if (parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) {
             int n = parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE
-                ? wctx->nb_item_type[wctx->level - 1][section->id]
-                : wctx->nb_item[wctx->level - 1];
+                ? tctx->nb_item_type[tctx->level - 1][section->id]
+                : tctx->nb_item[tctx->level - 1];
 
             av_bprintf(buf, "%d%s", n, flat->sep_str);
         }
     }
 }
 
-static void flat_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
+static void flat_print_int(AVTextFormatContext *tctx, const char *key, int64_t value)
 {
-    writer_printf(wctx, "%s%s=%"PRId64"\n", wctx->section_pbuf[wctx->level].str, key, value);
+    writer_printf(tctx, "%s%s=%"PRId64"\n", tctx->section_pbuf[tctx->level].str, key, value);
 }
 
-static void flat_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
+static void flat_print_str(AVTextFormatContext *tctx, const char *key, const char *value)
 {
-    FlatContext *flat = wctx->priv;
+    FlatContext *flat = tctx->priv;
     AVBPrint buf;
 
-    writer_put_str(wctx, wctx->section_pbuf[wctx->level].str);
+    writer_put_str(tctx, tctx->section_pbuf[tctx->level].str);
     av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
-    writer_printf(wctx, "%s=", flat_escape_key_str(&buf, key, flat->sep));
+    writer_printf(tctx, "%s=", flat_escape_key_str(&buf, key, flat->sep));
     av_bprint_clear(&buf);
-    writer_printf(wctx, "\"%s\"\n", flat_escape_value_str(&buf, value));
+    writer_printf(tctx, "\"%s\"\n", flat_escape_value_str(&buf, value));
     av_bprint_finalize(&buf, NULL);
 }
 
diff --git a/fftools/textformat/tf_ini.c b/fftools/textformat/tf_ini.c
index 8959785295..c62441d151 100644
--- a/fftools/textformat/tf_ini.c
+++ b/fftools/textformat/tf_ini.c
@@ -86,56 +86,56 @@ static char *ini_escape_str(AVBPrint *dst, const char *src)
     return dst->str;
 }
 
-static void ini_print_section_header(AVTextFormatContext *wctx, const void *data)
+static void ini_print_section_header(AVTextFormatContext *tctx, const void *data)
 {
-    INIContext *ini = wctx->priv;
-    AVBPrint *buf = &wctx->section_pbuf[wctx->level];
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
-    const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
+    INIContext *ini = tctx->priv;
+    AVBPrint *buf = &tctx->section_pbuf[tctx->level];
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
+    const AVTextFormatSection *parent_section = tf_get_parent_section(tctx, tctx->level);
 
     if (!section)
         return;
 
     av_bprint_clear(buf);
     if (!parent_section) {
-        writer_put_str(wctx, "# ffprobe output\n\n");
+        writer_put_str(tctx, "# ffprobe output\n\n");
         return;
     }
 
-    if (wctx->nb_item[wctx->level - 1])
-        writer_w8(wctx, '\n');
+    if (tctx->nb_item[tctx->level - 1])
+        writer_w8(tctx, '\n');
 
-    av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level - 1].str);
+    av_bprintf(buf, "%s", tctx->section_pbuf[tctx->level - 1].str);
     if (ini->hierarchical ||
         !(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY | AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER))) {
-        av_bprintf(buf, "%s%s", buf->str[0] ? "." : "", wctx->section[wctx->level]->name);
+        av_bprintf(buf, "%s%s", buf->str[0] ? "." : "", tctx->section[tctx->level]->name);
 
         if (parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) {
             unsigned n = parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE
-                ? wctx->nb_item_type[wctx->level - 1][section->id]
-                : wctx->nb_item[wctx->level - 1];
+                ? tctx->nb_item_type[tctx->level - 1][section->id]
+                : tctx->nb_item[tctx->level - 1];
             av_bprintf(buf, ".%u", n);
         }
     }
 
     if (!(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY | AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER)))
-        writer_printf(wctx, "[%s]\n", buf->str);
+        writer_printf(tctx, "[%s]\n", buf->str);
 }
 
-static void ini_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
+static void ini_print_str(AVTextFormatContext *tctx, const char *key, const char *value)
 {
     AVBPrint buf;
 
     av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
-    writer_printf(wctx, "%s=", ini_escape_str(&buf, key));
+    writer_printf(tctx, "%s=", ini_escape_str(&buf, key));
     av_bprint_clear(&buf);
-    writer_printf(wctx, "%s\n", ini_escape_str(&buf, value));
+    writer_printf(tctx, "%s\n", ini_escape_str(&buf, value));
     av_bprint_finalize(&buf, NULL);
 }
 
-static void ini_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
+static void ini_print_int(AVTextFormatContext *tctx, const char *key, int64_t value)
 {
-    writer_printf(wctx, "%s=%"PRId64"\n", key, value);
+    writer_printf(tctx, "%s=%"PRId64"\n", key, value);
 }
 
 const AVTextFormatter avtextformatter_ini = {
diff --git a/fftools/textformat/tf_json.c b/fftools/textformat/tf_json.c
index 78ea5dc21f..5f17bf8f8d 100644
--- a/fftools/textformat/tf_json.c
+++ b/fftools/textformat/tf_json.c
@@ -49,9 +49,9 @@ static const AVOption json_options[] = {
 
 DEFINE_FORMATTER_CLASS(json);
 
-static av_cold int json_init(AVTextFormatContext *wctx)
+static av_cold int json_init(AVTextFormatContext *tctx)
 {
-    JSONContext *json = wctx->priv;
+    JSONContext *json = tctx->priv;
 
     json->item_sep       = json->compact ? ", " : ",\n";
     json->item_start_end = json->compact ? " "  : "\n";
@@ -84,119 +84,119 @@ static const char *json_escape_str(AVBPrint *dst, const char *src, void *log_ctx
     return dst->str;
 }
 
-#define JSON_INDENT() writer_printf(wctx, "%*c", json->indent_level * 4, ' ')
+#define JSON_INDENT() writer_printf(tctx, "%*c", json->indent_level * 4, ' ')
 
-static void json_print_section_header(AVTextFormatContext *wctx, const void *data)
+static void json_print_section_header(AVTextFormatContext *tctx, const void *data)
 {
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
-    const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
-    JSONContext *json = wctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
+    const AVTextFormatSection *parent_section = tf_get_parent_section(tctx, tctx->level);
+    JSONContext *json = tctx->priv;
     AVBPrint buf;
 
     if (!section)
         return;
 
-    if (wctx->level && wctx->nb_item[wctx->level - 1])
-        writer_put_str(wctx, ",\n");
+    if (tctx->level && tctx->nb_item[tctx->level - 1])
+        writer_put_str(tctx, ",\n");
 
     if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER) {
-        writer_put_str(wctx, "{\n");
+        writer_put_str(tctx, "{\n");
         json->indent_level++;
     } else {
         av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
-        json_escape_str(&buf, section->name, wctx);
+        json_escape_str(&buf, section->name, tctx);
         JSON_INDENT();
 
         json->indent_level++;
         if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) {
-            writer_printf(wctx, "\"%s\": [\n", buf.str);
+            writer_printf(tctx, "\"%s\": [\n", buf.str);
         } else if (parent_section && !(parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)) {
-            writer_printf(wctx, "\"%s\": {%s", buf.str, json->item_start_end);
+            writer_printf(tctx, "\"%s\": {%s", buf.str, json->item_start_end);
         } else {
-            writer_printf(wctx, "{%s", json->item_start_end);
+            writer_printf(tctx, "{%s", json->item_start_end);
 
             /* this is required so the parser can distinguish between packets and frames */
             if (parent_section && parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE) {
                 if (!json->compact)
                     JSON_INDENT();
-                writer_printf(wctx, "\"type\": \"%s\"", section->name);
-                wctx->nb_item[wctx->level]++;
+                writer_printf(tctx, "\"type\": \"%s\"", section->name);
+                tctx->nb_item[tctx->level]++;
             }
         }
         av_bprint_finalize(&buf, NULL);
     }
 }
 
-static void json_print_section_footer(AVTextFormatContext *wctx)
+static void json_print_section_footer(AVTextFormatContext *tctx)
 {
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
-    JSONContext *json = wctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
+    JSONContext *json = tctx->priv;
 
     if (!section)
         return;
 
-    if (wctx->level == 0) {
+    if (tctx->level == 0) {
         json->indent_level--;
-        writer_put_str(wctx, "\n}\n");
+        writer_put_str(tctx, "\n}\n");
     } else if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) {
-        writer_w8(wctx, '\n');
+        writer_w8(tctx, '\n');
         json->indent_level--;
         JSON_INDENT();
-        writer_w8(wctx, ']');
+        writer_w8(tctx, ']');
     } else {
-        writer_put_str(wctx, json->item_start_end);
+        writer_put_str(tctx, json->item_start_end);
         json->indent_level--;
         if (!json->compact)
             JSON_INDENT();
-        writer_w8(wctx, '}');
+        writer_w8(tctx, '}');
     }
 }
 
-static inline void json_print_item_str(AVTextFormatContext *wctx,
+static inline void json_print_item_str(AVTextFormatContext *tctx,
                                        const char *key, const char *value)
 {
     AVBPrint buf;
 
     av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
-    writer_printf(wctx, "\"%s\":", json_escape_str(&buf, key,   wctx));
+    writer_printf(tctx, "\"%s\":", json_escape_str(&buf, key,   tctx));
     av_bprint_clear(&buf);
-    writer_printf(wctx, " \"%s\"", json_escape_str(&buf, value, wctx));
+    writer_printf(tctx, " \"%s\"", json_escape_str(&buf, value, tctx));
     av_bprint_finalize(&buf, NULL);
 }
 
-static void json_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
+static void json_print_str(AVTextFormatContext *tctx, const char *key, const char *value)
 {
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
-    const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
-    JSONContext *json = wctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
+    const AVTextFormatSection *parent_section = tf_get_parent_section(tctx, tctx->level);
+    JSONContext *json = tctx->priv;
 
     if (!section)
         return;
 
-    if (wctx->nb_item[wctx->level] || (parent_section && parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE))
-        writer_put_str(wctx, json->item_sep);
+    if (tctx->nb_item[tctx->level] || (parent_section && parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE))
+        writer_put_str(tctx, json->item_sep);
     if (!json->compact)
         JSON_INDENT();
-    json_print_item_str(wctx, key, value);
+    json_print_item_str(tctx, key, value);
 }
 
-static void json_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
+static void json_print_int(AVTextFormatContext *tctx, const char *key, int64_t value)
 {
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
-    const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
-    JSONContext *json = wctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
+    const AVTextFormatSection *parent_section = tf_get_parent_section(tctx, tctx->level);
+    JSONContext *json = tctx->priv;
     AVBPrint buf;
 
     if (!section)
         return;
 
-    if (wctx->nb_item[wctx->level] || (parent_section && parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE))
-        writer_put_str(wctx, json->item_sep);
+    if (tctx->nb_item[tctx->level] || (parent_section && parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE))
+        writer_put_str(tctx, json->item_sep);
     if (!json->compact)
         JSON_INDENT();
 
     av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
-    writer_printf(wctx, "\"%s\": %"PRId64, json_escape_str(&buf, key, wctx), value);
+    writer_printf(tctx, "\"%s\": %"PRId64, json_escape_str(&buf, key, tctx), value);
     av_bprint_finalize(&buf, NULL);
 }
 
diff --git a/fftools/textformat/tf_mermaid.c b/fftools/textformat/tf_mermaid.c
index 3d864c2e3e..54e0d57bc2 100644
--- a/fftools/textformat/tf_mermaid.c
+++ b/fftools/textformat/tf_mermaid.c
@@ -169,15 +169,15 @@ static const AVOption mermaid_options[] = {
 
 DEFINE_FORMATTER_CLASS(mermaid);
 
-void av_diagram_init(AVTextFormatContext *tfc, AVDiagramConfig *diagram_config)
+void av_diagram_init(AVTextFormatContext *tctx, AVDiagramConfig *diagram_config)
 {
-    MermaidContext *mmc = tfc->priv;
+    MermaidContext *mmc = tctx->priv;
     mmc->diagram_config = diagram_config;
 }
 
-static av_cold int has_link_pair(const AVTextFormatContext *tfc, const char *src, const char *dest)
+static av_cold int has_link_pair(const AVTextFormatContext *tctx, const char *src, const char *dest)
 {
-    MermaidContext *mmc = tfc->priv;
+    MermaidContext *mmc = tctx->priv;
     AVBPrint buf;
 
     av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
@@ -191,9 +191,9 @@ static av_cold int has_link_pair(const AVTextFormatContext *tfc, const char *src
     return 0;
 }
 
-static av_cold int mermaid_init(AVTextFormatContext *tfc)
+static av_cold int mermaid_init(AVTextFormatContext *tctx)
 {
-    MermaidContext *mmc = tfc->priv;
+    MermaidContext *mmc = tctx->priv;
 
     av_bprint_init(&mmc->link_buf, 0, AV_BPRINT_SIZE_UNLIMITED);
 
@@ -201,11 +201,11 @@ static av_cold int mermaid_init(AVTextFormatContext *tfc)
     return 0;
 }
 
-static av_cold int mermaid_init_html(AVTextFormatContext *tfc)
+static av_cold int mermaid_init_html(AVTextFormatContext *tctx)
 {
-    MermaidContext *mmc = tfc->priv;
+    MermaidContext *mmc = tctx->priv;
 
-    int ret = mermaid_init(tfc);
+    int ret = mermaid_init(tctx);
 
     if (ret < 0)
         return ret;
@@ -215,9 +215,9 @@ static av_cold int mermaid_init_html(AVTextFormatContext *tfc)
     return 0;
 }
 
-static av_cold int mermaid_uninit(AVTextFormatContext *tfc)
+static av_cold int mermaid_uninit(AVTextFormatContext *tctx)
 {
-    MermaidContext *mmc = tfc->priv;
+    MermaidContext *mmc = tctx->priv;
 
     av_bprint_finalize(&mmc->link_buf, NULL);
     av_dict_free(&mmc->link_dict);
@@ -241,20 +241,20 @@ static void set_str(const char **dst, const char *src)
         *dst = av_strdup(src);
 }
 
-#define MM_INDENT() writer_printf(tfc, "%*c", mmc->indent_level * 2, ' ')
+#define MM_INDENT() writer_printf(tctx, "%*c", mmc->indent_level * 2, ' ')
 
-static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *data)
+static void mermaid_print_section_header(AVTextFormatContext *tctx, const void *data)
 {
-    const AVTextFormatSection *section = tf_get_section(tfc, tfc->level);
-    const AVTextFormatSection *parent_section = tf_get_parent_section(tfc, tfc->level);
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
+    const AVTextFormatSection *parent_section = tf_get_parent_section(tctx, tctx->level);
 
     if (!section)
         return;
-    AVBPrint *buf = &tfc->section_pbuf[tfc->level];
-    MermaidContext *mmc = tfc->priv;
+    AVBPrint *buf = &tctx->section_pbuf[tctx->level];
+    MermaidContext *mmc = tctx->priv;
     const AVTextFormatSectionContext *sec_ctx = data;
 
-    if (tfc->level == 0) {
+    if (tctx->level == 0) {
         char *directive;
         AVBPrint css_buf;
         const char *diag_directive = mmc->diagram_config->diagram_type == AV_DIAGRAMTYPE_ENTITYRELATIONSHIP ? init_directive_er : init_directive;
@@ -270,24 +270,24 @@ static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *d
             uint64_t length;
             char *token_pos = av_stristr(mmc->diagram_config->html_template, "__###__");
             if (!token_pos) {
-                av_log(tfc, AV_LOG_ERROR, "Unable to locate the required token (__###__) in the html template.");
+                av_log(tctx, AV_LOG_ERROR, "Unable to locate the required token (__###__) in the html template.");
                 return;
             }
 
             length = token_pos - mmc->diagram_config->html_template;
             for (uint64_t i = 0; i < length; i++)
-                writer_w8(tfc, mmc->diagram_config->html_template[i]);
+                writer_w8(tctx, mmc->diagram_config->html_template[i]);
         }
 
-        writer_put_str(tfc, directive);
+        writer_put_str(tctx, directive);
         switch (mmc->diagram_config->diagram_type) {
         case AV_DIAGRAMTYPE_GRAPH:
-            writer_put_str(tfc, "flowchart LR\n");
-        ////writer_put_str(tfc, "  gradient_def@{ shape: text, label: \"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1\" height=\"1\"><defs><linearGradient id=\"ff-filtergradient\" x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\"><stop offset=\"0%\" style=\"stop-color:hsla(0, 0%, 30%, 0.02);\"/><stop offset=\"50%\" style=\"stop-color:hsla(0, 0%, 30%, 0);\"/><stop offset=\"100%\" style=\"stop-color:hsla(0, 0%, 30%, 0.05);\"/></linearGradient></defs></svg>\" }\n");
-            writer_put_str(tfc, "  gradient_def@{ shape: text, label: \"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1\" height=\"1\"><defs><linearGradient id=\"ff-filtergradient\" x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\"><stop offset=\"0%\" style=\"stop-color:hsl(0, 0%, 98.6%);     \"/><stop offset=\"50%\" style=\"stop-color:hsl(0, 0%, 100%);   \"/><stop offset=\"100%\" style=\"stop-color:hsl(0, 0%, 96.5%);     \"/></linearGradient><radialGradient id=\"ff-radgradient\" cx=\"50%\" cy=\"50%\" r=\"100%\" fx=\"45%\" fy=\"40%\"><stop offset=\"25%\" stop-color=\"hsl(0, 0%, 100%)\" /><stop offset=\"100%\" stop-color=\"hsl(0, 0%, 96%)\" /></radialGradient></defs></svg>\" }\n");
+            writer_put_str(tctx, "flowchart LR\n");
+        ////writer_put_str(tctx, "  gradient_def@{ shape: text, label: \"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1\" height=\"1\"><defs><linearGradient id=\"ff-filtergradient\" x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\"><stop offset=\"0%\" style=\"stop-color:hsla(0, 0%, 30%, 0.02);\"/><stop offset=\"50%\" style=\"stop-color:hsla(0, 0%, 30%, 0);\"/><stop offset=\"100%\" style=\"stop-color:hsla(0, 0%, 30%, 0.05);\"/></linearGradient></defs></svg>\" }\n");
+            writer_put_str(tctx, "  gradient_def@{ shape: text, label: \"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1\" height=\"1\"><defs><linearGradient id=\"ff-filtergradient\" x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\"><stop offset=\"0%\" style=\"stop-color:hsl(0, 0%, 98.6%);     \"/><stop offset=\"50%\" style=\"stop-color:hsl(0, 0%, 100%);   \"/><stop offset=\"100%\" style=\"stop-color:hsl(0, 0%, 96.5%);     \"/></linearGradient><radialGradient id=\"ff-radgradient\" cx=\"50%\" cy=\"50%\" r=\"100%\" fx=\"45%\" fy=\"40%\"><stop offset=\"25%\" stop-color=\"hsl(0, 0%, 100%)\" /><stop offset=\"100%\" stop-color=\"hsl(0, 0%, 96%)\" /></radialGradient></defs></svg>\" }\n");
             break;
         case AV_DIAGRAMTYPE_ENTITYRELATIONSHIP:
-            writer_put_str(tfc, "erDiagram\n");
+            writer_put_str(tctx, "erDiagram\n");
             break;
         }
 
@@ -298,129 +298,129 @@ static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *d
 
     if (parent_section && parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_SUBGRAPH) {
 
-        struct section_data parent_sec_data = mmc->section_data[tfc->level - 1];
-        AVBPrint *parent_buf = &tfc->section_pbuf[tfc->level - 1];
+        struct section_data parent_sec_data = mmc->section_data[tctx->level - 1];
+        AVBPrint *parent_buf = &tctx->section_pbuf[tctx->level - 1];
 
         if (parent_sec_data.subgraph_start_incomplete) {
 
             if (parent_buf->len > 0)
-                writer_printf(tfc, "%s", parent_buf->str);
+                writer_printf(tctx, "%s", parent_buf->str);
 
-            writer_put_str(tfc, "</div>\"]\n");
+            writer_put_str(tctx, "</div>\"]\n");
 
-            mmc->section_data[tfc->level - 1].subgraph_start_incomplete = 0;
+            mmc->section_data[tctx->level - 1].subgraph_start_incomplete = 0;
         }
     }
 
-    av_freep(&mmc->section_data[tfc->level].section_id);
-    av_freep(&mmc->section_data[tfc->level].section_type);
-    av_freep(&mmc->section_data[tfc->level].src_id);
-    av_freep(&mmc->section_data[tfc->level].dest_id);
-    mmc->section_data[tfc->level].current_is_textblock = 0;
-    mmc->section_data[tfc->level].current_is_stadium = 0;
-    mmc->section_data[tfc->level].subgraph_start_incomplete = 0;
-    mmc->section_data[tfc->level].link_type = AV_TEXTFORMAT_LINKTYPE_SRCDEST;
+    av_freep(&mmc->section_data[tctx->level].section_id);
+    av_freep(&mmc->section_data[tctx->level].section_type);
+    av_freep(&mmc->section_data[tctx->level].src_id);
+    av_freep(&mmc->section_data[tctx->level].dest_id);
+    mmc->section_data[tctx->level].current_is_textblock = 0;
+    mmc->section_data[tctx->level].current_is_stadium = 0;
+    mmc->section_data[tctx->level].subgraph_start_incomplete = 0;
+    mmc->section_data[tctx->level].link_type = AV_TEXTFORMAT_LINKTYPE_SRCDEST;
 
     // NOTE: av_strdup() allocations aren't checked
     if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_SUBGRAPH) {
 
         av_bprint_clear(buf);
-        writer_put_str(tfc, "\n");
+        writer_put_str(tctx, "\n");
 
         mmc->indent_level++;
 
         if (sec_ctx->context_id) {
             MM_INDENT();
-            writer_printf(tfc, "subgraph %s[\"<div class=\"ff-%s\">", sec_ctx->context_id, section->name);
+            writer_printf(tctx, "subgraph %s[\"<div class=\"ff-%s\">", sec_ctx->context_id, section->name);
         } else {
-            av_log(tfc, AV_LOG_ERROR, "Unable to write subgraph start. Missing id field. Section: %s", section->name);
+            av_log(tctx, AV_LOG_ERROR, "Unable to write subgraph start. Missing id field. Section: %s", section->name);
         }
 
-        mmc->section_data[tfc->level].subgraph_start_incomplete = 1;
-        set_str(&mmc->section_data[tfc->level].section_id, sec_ctx->context_id);
+        mmc->section_data[tctx->level].subgraph_start_incomplete = 1;
+        set_str(&mmc->section_data[tctx->level].section_id, sec_ctx->context_id);
     }
 
     if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_SHAPE) {
 
         av_bprint_clear(buf);
-        writer_put_str(tfc, "\n");
+        writer_put_str(tctx, "\n");
 
         mmc->indent_level++;
 
         if (sec_ctx->context_id) {
 
-            set_str(&mmc->section_data[tfc->level].section_id, sec_ctx->context_id);
+            set_str(&mmc->section_data[tctx->level].section_id, sec_ctx->context_id);
 
             switch (mmc->diagram_config->diagram_type) {
             case AV_DIAGRAMTYPE_GRAPH:
                 if (sec_ctx->context_flags & 1) {
 
                     MM_INDENT();
-                    writer_printf(tfc, "%s@{ shape: text, label: \"", sec_ctx->context_id);
-                    mmc->section_data[tfc->level].current_is_textblock = 1;
+                    writer_printf(tctx, "%s@{ shape: text, label: \"", sec_ctx->context_id);
+                    mmc->section_data[tctx->level].current_is_textblock = 1;
                 } else if (sec_ctx->context_flags & 2) {
 
                     MM_INDENT();
-                    writer_printf(tfc, "%s([\"", sec_ctx->context_id);
-                    mmc->section_data[tfc->level].current_is_stadium = 1;
+                    writer_printf(tctx, "%s([\"", sec_ctx->context_id);
+                    mmc->section_data[tctx->level].current_is_stadium = 1;
                 } else {
                     MM_INDENT();
-                    writer_printf(tfc, "%s(\"", sec_ctx->context_id);
+                    writer_printf(tctx, "%s(\"", sec_ctx->context_id);
                 }
 
                 break;
             case AV_DIAGRAMTYPE_ENTITYRELATIONSHIP:
                 MM_INDENT();
-                writer_printf(tfc, "%s {\n", sec_ctx->context_id);
+                writer_printf(tctx, "%s {\n", sec_ctx->context_id);
                 break;
             }
 
         } else {
-            av_log(tfc, AV_LOG_ERROR, "Unable to write shape start. Missing id field. Section: %s", section->name);
+            av_log(tctx, AV_LOG_ERROR, "Unable to write shape start. Missing id field. Section: %s", section->name);
         }
 
-        set_str(&mmc->section_data[tfc->level].section_id, sec_ctx->context_id);
+        set_str(&mmc->section_data[tctx->level].section_id, sec_ctx->context_id);
     }
 
 
     if (section->flags & AV_TEXTFORMAT_SECTION_PRINT_TAGS) {
 
         if (sec_ctx && sec_ctx->context_type)
-            writer_printf(tfc, "<div class=\"ff-%s %s\">", section->name, sec_ctx->context_type);
+            writer_printf(tctx, "<div class=\"ff-%s %s\">", section->name, sec_ctx->context_type);
         else
-            writer_printf(tfc, "<div class=\"ff-%s\">", section->name);
+            writer_printf(tctx, "<div class=\"ff-%s\">", section->name);
     }
 
 
     if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_LINKS) {
 
         av_bprint_clear(buf);
-        mmc->nb_link_captions[tfc->level] = 0;
+        mmc->nb_link_captions[tctx->level] = 0;
 
         if (sec_ctx && sec_ctx->context_type)
-            set_str(&mmc->section_data[tfc->level].section_type, sec_ctx->context_type);
+            set_str(&mmc->section_data[tctx->level].section_type, sec_ctx->context_type);
 
         ////if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE) {
         ////    AVBPrint buf;
         ////    av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
         ////    av_bprint_escape(&buf, section->get_type(data), NULL,
         ////                     AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
-        ////    writer_printf(tfc, " type=\"%s\"", buf.str);
+        ////    writer_printf(tctx, " type=\"%s\"", buf.str);
     }
 }
 
-static void mermaid_print_section_footer(AVTextFormatContext *tfc)
+static void mermaid_print_section_footer(AVTextFormatContext *tctx)
 {
-    MermaidContext *mmc = tfc->priv;
-    const AVTextFormatSection *section = tf_get_section(tfc, tfc->level);
+    MermaidContext *mmc = tctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
 
     if (!section)
         return;
-    AVBPrint *buf = &tfc->section_pbuf[tfc->level];
-    struct section_data sec_data = mmc->section_data[tfc->level];
+    AVBPrint *buf = &tctx->section_pbuf[tctx->level];
+    struct section_data sec_data = mmc->section_data[tctx->level];
 
     if (section->flags & AV_TEXTFORMAT_SECTION_PRINT_TAGS)
-        writer_put_str(tfc, "</div>");
+        writer_put_str(tctx, "</div>");
 
     if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_SHAPE) {
 
@@ -428,26 +428,26 @@ static void mermaid_print_section_footer(AVTextFormatContext *tfc)
         case AV_DIAGRAMTYPE_GRAPH:
 
             if (sec_data.current_is_textblock) {
-                writer_printf(tfc, "\"}\n", section->name);
+                writer_printf(tctx, "\"}\n", section->name);
 
                 if (sec_data.section_id) {
                     MM_INDENT();
-                    writer_put_str(tfc, "class ");
-                    writer_put_str(tfc, sec_data.section_id);
-                    writer_put_str(tfc, " ff-");
-                    writer_put_str(tfc, section->name);
-                    writer_put_str(tfc, "\n");
+                    writer_put_str(tctx, "class ");
+                    writer_put_str(tctx, sec_data.section_id);
+                    writer_put_str(tctx, " ff-");
+                    writer_put_str(tctx, section->name);
+                    writer_put_str(tctx, "\n");
                 }
             } else if (sec_data.current_is_stadium) {
-                writer_printf(tfc, "\"]):::ff-%s\n", section->name);
+                writer_printf(tctx, "\"]):::ff-%s\n", section->name);
             } else {
-                writer_printf(tfc, "\"):::ff-%s\n", section->name);
+                writer_printf(tctx, "\"):::ff-%s\n", section->name);
             }
 
             break;
         case AV_DIAGRAMTYPE_ENTITYRELATIONSHIP:
             MM_INDENT();
-            writer_put_str(tfc, "}\n\n");
+            writer_put_str(tctx, "}\n\n");
             break;
         }
 
@@ -456,15 +456,15 @@ static void mermaid_print_section_footer(AVTextFormatContext *tfc)
     } else if ((section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_SUBGRAPH)) {
 
         MM_INDENT();
-        writer_put_str(tfc, "end\n");
+        writer_put_str(tctx, "end\n");
 
         if (sec_data.section_id) {
             MM_INDENT();
-            writer_put_str(tfc, "class ");
-            writer_put_str(tfc, sec_data.section_id);
-            writer_put_str(tfc, " ff-");
-            writer_put_str(tfc, section->name);
-            writer_put_str(tfc, "\n");
+            writer_put_str(tctx, "class ");
+            writer_put_str(tctx, sec_data.section_id);
+            writer_put_str(tctx, " ff-");
+            writer_put_str(tctx, section->name);
+            writer_put_str(tctx, "\n");
         }
 
         mmc->indent_level--;
@@ -472,7 +472,7 @@ static void mermaid_print_section_footer(AVTextFormatContext *tfc)
 
     if ((section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_LINKS))
         if (sec_data.src_id && sec_data.dest_id
-            && !has_link_pair(tfc, sec_data.src_id, sec_data.dest_id))
+            && !has_link_pair(tctx, sec_data.src_id, sec_data.dest_id))
             switch (mmc->diagram_config->diagram_type) {
             case AV_DIAGRAMTYPE_GRAPH:
 
@@ -484,7 +484,7 @@ static void mermaid_print_section_footer(AVTextFormatContext *tfc)
                 if (buf->len > 0) {
                     av_bprintf(&mmc->link_buf, " \"%s", buf->str);
 
-                    for (unsigned i = 0; i < mmc->nb_link_captions[tfc->level]; i++)
+                    for (unsigned i = 0; i < mmc->nb_link_captions[tctx->level]; i++)
                         av_bprintf(&mmc->link_buf, "<br>&nbsp;");
 
                     av_bprintf(&mmc->link_buf, "\" ==");
@@ -521,61 +521,61 @@ static void mermaid_print_section_footer(AVTextFormatContext *tfc)
                 break;
             }
 
-    if (tfc->level == 0) {
+    if (tctx->level == 0) {
 
-        writer_put_str(tfc, "\n");
+        writer_put_str(tctx, "\n");
         if (mmc->create_html) {
             char *token_pos = av_stristr(mmc->diagram_config->html_template, "__###__");
             if (!token_pos) {
-                av_log(tfc, AV_LOG_ERROR, "Unable to locate the required token (__###__) in the html template.");
+                av_log(tctx, AV_LOG_ERROR, "Unable to locate the required token (__###__) in the html template.");
                 return;
             }
             token_pos += strlen("__###__");
-            writer_put_str(tfc, token_pos);
+            writer_put_str(tctx, token_pos);
         }
     }
 
-    if (tfc->level == 1) {
+    if (tctx->level == 1) {
 
         if (mmc->link_buf.len > 0) {
-            writer_put_str(tfc, mmc->link_buf.str);
+            writer_put_str(tctx, mmc->link_buf.str);
             av_bprint_clear(&mmc->link_buf);
         }
 
-        writer_put_str(tfc, "\n");
+        writer_put_str(tctx, "\n");
     }
 }
 
-static void mermaid_print_value(AVTextFormatContext *tfc, const char *key,
+static void mermaid_print_value(AVTextFormatContext *tctx, const char *key,
                                 const char *str, int64_t num, const int is_int)
 {
-    MermaidContext *mmc = tfc->priv;
-    const AVTextFormatSection *section = tf_get_section(tfc, tfc->level);
+    MermaidContext *mmc = tctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
 
     if (!section)
         return;
 
-    AVBPrint *buf = &tfc->section_pbuf[tfc->level];
-    struct section_data sec_data = mmc->section_data[tfc->level];
+    AVBPrint *buf = &tctx->section_pbuf[tctx->level];
+    struct section_data sec_data = mmc->section_data[tctx->level];
     int exit = 0;
 
     if (section->id_key && !strcmp(section->id_key, key)) {
-        set_str(&mmc->section_data[tfc->level].section_id, str);
+        set_str(&mmc->section_data[tctx->level].section_id, str);
         exit = 1;
     }
 
     if (section->dest_id_key && !strcmp(section->dest_id_key, key)) {
-        set_str(&mmc->section_data[tfc->level].dest_id, str);
+        set_str(&mmc->section_data[tctx->level].dest_id, str);
         exit = 1;
     }
 
     if (section->src_id_key && !strcmp(section->src_id_key, key)) {
-        set_str(&mmc->section_data[tfc->level].src_id, str);
+        set_str(&mmc->section_data[tctx->level].src_id, str);
         exit = 1;
     }
 
     if (section->linktype_key && !strcmp(section->linktype_key, key)) {
-        mmc->section_data[tfc->level].link_type = (AVTextFormatLinkType)num;
+        mmc->section_data[tctx->level].link_type = (AVTextFormatLinkType)num;
         exit = 1;
     }
 
@@ -588,10 +588,10 @@ static void mermaid_print_value(AVTextFormatContext *tfc, const char *key,
         case AV_DIAGRAMTYPE_GRAPH:
 
             if (is_int) {
-                writer_printf(tfc, "<span class=\"%s\">%s: %"PRId64"</span>", key, key, num);
+                writer_printf(tctx, "<span class=\"%s\">%s: %"PRId64"</span>", key, key, num);
             } else {
                 const char *tmp = av_strireplace(str, "\"", "'");
-                writer_printf(tfc, "<span class=\"%s\">%s</span>", key, tmp);
+                writer_printf(tctx, "<span class=\"%s\">%s</span>", key, tmp);
                 av_freep(&tmp);
             }
 
@@ -617,9 +617,9 @@ static void mermaid_print_value(AVTextFormatContext *tfc, const char *key,
                 MM_INDENT();
 
                 if (is_int)
-                    writer_printf(tfc, "    %s %"PRId64" %s\n", key, num, col_type);
+                    writer_printf(tctx, "    %s %"PRId64" %s\n", key, num, col_type);
                 else
-                    writer_printf(tfc, "    %s %s %s\n", key, str, col_type);
+                    writer_printf(tctx, "    %s %s %s\n", key, str, col_type);
             }
             break;
         }
@@ -634,18 +634,18 @@ static void mermaid_print_value(AVTextFormatContext *tfc, const char *key,
         else
             av_bprintf(buf, "<span>%s</span>", str);
 
-        mmc->nb_link_captions[tfc->level]++;
+        mmc->nb_link_captions[tctx->level]++;
     }
 }
 
-static inline void mermaid_print_str(AVTextFormatContext *tfc, const char *key, const char *value)
+static inline void mermaid_print_str(AVTextFormatContext *tctx, const char *key, const char *value)
 {
-    mermaid_print_value(tfc, key, value, 0, 0);
+    mermaid_print_value(tctx, key, value, 0, 0);
 }
 
-static void mermaid_print_int(AVTextFormatContext *tfc, const char *key, int64_t value)
+static void mermaid_print_int(AVTextFormatContext *tctx, const char *key, int64_t value)
 {
-    mermaid_print_value(tfc, key, NULL, value, 1);
+    mermaid_print_value(tctx, key, NULL, value, 1);
 }
 
 const AVTextFormatter avtextformatter_mermaid = {
diff --git a/fftools/textformat/tf_mermaid.h b/fftools/textformat/tf_mermaid.h
index 6e8f2a9b42..17227e81af 100644
--- a/fftools/textformat/tf_mermaid.h
+++ b/fftools/textformat/tf_mermaid.h
@@ -33,7 +33,7 @@ typedef struct AVDiagramConfig {
 } AVDiagramConfig;
 
 
-void av_diagram_init(AVTextFormatContext *tfc, AVDiagramConfig *diagram_config);
+void av_diagram_init(AVTextFormatContext *tctx, AVDiagramConfig *diagram_config);
 
 void av_mermaid_set_html_template(AVTextFormatContext *tfc, const char *html_template);
 
diff --git a/fftools/textformat/tf_xml.c b/fftools/textformat/tf_xml.c
index 6b09e09ab4..549a57e095 100644
--- a/fftools/textformat/tf_xml.c
+++ b/fftools/textformat/tf_xml.c
@@ -50,45 +50,45 @@ static const AVOption xml_options[] = {
 
 DEFINE_FORMATTER_CLASS(xml);
 
-static av_cold int xml_init(AVTextFormatContext *wctx)
+static av_cold int xml_init(AVTextFormatContext *tctx)
 {
-    XMLContext *xml = wctx->priv;
+    XMLContext *xml = tctx->priv;
 
     if (xml->xsd_strict) {
         xml->fully_qualified = 1;
 #define CHECK_COMPLIANCE(opt, opt_name)                                 \
         if (opt) {                                                      \
-            av_log(wctx, AV_LOG_ERROR,                                  \
+            av_log(tctx, AV_LOG_ERROR,                                  \
                    "XSD-compliant output selected but option '%s' was selected, XML output may be non-compliant.\n" \
                    "You need to disable such option with '-no%s'\n", opt_name, opt_name); \
             return AVERROR(EINVAL);                                     \
         }
         ////CHECK_COMPLIANCE(show_private_data, "private");
-        CHECK_COMPLIANCE(wctx->show_value_unit,   "unit");
-        CHECK_COMPLIANCE(wctx->use_value_prefix,  "prefix");
+        CHECK_COMPLIANCE(tctx->show_value_unit,   "unit");
+        CHECK_COMPLIANCE(tctx->use_value_prefix,  "prefix");
     }
 
     return 0;
 }
 
-#define XML_INDENT() writer_printf(wctx, "%*c", xml->indent_level * 4, ' ')
+#define XML_INDENT() writer_printf(tctx, "%*c", xml->indent_level * 4, ' ')
 
-static void xml_print_section_header(AVTextFormatContext *wctx, const void *data)
+static void xml_print_section_header(AVTextFormatContext *tctx, const void *data)
 {
-    XMLContext *xml = wctx->priv;
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
-    const AVTextFormatSection *parent_section = tf_get_parent_section(wctx, wctx->level);
+    XMLContext *xml = tctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
+    const AVTextFormatSection *parent_section = tf_get_parent_section(tctx, tctx->level);
 
     if (!section)
         return;
 
-    if (wctx->level == 0) {
+    if (tctx->level == 0) {
         const char *qual = " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
             "xmlns:ffprobe=\"http://www.ffmpeg.org/schema/ffprobe\" "
             "xsi:schemaLocation=\"http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd\"";
 
-        writer_put_str(wctx, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
-        writer_printf(wctx, "<%sffprobe%s>\n",
+        writer_put_str(tctx, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+        writer_printf(tctx, "<%sffprobe%s>\n",
                       xml->fully_qualified ? "ffprobe:" : "",
                       xml->fully_qualified ? qual : "");
         return;
@@ -96,60 +96,60 @@ static void xml_print_section_header(AVTextFormatContext *wctx, const void *data
 
     if (xml->within_tag) {
         xml->within_tag = 0;
-        writer_put_str(wctx, ">\n");
+        writer_put_str(tctx, ">\n");
     }
 
     if (parent_section && (parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER) &&
-        wctx->level && wctx->nb_item[wctx->level - 1])
-        writer_w8(wctx, '\n');
+        tctx->level && tctx->nb_item[tctx->level - 1])
+        writer_w8(tctx, '\n');
     xml->indent_level++;
 
     if (section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY | AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS)) {
         XML_INDENT();
-        writer_printf(wctx, "<%s", section->name);
+        writer_printf(tctx, "<%s", section->name);
 
         if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE) {
             AVBPrint buf;
             av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
             av_bprint_escape(&buf, section->get_type(data), NULL,
                              AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
-            writer_printf(wctx, " type=\"%s\"", buf.str);
+            writer_printf(tctx, " type=\"%s\"", buf.str);
         }
-        writer_printf(wctx, ">\n", section->name);
+        writer_printf(tctx, ">\n", section->name);
     } else {
         XML_INDENT();
-        writer_printf(wctx, "<%s ", section->name);
+        writer_printf(tctx, "<%s ", section->name);
         xml->within_tag = 1;
     }
 }
 
-static void xml_print_section_footer(AVTextFormatContext *wctx)
+static void xml_print_section_footer(AVTextFormatContext *tctx)
 {
-    XMLContext *xml = wctx->priv;
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
+    XMLContext *xml = tctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
 
     if (!section)
         return;
 
-    if (wctx->level == 0) {
-        writer_printf(wctx, "</%sffprobe>\n", xml->fully_qualified ? "ffprobe:" : "");
+    if (tctx->level == 0) {
+        writer_printf(tctx, "</%sffprobe>\n", xml->fully_qualified ? "ffprobe:" : "");
     } else if (xml->within_tag) {
         xml->within_tag = 0;
-        writer_put_str(wctx, "/>\n");
+        writer_put_str(tctx, "/>\n");
         xml->indent_level--;
     } else {
         XML_INDENT();
-        writer_printf(wctx, "</%s>\n", section->name);
+        writer_printf(tctx, "</%s>\n", section->name);
         xml->indent_level--;
     }
 }
 
-static void xml_print_value(AVTextFormatContext *wctx, const char *key,
+static void xml_print_value(AVTextFormatContext *tctx, const char *key,
                             const char *str, int64_t num, const int is_int)
 {
     AVBPrint buf;
-    XMLContext *xml = wctx->priv;
-    const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
+    XMLContext *xml = tctx->priv;
+    const AVTextFormatSection *section = tf_get_section(tctx, tctx->level);
 
     if (!section)
         return;
@@ -161,42 +161,42 @@ static void xml_print_value(AVTextFormatContext *wctx, const char *key,
         XML_INDENT();
         av_bprint_escape(&buf, key, NULL,
                          AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
-        writer_printf(wctx, "<%s key=\"%s\"",
+        writer_printf(tctx, "<%s key=\"%s\"",
                       section->element_name, buf.str);
         av_bprint_clear(&buf);
 
         if (is_int) {
-            writer_printf(wctx, " value=\"%"PRId64"\"/>\n", num);
+            writer_printf(tctx, " value=\"%"PRId64"\"/>\n", num);
         } else {
             av_bprint_escape(&buf, str, NULL,
                              AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
-            writer_printf(wctx, " value=\"%s\"/>\n", buf.str);
+            writer_printf(tctx, " value=\"%s\"/>\n", buf.str);
         }
         xml->indent_level--;
     } else {
-        if (wctx->nb_item[wctx->level])
-            writer_w8(wctx, ' ');
+        if (tctx->nb_item[tctx->level])
+            writer_w8(tctx, ' ');
 
         if (is_int) {
-            writer_printf(wctx, "%s=\"%"PRId64"\"", key, num);
+            writer_printf(tctx, "%s=\"%"PRId64"\"", key, num);
         } else {
             av_bprint_escape(&buf, str, NULL,
                              AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
-            writer_printf(wctx, "%s=\"%s\"", key, buf.str);
+            writer_printf(tctx, "%s=\"%s\"", key, buf.str);
         }
     }
 
     av_bprint_finalize(&buf, NULL);
 }
 
-static inline void xml_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
+static inline void xml_print_str(AVTextFormatContext *tctx, const char *key, const char *value)
 {
-    xml_print_value(wctx, key, value, 0, 0);
+    xml_print_value(tctx, key, value, 0, 0);
 }
 
-static void xml_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
+static void xml_print_int(AVTextFormatContext *tctx, const char *key, int64_t value)
 {
-    xml_print_value(wctx, key, NULL, value, 1);
+    xml_print_value(tctx, key, NULL, value, 1);
 }
 
 const AVTextFormatter avtextformatter_xml = {
-- 
ffmpeg-codebot

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2025-07-03  1:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03  1:55 [FFmpeg-devel] [PATCH 0/3] fftools/textformat: Cleanup work ffmpegagent
2025-07-03  1:55 ` softworkz [this message]
2025-07-03  1:55 ` [FFmpeg-devel] [PATCH 2/3] fftools/textformat: Remove redundant casts softworkz
2025-07-03  1:55 ` [FFmpeg-devel] [PATCH 3/3] fftools/textformat: Cleanup unneeded includes softworkz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c97d3273e89af56cef1bd41aafbd7af34c712c0.1751507725.git.ffmpegagent@gmail.com \
    --to=ffmpegagent-at-gmail.com@ffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=softworkz@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git