diff options
author | softworkz <softworkz@hotmail.com> | 2025-04-14 05:28:45 +0200 |
---|---|---|
committer | softworkz <softworkz@hotmail.com> | 2025-05-15 23:04:44 +0200 |
commit | 8f42d90413f64574b8e15de27fc2430102843dbf (patch) | |
tree | e2d9e695cf093b84bf257d467c2a63529888ee82 /fftools/textformat/tf_flat.c | |
parent | f51c385a8e643ee12eb6be160e2fa4b5ae57a50b (diff) | |
download | ffmpeg-8f42d90413f64574b8e15de27fc2430102843dbf.tar.gz |
fftools/textformat: Apply formatting and whitespace changes
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
Diffstat (limited to 'fftools/textformat/tf_flat.c')
-rw-r--r-- | fftools/textformat/tf_flat.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/fftools/textformat/tf_flat.c b/fftools/textformat/tf_flat.c index 919d44bc6b..f692971bcc 100644 --- a/fftools/textformat/tf_flat.c +++ b/fftools/textformat/tf_flat.c @@ -57,12 +57,12 @@ typedef struct FlatContext { #undef OFFSET #define OFFSET(x) offsetof(FlatContext, x) -static const AVOption flat_options[]= { - {"sep_char", "set separator", OFFSET(sep_str), AV_OPT_TYPE_STRING, {.str="."}, 0, 0 }, - {"s", "set separator", OFFSET(sep_str), AV_OPT_TYPE_STRING, {.str="."}, 0, 0 }, - {"hierarchical", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 }, - {"h", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 }, - {NULL}, +static const AVOption flat_options[] = { + { "sep_char", "set separator", OFFSET(sep_str), AV_OPT_TYPE_STRING, { .str = "." }, 0, 0 }, + { "s", "set separator", OFFSET(sep_str), AV_OPT_TYPE_STRING, { .str = "." }, 0, 0 }, + { "hierarchical", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1 }, + { "h", "specify if the section specification should be hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1 }, + { NULL }, }; DEFINE_FORMATTER_CLASS(flat); @@ -126,16 +126,18 @@ static void flat_print_section_header(AVTextFormatContext *wctx, const void *dat av_bprint_clear(buf); if (!parent_section) return; - av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level-1].str); + + av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level - 1].str); if (flat->hierarchical || - !(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY|AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER))) { + !(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); 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]; + 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]; + av_bprintf(buf, "%d%s", n, flat->sep_str); } } @@ -166,6 +168,6 @@ const AVTextFormatter avtextformatter_flat = { .print_section_header = flat_print_section_header, .print_integer = flat_print_int, .print_string = flat_print_str, - .flags = AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS|AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT, + .flags = AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS | AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT, .priv_class = &flat_class, }; |