You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02: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); \
|
avtext_print_string(tfc, k, pbuf.str, 0); \
|
||||||
} while (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_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(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)
|
#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--;
|
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;
|
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);
|
av_assert0(key && tctx->level >= 0 && tctx->level < SECTION_MAX_NB_LEVELS);
|
||||||
|
|
||||||
section = tctx->section[tctx->level];
|
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];
|
section = tctx->section[tctx->level];
|
||||||
|
|
||||||
if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER ||
|
if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER)
|
||||||
(tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO
|
return 0;
|
||||||
&& (flags & AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
|
|
||||||
&& !(tctx->formatter->flags & AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS)))
|
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;
|
return 0;
|
||||||
|
|
||||||
if (section->show_all_entries || av_dict_get(section->entries_to_show, key, NULL, 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))
|
if ((!is_duration && ts == AV_NOPTS_VALUE) || (is_duration && ts == 0))
|
||||||
avtext_print_string(tctx, key, "N/A", AV_TEXTFORMAT_PRINT_STRING_OPTIONAL);
|
avtext_print_string(tctx, key, "N/A", AV_TEXTFORMAT_PRINT_STRING_OPTIONAL);
|
||||||
else
|
else
|
||||||
avtext_print_integer(tctx, key, ts);
|
avtext_print_integer(tctx, key, ts, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void avtext_print_data(AVTextFormatContext *tctx, const char *key,
|
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_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);
|
int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char *val, int flags);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user