[FFmpeg-cvslog] fftools/textformat: Add flags param to function avtext_print_integer()
softworkz
git at videolan.org
Fri May 16 00:11:35 EEST 2025
ffmpeg | branch: master | softworkz <softworkz at hotmail.com> | Tue Apr 29 02:27:39 2025 +0200| [b71b444a3ad24eec28ca92545cc613360251e34e] | committer: softworkz
fftools/textformat: Add flags param to function avtext_print_integer()
Make this function work analog to avtext_print_string() which already
has a flags parameter.
Signed-off-by: softworkz <softworkz at hotmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b71b444a3ad24eec28ca92545cc613360251e34e
---
fftools/ffprobe.c | 2 +-
fftools/textformat/avtextformat.c | 24 ++++++++++++++++++------
fftools/textformat/avtextformat.h | 2 +-
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index cb8b5e17f9..eb55083a1e 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -420,7 +420,7 @@ static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
avtext_print_string(tfc, k, pbuf.str, 0); \
} while (0)
-#define print_int(k, v) avtext_print_integer(tfc, k, v)
+#define print_int(k, v) avtext_print_integer(tfc, k, v, 0)
#define print_q(k, v, s) avtext_print_rational(tfc, k, v, s)
#define print_str(k, v) avtext_print_string(tfc, k, v, 0)
#define print_str_opt(k, v) avtext_print_string(tfc, k, v, AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
diff --git a/fftools/textformat/avtextformat.c b/fftools/textformat/avtextformat.c
index dd595f15ba..7c73089bfd 100644
--- a/fftools/textformat/avtextformat.c
+++ b/fftools/textformat/avtextformat.c
@@ -289,10 +289,20 @@ void avtext_print_section_footer(AVTextFormatContext *tctx)
tctx->level--;
}
-void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val)
+void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val, int flags)
{
const AVTextFormatSection *section;
+ av_assert0(tctx);
+
+ if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER)
+ return;
+
+ if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO
+ && (flags & AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
+ && !(tctx->formatter->flags & AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS))
+ return;
+
av_assert0(key && tctx->level >= 0 && tctx->level < SECTION_MAX_NB_LEVELS);
section = tctx->section[tctx->level];
@@ -444,10 +454,12 @@ int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char *
section = tctx->section[tctx->level];
- if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER ||
- (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO
- && (flags & AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
- && !(tctx->formatter->flags & AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS)))
+ if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER)
+ return 0;
+
+ if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO
+ && (flags & AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
+ && !(tctx->formatter->flags & AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS))
return 0;
if (section->show_all_entries || av_dict_get(section->entries_to_show, key, NULL, 0)) {
@@ -503,7 +515,7 @@ void avtext_print_ts(AVTextFormatContext *tctx, const char *key, int64_t ts, int
if ((!is_duration && ts == AV_NOPTS_VALUE) || (is_duration && ts == 0))
avtext_print_string(tctx, key, "N/A", AV_TEXTFORMAT_PRINT_STRING_OPTIONAL);
else
- avtext_print_integer(tctx, key, ts);
+ avtext_print_integer(tctx, key, ts, 0);
}
void avtext_print_data(AVTextFormatContext *tctx, const char *key,
diff --git a/fftools/textformat/avtextformat.h b/fftools/textformat/avtextformat.h
index 87f57d8c24..8f406de322 100644
--- a/fftools/textformat/avtextformat.h
+++ b/fftools/textformat/avtextformat.h
@@ -138,7 +138,7 @@ void avtext_print_section_header(AVTextFormatContext *tctx, const void *data, in
void avtext_print_section_footer(AVTextFormatContext *tctx);
-void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val);
+void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val, int flags);
int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char *val, int flags);
More information about the ffmpeg-cvslog
mailing list