mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-05-17 23:17:41 +08:00
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@hotmail.com>
This commit is contained in:
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user