Commit 42b8f75a6b for ffmpeg

commit 42b8f75a6b3985dcd5813769d4e2a2dff7dc1ffc
Author: Kacper Michajłow <kasper93@gmail.com>
Date:   Thu Oct 8 03:38:25 2026 +0200

    fftools/textformat: assemble each compact row in a buffer

    Collect the fields of a row and the lines of the rows nested in it,
    write them when the row ends, and write the separator before each field.
    This fixes rows fused with the previous one after a typed element had
    printed at the same level, the blank line after the timecode rows of a
    frame, fields printed on a separator-led line after nested rows, and the
    doubled or trailing separators of empty rows and empty inline arrays,
    which the tmcd refs encoded.

    Signed-off-by: Kacper Michajłow <kasper93@gmail.com>

diff --git a/fftools/textformat/tf_compact.c b/fftools/textformat/tf_compact.c
index 4b4db7bca2..df59dea0ef 100644
--- a/fftools/textformat/tf_compact.c
+++ b/fftools/textformat/tf_compact.c
@@ -91,9 +91,14 @@ typedef struct CompactContext {
     int print_section;
     char *escape_mode_str;
     const char * (*escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx);
-    int nested_section[SECTION_MAX_NB_LEVELS];
-    int has_nested_elems[SECTION_MAX_NB_LEVELS];
-    int terminate_line[SECTION_MAX_NB_LEVELS];
+    /** level of the row whose line the fields at this level belong to, -1 for none */
+    int row_level[SECTION_MAX_NB_LEVELS];
+    /** number of fields written to the row at this level */
+    int nb_fields[SECTION_MAX_NB_LEVELS];
+    /** the line of the row at this level */
+    AVBPrint line[SECTION_MAX_NB_LEVELS];
+    /** the lines of the rows nested in the row at this level */
+    AVBPrint rows[SECTION_MAX_NB_LEVELS];
 } CompactContext;

 #undef OFFSET
@@ -117,6 +122,11 @@ static av_cold int compact_init(AVTextFormatContext *wctx)
 {
     CompactContext *compact = wctx->priv;

+    for (int i = 0; i < SECTION_MAX_NB_LEVELS; i++) {
+        av_bprint_init(&compact->line[i], 1, AV_BPRINT_SIZE_UNLIMITED);
+        av_bprint_init(&compact->rows[i], 1, AV_BPRINT_SIZE_UNLIMITED);
+    }
+
     if (strlen(compact->item_sep_str) != 1) {
         av_log(wctx, AV_LOG_ERROR, "Item separator '%s' specified, but must contain a single character\n",
                compact->item_sep_str);
@@ -138,43 +148,49 @@ static av_cold int compact_init(AVTextFormatContext *wctx)
     return 0;
 }

-static int array_has_inline_elems(const AVTextFormatContext *wctx,
-                                  const AVTextFormatSection *section)
+static av_cold int compact_uninit(AVTextFormatContext *wctx)
 {
-    for (int i = 0; section->children_ids[i] != -1; i++)
-        if (wctx->sections[section->children_ids[i]].flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE)
-            return 1;
+    CompactContext *compact = wctx->priv;
+
+    for (int i = 0; i < SECTION_MAX_NB_LEVELS; i++) {
+        av_bprint_finalize(&compact->line[i], NULL);
+        av_bprint_finalize(&compact->rows[i], NULL);
+    }
+
     return 0;
 }

+static void bprint_append_bprint(AVBPrint *dst, const AVBPrint *src)
+{
+    av_bprint_append_data(dst, src->str, FFMIN(src->len, src->size - 1));
+}
+
 static void compact_print_section_header(AVTextFormatContext *wctx, 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);
+    int level = wctx->level;

     if (!section)
         return;

-    compact->terminate_line[wctx->level] = 1;
-    compact->has_nested_elems[wctx->level] = 0;
+    av_bprint_clear(&wctx->section_pbuf[level]);
+    compact->row_level[level] = level ? compact->row_level[level - 1] : -1;

-    av_bprint_clear(&wctx->section_pbuf[wctx->level]);
     if (parent_section &&
         (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE ||
             (!(section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) &&
                 !(parent_section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY))))) {

         /* define a prefix for elements not contained in an array or
-           in a wrapper, or for array elements with a type */
+           in a wrapper, or for array elements with a type, their
+           fields continue the line of the enclosing row */
         const char *element_name = (char *)av_x_if_null(section->element_name, section->name);
-        AVBPrint *section_pbuf = &wctx->section_pbuf[wctx->level];
-
-        compact->nested_section[wctx->level] = 1;
-        compact->has_nested_elems[wctx->level - 1] = 1;
+        AVBPrint *section_pbuf = &wctx->section_pbuf[level];

         av_bprintf(section_pbuf, "%s%s",
-                   wctx->section_pbuf[wctx->level - 1].str, element_name);
+                   wctx->section_pbuf[level - 1].str, element_name);

         if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE) {
             // add /TYPE to prefix
@@ -190,74 +206,90 @@ 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];
-    } else {
-        if (parent_section && !(parent_section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY))) {
-            int *parent_open = &compact->terminate_line[wctx->level - 1];
-            if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY && !array_has_inline_elems(wctx, section)) {
-                /* Row elements end the parent's line, its footer must not do it again. */
-                if (*parent_open)
-                    writer_w8(wctx, '\n');
-                *parent_open = 0;
-            } else if (wctx->level && wctx->nb_item[wctx->level - 1]) {
-                writer_w8(wctx, compact->item_sep);
-                *parent_open = 1;
-            }
-        }
-        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);
+        return;
     }
