forked from FFmpeg/FFmpeg
fftools/ffprobe: Simplify printing xml values
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
ed5bf403d7
commit
08328463d5
1 changed files with 8 additions and 7 deletions
|
@ -1860,7 +1860,8 @@ static void xml_print_section_footer(WriterContext *wctx)
|
|||
}
|
||||
}
|
||||
|
||||
static void xml_print_value(WriterContext *wctx, const char *key, const void *value, const int is_int)
|
||||
static void xml_print_value(WriterContext *wctx, const char *key,
|
||||
const char *str, long long int num, const int is_int)
|
||||
{
|
||||
AVBPrint buf;
|
||||
XMLContext *xml = wctx->priv;
|
||||
|
@ -1878,9 +1879,9 @@ static void xml_print_value(WriterContext *wctx, const char *key, const void *va
|
|||
av_bprint_clear(&buf);
|
||||
|
||||
if (is_int) {
|
||||
writer_printf(wctx, " value=\"%lld\"/>\n", *(long long int *)value);
|
||||
writer_printf(wctx, " value=\"%lld\"/>\n", num);
|
||||
} else {
|
||||
av_bprint_escape(&buf, (const char *)value, NULL,
|
||||
av_bprint_escape(&buf, str, NULL,
|
||||
AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
|
||||
writer_printf(wctx, " value=\"%s\"/>\n", buf.str);
|
||||
}
|
||||
|
@ -1890,9 +1891,9 @@ static void xml_print_value(WriterContext *wctx, const char *key, const void *va
|
|||
writer_w8(wctx, ' ');
|
||||
|
||||
if (is_int) {
|
||||
writer_printf(wctx, "%s=\"%lld\"", key, *(long long int *)value);
|
||||
writer_printf(wctx, "%s=\"%lld\"", key, num);
|
||||
} else {
|
||||
av_bprint_escape(&buf, (const char *)value, NULL,
|
||||
av_bprint_escape(&buf, str, NULL,
|
||||
AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
|
||||
writer_printf(wctx, "%s=\"%s\"", key, buf.str);
|
||||
}
|
||||
|
@ -1902,11 +1903,11 @@ static void xml_print_value(WriterContext *wctx, const char *key, const void *va
|
|||
}
|
||||
|
||||
static inline void xml_print_str(WriterContext *wctx, const char *key, const char *value) {
|
||||
xml_print_value(wctx, key, (const void *)value, 0);
|
||||
xml_print_value(wctx, key, value, 0, 0);
|
||||
}
|
||||
|
||||
static inline void xml_print_int(WriterContext *wctx, const char *key, long long int value) {
|
||||
xml_print_value(wctx, key, (const void *)&value, 1);
|
||||
xml_print_value(wctx, key, NULL, value, 1);
|
||||
}
|
||||
|
||||
static Writer xml_writer = {
|
||||
|
|
Loading…
Add table
Reference in a new issue