From: softworkz <softwo...@hotmail.com>

This function works analog to the avtext_print_string() which already
has a flags parameter.

Signed-off-by: softworkz <softwo...@hotmail.com>
---
 fftools/textformat/avtextformat.c | 25 +++++++++++++++++++++----
 fftools/textformat/avtextformat.h |  2 ++
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/fftools/textformat/avtextformat.c 
b/fftools/textformat/avtextformat.c
index b8e283d00c..86220dc676 100644
--- a/fftools/textformat/avtextformat.c
+++ b/fftools/textformat/avtextformat.c
@@ -301,6 +301,21 @@ void avtext_print_integer(AVTextFormatContext *tctx, const 
char *key, int64_t va
     }
 }
 
+void avtext_print_integer_flags(AVTextFormatContext *tctx, const char *key, 
int64_t val, int flags)
+{
+    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;
+
+    avtext_print_integer(tctx, key, val);
+}
+
 static inline int validate_string(AVTextFormatContext *tctx, char **dstp, 
const char *src)
 {
     const uint8_t *p, *endp, *srcp = (const uint8_t *)src;
@@ -442,10 +457,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)) {
diff --git a/fftools/textformat/avtextformat.h 
b/fftools/textformat/avtextformat.h
index 071149c5be..f4175c6f48 100644
--- a/fftools/textformat/avtextformat.h
+++ b/fftools/textformat/avtextformat.h
@@ -141,6 +141,8 @@ void avtext_print_section_footer(AVTextFormatContext *tctx);
 
 void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t 
val);
 
+void avtext_print_integer_flags(AVTextFormatContext *tctx, const char *key, 
int64_t val, int flags);
+
 int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char 
*val, int flags);
 
 void avtext_print_unit_int(AVTextFormatContext *tctx, const char *key, int 
value, const char *unit);
-- 
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-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to