+
+    if (section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY))
+        return;
+
+    /* a row, printed as one line once the section ends */
+    compact->row_level[level] = level;
+    compact->nb_fields[level] = 0;
+    av_bprint_clear(&compact->line[level]);
+    av_bprint_clear(&compact->rows[level]);
+    if (compact->print_section)
+        av_bprintf(&compact->line[level], "%s", section->name);
 }

 static void compact_print_section_footer(AVTextFormatContext *wctx)
 {
     CompactContext *compact = wctx->priv;
     const AVTextFormatSection *section = tf_get_section(wctx, wctx->level);
+    int level = wctx->level;
+    int parent_row;

-    if (!section)
+    if (!section || compact->row_level[level] != level)
         return;

-    if (!compact->nested_section[wctx->level] &&
-        compact->terminate_line[wctx->level] &&
-        !(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
-        writer_w8(wctx, '\n');
+    /* the row's line, followed by the lines of the rows nested in it */
+    av_bprint_chars(&compact->line[level], '\n', 1);
+    bprint_append_bprint(&compact->line[level], &compact->rows[level]);
+
+    parent_row = level ? compact->row_level[level - 1] : -1;
+    if (parent_row >= 0)
+        bprint_append_bprint(&compact->rows[parent_row], &compact->line[level]);
+    else
+        writer_put_str(wctx, compact->line[level].str);
 }

-static void compact_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
+static void compact_print_field(AVTextFormatContext *wctx, const char *key, const char *value)
 {
     CompactContext *compact = wctx->priv;
-    AVBPrint buf;
+    int row = compact->row_level[wctx->level];
+    AVBPrint tmp, *line = &tmp;

-    if (wctx->nb_item[wctx->level])
-        writer_w8(wctx, compact->item_sep);
+    if (row >= 0) {
+        line = &compact->line[row];
+        if (compact->nb_fields[row]++ || compact->print_section)
+            av_bprint_chars(line, compact->item_sep, 1);
+    } else {
+        /* a field outside of any row */
+        av_bprint_init(&tmp, 1, AV_BPRINT_SIZE_UNLIMITED);
+    }

     if (!compact->nokey)
-        writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
+        av_bprintf(line, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
+    av_bprintf(line, "%s", value);

-    av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
-    writer_put_str(wctx, compact->escape_str(&buf, value, compact->item_sep, wctx));
-    av_bprint_finalize(&buf, NULL);
+    if (line == &tmp) {
+        writer_put_str(wctx, tmp.str);
+        av_bprint_finalize(&tmp, NULL);
+    }
 }

-static void compact_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
+static void compact_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
 {
     CompactContext *compact = wctx->priv;
+    AVBPrint buf;

-    if (wctx->nb_item[wctx->level])
-        writer_w8(wctx, compact->item_sep);
+    av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
+    compact_print_field(wctx, key, compact->escape_str(&buf, value, compact->item_sep, wctx));
+    av_bprint_finalize(&buf, NULL);
+}

-    if (!compact->nokey)
-        writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
+static void compact_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
+{
+    char buf[32];

-    writer_printf(wctx, "%"PRId64, value);
+    snprintf(buf, sizeof(buf), "%"PRId64, value);
+    compact_print_field(wctx, key, buf);
 }

 const AVTextFormatter avtextformatter_compact = {
     .name                 = "compact",
     .priv_size            = sizeof(CompactContext),
     .init                 = compact_init,
+    .uninit               = compact_uninit,
     .print_section_header = compact_print_section_header,
     .print_section_footer = compact_print_section_footer,
     .print_integer        = compact_print_int,
@@ -289,6 +321,7 @@ const AVTextFormatter avtextformatter_csv = {
     .name                 = "csv",
     .priv_size            = sizeof(CompactContext),
     .init                 = compact_init,
+    .uninit               = compact_uninit,
     .print_section_header = compact_print_section_header,
     .print_section_footer = compact_print_section_footer,
     .print_integer        = compact_print_int,
diff --git a/tests/ref/fate/ffprobe-group-stream-entries-tmcd b/tests/ref/fate/ffprobe-group-stream-entries-tmcd
index 6ba54f4200..60630b17ed 100644
--- a/tests/ref/fate/ffprobe-group-stream-entries-tmcd
+++ b/tests/ref/fate/ffprobe-group-stream-entries-tmcd
@@ -1,6 +1,6 @@
-stream_group|
-stream|index=0|
-stream_group|
-stream|index=0|
-stream_group|
-stream|index=0|
+stream_group
+stream|index=0
+stream_group
+stream|index=0
+stream_group
+stream|index=0
diff --git a/tests/ref/fate/ffprobe-show-groups-tmcd b/tests/ref/fate/ffprobe-show-groups-tmcd
index 64b32fe905..f2766220f7 100644
--- a/tests/ref/fate/ffprobe-show-groups-tmcd
+++ b/tests/ref/fate/ffprobe-show-groups-tmcd
@@ -1,7 +1,7 @@
-stream_group|
-stream|index=0|
-stream_group|
-stream|index=0|
-stream_group|
-stream|index=0|
-stream|index=0|
+stream_group
+stream|index=0
+stream_group
+stream|index=0
+stream_group
+stream|index=0
+stream|index=0
diff --git a/tests/ref/fate/ffprobe-stream-entries-tmcd b/tests/ref/fate/ffprobe-stream-entries-tmcd
index 64b0ce91b9..c3700a518c 100644
--- a/tests/ref/fate/ffprobe-stream-entries-tmcd
+++ b/tests/ref/fate/ffprobe-stream-entries-tmcd
@@ -1 +1 @@
-stream|index=0|
+stream|index=0
diff --git a/tests/ref/fate/filter-metadata-cropdetect b/tests/ref/fate/filter-metadata-cropdetect
index 8b1c2fac6b..212a3a4147 100644
--- a/tests/ref/fate/filter-metadata-cropdetect
+++ b/tests/ref/fate/filter-metadata-cropdetect
@@ -1,4 +1,4 @@
-pts=0|
+pts=0
 pts=400
 pts=800|tag:lavfi.cropdetect.y=68|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=719|tag:lavfi.cropdetect.y1=61|tag:lavfi.cropdetect.y2=424|tag:lavfi.cropdetect.w=720|tag:lavfi.cropdetect.h=352|tag:lavfi.cropdetect.x=0|tag:lavfi.cropdetect.limit=0.094118
 pts=1200|tag:lavfi.cropdetect.y=68|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=719|tag:lavfi.cropdetect.y1=61|tag:lavfi.cropdetect.y2=424|tag:lavfi.cropdetect.w=720|tag:lavfi.cropdetect.h=352|tag:lavfi.cropdetect.x=0|tag:lavfi.cropdetect.limit=0.094118
diff --git a/tests/ref/fate/filter-metadata-cropdetect1 b/tests/ref/fate/filter-metadata-cropdetect1
index 9ec9e43e72..25c80ccebc 100644
--- a/tests/ref/fate/filter-metadata-cropdetect1
+++ b/tests/ref/fate/filter-metadata-cropdetect1
@@ -1,10 +1,10 @@
-pts=0|
-pts=1001|
-pts=2002|tag:lavfi.cropdetect.y=314|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=851|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=601|tag:lavfi.cropdetect.w=832|tag:lavfi.cropdetect.h=288|tag:lavfi.cropdetect.x=20|tag:lavfi.cropdetect.limit=0.094118|
-pts=3003|tag:lavfi.cropdetect.y=316|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=864|tag:lavfi.cropdetect.h=304|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118|
-pts=4004|tag:lavfi.cropdetect.y=122|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.limit=0.094118|
-pts=5005|tag:lavfi.cropdetect.y=316|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=864|tag:lavfi.cropdetect.h=304|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118|
-pts=6006|tag:lavfi.cropdetect.y=122|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.limit=0.094118|
-pts=7007|tag:lavfi.cropdetect.y=122|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.limit=0.094118|
-pts=8008|tag:lavfi.cropdetect.y=122|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.limit=0.094118|
-pts=9009|tag:lavfi.cropdetect.y=122|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.limit=0.094118|
+pts=0
+pts=1001
+pts=2002|tag:lavfi.cropdetect.y=314|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=851|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=601|tag:lavfi.cropdetect.w=832|tag:lavfi.cropdetect.h=288|tag:lavfi.cropdetect.x=20|tag:lavfi.cropdetect.limit=0.094118
+pts=3003|tag:lavfi.cropdetect.y=316|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=864|tag:lavfi.cropdetect.h=304|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118
+pts=4004|tag:lavfi.cropdetect.y=122|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.limit=0.094118
+pts=5005|tag:lavfi.cropdetect.y=316|tag:lavfi.cropdetect.x1=20|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=311|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=864|tag:lavfi.cropdetect.h=304|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118
+pts=6006|tag:lavfi.cropdetect.y=122|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.limit=0.094118
+pts=7007|tag:lavfi.cropdetect.y=122|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.limit=0.094118
+pts=8008|tag:lavfi.cropdetect.y=122|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.limit=0.094118
+pts=9009|tag:lavfi.cropdetect.y=122|tag:lavfi.cropdetect.x1=0|tag:lavfi.cropdetect.x2=885|tag:lavfi.cropdetect.y1=115|tag:lavfi.cropdetect.y2=621|tag:lavfi.cropdetect.w=880|tag:lavfi.cropdetect.h=496|tag:lavfi.cropdetect.x=4|tag:lavfi.cropdetect.limit=0.094118
diff --git a/tests/ref/fate/filter-metadata-cropdetect2 b/tests/ref/fate/filter-metadata-cropdetect2
index ba6d2851c1..a27577b99b 100644
--- a/tests/ref/fate/filter-metadata-cropdetect2
+++ b/tests/ref/fate/filter-metadata-cropdetect2
@@ -1,10 +1,10 @@
-pts=0|
-pts=512|
-pts=1024|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1221|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1200|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118|
-pts=1536|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1257|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1232|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=24|tag:lavfi.cropdetect.limit=0.094118|
-pts=2048|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1221|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1200|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118|
-pts=2560|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1221|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1200|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118|
-pts=3072|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=817|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=937|tag:lavfi.cropdetect.w=784|tag:lavfi.cropdetect.h=912|tag:lavfi.cropdetect.x=28|tag:lavfi.cropdetect.limit=0.094118|
-pts=3584|tag:lavfi.cropdetect.y=40|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=817|tag:lavfi.cropdetect.y1=38|tag:lavfi.cropdetect.y2=937|tag:lavfi.cropdetect.w=784|tag:lavfi.cropdetect.h=896|tag:lavfi.cropdetect.x=28|tag:lavfi.cropdetect.limit=0.094118|
-pts=4096|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=817|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=937|tag:lavfi.cropdetect.w=784|tag:lavfi.cropdetect.h=912|tag:lavfi.cropdetect.x=28|tag:lavfi.cropdetect.limit=0.094118|
-pts=4608|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1221|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1200|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118|
+pts=0
+pts=512
+pts=1024|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1221|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1200|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118
+pts=1536|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1257|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1232|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=24|tag:lavfi.cropdetect.limit=0.094118
+pts=2048|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1221|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1200|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118
+pts=2560|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1221|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1200|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118
+pts=3072|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=817|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=937|tag:lavfi.cropdetect.w=784|tag:lavfi.cropdetect.h=912|tag:lavfi.cropdetect.x=28|tag:lavfi.cropdetect.limit=0.094118
+pts=3584|tag:lavfi.cropdetect.y=40|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=817|tag:lavfi.cropdetect.y1=38|tag:lavfi.cropdetect.y2=937|tag:lavfi.cropdetect.w=784|tag:lavfi.cropdetect.h=896|tag:lavfi.cropdetect.x=28|tag:lavfi.cropdetect.limit=0.094118
+pts=4096|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=817|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=937|tag:lavfi.cropdetect.w=784|tag:lavfi.cropdetect.h=912|tag:lavfi.cropdetect.x=28|tag:lavfi.cropdetect.limit=0.094118
+pts=4608|tag:lavfi.cropdetect.y=22|tag:lavfi.cropdetect.x1=21|tag:lavfi.cropdetect.x2=1221|tag:lavfi.cropdetect.y1=15|tag:lavfi.cropdetect.y2=1116|tag:lavfi.cropdetect.w=1200|tag:lavfi.cropdetect.h=1088|tag:lavfi.cropdetect.x=22|tag:lavfi.cropdetect.limit=0.094118
diff --git a/tests/ref/fate/h264-timecode-probe b/tests/ref/fate/h264-timecode-probe
index dffe7ae762..c30a8e5a3a 100644
--- a/tests/ref/fate/h264-timecode-probe
+++ b/tests/ref/fate/h264-timecode-probe
@@ -1,8 +1,6 @@
 frame|key_frame=1|pict_type=I|side_datum/h_26_45__user_data_unregistered_sei_message:side_data_type=H.26[45] User Data Unregistered SEI message|side_datum/smpte_12_1_timecode:side_data_type=SMPTE 12-1 timecode
 timecode|value=00:00:00:00
 timecode|value=00:00:00:00
-
 frame|key_frame=0|pict_type=P|side_datum/smpte_12_1_timecode:side_data_type=SMPTE 12-1 timecode
 timecode|value=00:00:00:02
 timecode|value=00:00:00:02
-
diff --git a/tests/ref/fate/mpegts-probe-program-compact b/tests/ref/fate/mpegts-probe-program-compact
index bd884a0289..db18b05dde 100644
--- a/tests/ref/fate/mpegts-probe-program-compact
+++ b/tests/ref/fate/mpegts-probe-program-compact
@@ -1,4 +1,5 @@
 packet|stream_index=0|pts=2863340144|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
 packet|stream_index=0|pts=2863338344|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
 program|program_id=769|nb_streams=2
-stream|index=0|codec_name=hevcstream|index=1|codec_name=aac_latm
\ No newline at end of file
+stream|index=0|codec_name=hevc
+stream|index=1|codec_name=aac_latm