You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
fftools/textformat: Apply formatting and whitespace changes
Reviewed-by: Stefano Sabatini <stefasab@gmail.com> Signed-off-by: softworkz <softworkz@hotmail.com>
This commit is contained in:
@ -34,9 +34,9 @@
|
|||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "avtextformat.h"
|
#include "avtextformat.h"
|
||||||
|
|
||||||
#define SECTION_ID_NONE -1
|
#define SECTION_ID_NONE (-1)
|
||||||
|
|
||||||
#define SHOW_OPTIONAL_FIELDS_AUTO -1
|
#define SHOW_OPTIONAL_FIELDS_AUTO (-1)
|
||||||
#define SHOW_OPTIONAL_FIELDS_NEVER 0
|
#define SHOW_OPTIONAL_FIELDS_NEVER 0
|
||||||
#define SHOW_OPTIONAL_FIELDS_ALWAYS 1
|
#define SHOW_OPTIONAL_FIELDS_ALWAYS 1
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ void avtext_context_close(AVTextFormatContext **ptctx)
|
|||||||
|
|
||||||
|
|
||||||
int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *formatter, AVTextWriterContext *writer_context, const char *args,
|
int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *formatter, AVTextWriterContext *writer_context, const char *args,
|
||||||
const struct AVTextFormatSection *sections, int nb_sections,
|
const AVTextFormatSection *sections, int nb_sections,
|
||||||
int show_value_unit,
|
int show_value_unit,
|
||||||
int use_value_prefix,
|
int use_value_prefix,
|
||||||
int use_byte_value_binary_prefix,
|
int use_byte_value_binary_prefix,
|
||||||
@ -209,7 +209,7 @@ int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
|
|||||||
av_log(NULL, AV_LOG_ERROR, " %s", n);
|
av_log(NULL, AV_LOG_ERROR, " %s", n);
|
||||||
av_log(NULL, AV_LOG_ERROR, "\n");
|
av_log(NULL, AV_LOG_ERROR, "\n");
|
||||||
}
|
}
|
||||||
return ret;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *form
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
AVBPrint bp;
|
AVBPrint bp;
|
||||||
av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
|
av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
|
||||||
bprint_bytes(&bp, p0, p-p0),
|
bprint_bytes(&bp, p0, p - p0);
|
||||||
av_log(tctx, AV_LOG_ERROR,
|
av_log(tctx, AV_LOG_ERROR,
|
||||||
"Invalid UTF8 sequence %s found in string validation replace '%s'\n",
|
"Invalid UTF8 sequence %s found in string validation replace '%s'\n",
|
||||||
bp.str, tctx->string_validation_replacement);
|
bp.str, tctx->string_validation_replacement);
|
||||||
@ -254,9 +254,7 @@ static const char unit_byte_str[] = "byte" ;
|
|||||||
static const char unit_bit_per_second_str[] = "bit/s";
|
static const char unit_bit_per_second_str[] = "bit/s";
|
||||||
|
|
||||||
|
|
||||||
void avtext_print_section_header(AVTextFormatContext *tctx,
|
void avtext_print_section_header(AVTextFormatContext *tctx, const void *data, int section_id)
|
||||||
const void *data,
|
|
||||||
int section_id)
|
|
||||||
{
|
{
|
||||||
tctx->level++;
|
tctx->level++;
|
||||||
av_assert0(tctx->level < SECTION_MAX_NB_LEVELS);
|
av_assert0(tctx->level < SECTION_MAX_NB_LEVELS);
|
||||||
@ -285,8 +283,7 @@ void avtext_print_section_footer(AVTextFormatContext *tctx)
|
|||||||
tctx->level--;
|
tctx->level--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void avtext_print_integer(AVTextFormatContext *tctx,
|
void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t val)
|
||||||
const char *key, int64_t val)
|
|
||||||
{
|
{
|
||||||
const struct AVTextFormatSection *section = tctx->section[tctx->level];
|
const struct AVTextFormatSection *section = tctx->section[tctx->level];
|
||||||
|
|
||||||
@ -324,11 +321,9 @@ static inline int validate_string(AVTextFormatContext *tctx, char **dstp, const
|
|||||||
|
|
||||||
switch (tctx->string_validation) {
|
switch (tctx->string_validation) {
|
||||||
case AV_TEXTFORMAT_STRING_VALIDATION_FAIL:
|
case AV_TEXTFORMAT_STRING_VALIDATION_FAIL:
|
||||||
av_log(tctx, AV_LOG_ERROR,
|
av_log(tctx, AV_LOG_ERROR, "Invalid UTF-8 sequence found in string '%s'\n", src);
|
||||||
"Invalid UTF-8 sequence found in string '%s'\n", src);
|
|
||||||
ret = AVERROR_INVALIDDATA;
|
ret = AVERROR_INVALIDDATA;
|
||||||
goto end;
|
goto end;
|
||||||
break;
|
|
||||||
|
|
||||||
case AV_TEXTFORMAT_STRING_VALIDATION_REPLACE:
|
case AV_TEXTFORMAT_STRING_VALIDATION_REPLACE:
|
||||||
av_bprintf(&dstbuf, "%s", tctx->string_validation_replacement);
|
av_bprintf(&dstbuf, "%s", tctx->string_validation_replacement);
|
||||||
@ -340,11 +335,10 @@ static inline int validate_string(AVTextFormatContext *tctx, char **dstp, const
|
|||||||
av_bprint_append_data(&dstbuf, p0, p-p0);
|
av_bprint_append_data(&dstbuf, p0, p-p0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invalid_chars_nb && tctx->string_validation == AV_TEXTFORMAT_STRING_VALIDATION_REPLACE) {
|
if (invalid_chars_nb && tctx->string_validation == AV_TEXTFORMAT_STRING_VALIDATION_REPLACE)
|
||||||
av_log(tctx, AV_LOG_WARNING,
|
av_log(tctx, AV_LOG_WARNING,
|
||||||
"%d invalid UTF-8 sequence(s) found in string '%s', replaced with '%s'\n",
|
"%d invalid UTF-8 sequence(s) found in string '%s', replaced with '%s'\n",
|
||||||
invalid_chars_nb, src, tctx->string_validation_replacement);
|
invalid_chars_nb, src, tctx->string_validation_replacement);
|
||||||
}
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
av_bprint_finalize(&dstbuf, dstp);
|
av_bprint_finalize(&dstbuf, dstp);
|
||||||
@ -352,7 +346,11 @@ end:
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct unit_value {
|
struct unit_value {
|
||||||
union { double d; int64_t i; } val;
|
union {
|
||||||
|
double d;
|
||||||
|
int64_t i;
|
||||||
|
} val;
|
||||||
|
|
||||||
const char *unit;
|
const char *unit;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -402,6 +400,7 @@ static char *value_string(AVTextFormatContext *tctx, char *buf, int buf_size, st
|
|||||||
snprintf(buf, buf_size, "%f", vald);
|
snprintf(buf, buf_size, "%f", vald);
|
||||||
else
|
else
|
||||||
snprintf(buf, buf_size, "%"PRId64, vali);
|
snprintf(buf, buf_size, "%"PRId64, vali);
|
||||||
|
|
||||||
av_strlcatf(buf, buf_size, "%s%s%s", *prefix_string || tctx->show_value_unit ? " " : "",
|
av_strlcatf(buf, buf_size, "%s%s%s", *prefix_string || tctx->show_value_unit ? " " : "",
|
||||||
prefix_string, tctx->show_value_unit ? uv.unit : "");
|
prefix_string, tctx->show_value_unit ? uv.unit : "");
|
||||||
}
|
}
|
||||||
@ -440,11 +439,10 @@ int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char *
|
|||||||
if (ret < 0) goto end;
|
if (ret < 0) goto end;
|
||||||
tctx->formatter->print_string(tctx, key1, val1);
|
tctx->formatter->print_string(tctx, key1, val1);
|
||||||
end:
|
end:
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
av_log(tctx, AV_LOG_ERROR,
|
av_log(tctx, AV_LOG_ERROR,
|
||||||
"Invalid key=value string combination %s=%s in section %s\n",
|
"Invalid key=value string combination %s=%s in section %s\n",
|
||||||
key, val, section->unique_name);
|
key, val, section->unique_name);
|
||||||
}
|
|
||||||
av_free(key1);
|
av_free(key1);
|
||||||
av_free(val1);
|
av_free(val1);
|
||||||
} else {
|
} else {
|
||||||
@ -457,8 +455,7 @@ int avtext_print_string(AVTextFormatContext *tctx, const char *key, const char *
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void avtext_print_rational(AVTextFormatContext *tctx,
|
void avtext_print_rational(AVTextFormatContext *tctx, const char *key, AVRational q, char sep)
|
||||||
const char *key, AVRational q, char sep)
|
|
||||||
{
|
{
|
||||||
char buf[44];
|
char buf[44];
|
||||||
snprintf(buf, sizeof(buf), "%d%c%d", q.num, sep, q.den);
|
snprintf(buf, sizeof(buf), "%d%c%d", q.num, sep, q.den);
|
||||||
@ -484,12 +481,11 @@ void avtext_print_time(AVTextFormatContext *tctx, const char *key,
|
|||||||
|
|
||||||
void avtext_print_ts(AVTextFormatContext *tctx, const char *key, int64_t ts, int is_duration)
|
void avtext_print_ts(AVTextFormatContext *tctx, const char *key, int64_t ts, int is_duration)
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void avtext_print_data(AVTextFormatContext *tctx, const char *name,
|
void avtext_print_data(AVTextFormatContext *tctx, const char *name,
|
||||||
const uint8_t *data, int size)
|
const uint8_t *data, int size)
|
||||||
@ -526,6 +522,7 @@ void avtext_print_data_hash(AVTextFormatContext *tctx, const char *name,
|
|||||||
|
|
||||||
if (!tctx->hash)
|
if (!tctx->hash)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
av_hash_init(tctx->hash);
|
av_hash_init(tctx->hash);
|
||||||
av_hash_update(tctx->hash, data, size);
|
av_hash_update(tctx->hash, data, size);
|
||||||
snprintf(buf, sizeof(buf), "%s:", av_hash_get_name(tctx->hash));
|
snprintf(buf, sizeof(buf), "%s:", av_hash_get_name(tctx->hash));
|
||||||
@ -642,6 +639,7 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const AVTextFormatter *registered_formatters[7 + 1];
|
static const AVTextFormatter *registered_formatters[7 + 1];
|
||||||
|
|
||||||
static void formatters_register_all(void)
|
static void formatters_register_all(void)
|
||||||
{
|
{
|
||||||
static int initialized;
|
static int initialized;
|
||||||
|
@ -93,7 +93,7 @@ struct AVTextFormatContext {
|
|||||||
char *name; ///< name of this formatter instance
|
char *name; ///< name of this formatter instance
|
||||||
void *priv; ///< private data for use by the filter
|
void *priv; ///< private data for use by the filter
|
||||||
|
|
||||||
const struct AVTextFormatSection *sections; ///< array containing all sections
|
const AVTextFormatSection *sections; ///< array containing all sections
|
||||||
int nb_sections; ///< number of sections
|
int nb_sections; ///< number of sections
|
||||||
|
|
||||||
int level; ///< current level, starting from 0
|
int level; ///< current level, starting from 0
|
||||||
|
@ -49,7 +49,6 @@ typedef struct AVTextWriterContext {
|
|||||||
const AVTextWriter *writer;
|
const AVTextWriter *writer;
|
||||||
const char *name;
|
const char *name;
|
||||||
void *priv; ///< private data for use by the writer
|
void *priv; ///< private data for use by the writer
|
||||||
|
|
||||||
} AVTextWriterContext;
|
} AVTextWriterContext;
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ static const char *c_escape_str(AVBPrint *dst, const char *src, const char sep,
|
|||||||
static const char *csv_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
|
static const char *csv_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
|
||||||
{
|
{
|
||||||
char meta_chars[] = { sep, '"', '\n', '\r', '\0' };
|
char meta_chars[] = { sep, '"', '\n', '\r', '\0' };
|
||||||
|
|
||||||
int needs_quoting = !!src[strcspn(src, meta_chars)];
|
int needs_quoting = !!src[strcspn(src, meta_chars)];
|
||||||
|
|
||||||
if (needs_quoting)
|
if (needs_quoting)
|
||||||
@ -139,10 +140,13 @@ static av_cold int compact_init(AVTextFormatContext *wctx)
|
|||||||
}
|
}
|
||||||
compact->item_sep = compact->item_sep_str[0];
|
compact->item_sep = compact->item_sep_str[0];
|
||||||
|
|
||||||
if (!strcmp(compact->escape_mode_str, "none")) compact->escape_str = none_escape_str;
|
if (!strcmp(compact->escape_mode_str, "none")) {
|
||||||
else if (!strcmp(compact->escape_mode_str, "c" )) compact->escape_str = c_escape_str;
|
compact->escape_str = none_escape_str;
|
||||||
else if (!strcmp(compact->escape_mode_str, "csv" )) compact->escape_str = csv_escape_str;
|
} else if (!strcmp(compact->escape_mode_str, "c" )) {
|
||||||
else {
|
compact->escape_str = c_escape_str;
|
||||||
|
} else if (!strcmp(compact->escape_mode_str, "csv" )) {
|
||||||
|
compact->escape_str = csv_escape_str;
|
||||||
|
} else {
|
||||||
av_log(wctx, AV_LOG_ERROR, "Unknown escape mode '%s'\n", compact->escape_mode_str);
|
av_log(wctx, AV_LOG_ERROR, "Unknown escape mode '%s'\n", compact->escape_mode_str);
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
@ -204,11 +208,12 @@ static void compact_print_section_header(AVTextFormatContext *wctx, const void *
|
|||||||
|
|
||||||
static void compact_print_section_footer(AVTextFormatContext *wctx)
|
static void compact_print_section_footer(AVTextFormatContext *wctx)
|
||||||
{
|
{
|
||||||
|
const struct AVTextFormatSection *section = wctx->section[wctx->level];
|
||||||
CompactContext *compact = wctx->priv;
|
CompactContext *compact = wctx->priv;
|
||||||
|
|
||||||
if (!compact->nested_section[wctx->level] &&
|
if (!compact->nested_section[wctx->level] &&
|
||||||
compact->terminate_line[wctx->level] &&
|
compact->terminate_line[wctx->level] &&
|
||||||
!(wctx->section[wctx->level]->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER|AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
|
!(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
|
||||||
writer_w8(wctx, '\n');
|
writer_w8(wctx, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,9 +222,12 @@ static void compact_print_str(AVTextFormatContext *wctx, const char *key, const
|
|||||||
CompactContext *compact = wctx->priv;
|
CompactContext *compact = wctx->priv;
|
||||||
AVBPrint buf;
|
AVBPrint buf;
|
||||||
|
|
||||||
if (wctx->nb_item[wctx->level]) writer_w8(wctx, compact->item_sep);
|
if (wctx->nb_item[wctx->level])
|
||||||
|
writer_w8(wctx, compact->item_sep);
|
||||||
|
|
||||||
if (!compact->nokey)
|
if (!compact->nokey)
|
||||||
writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
||||||
|
|
||||||
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||||
writer_put_str(wctx, compact->escape_str(&buf, value, compact->item_sep, wctx));
|
writer_put_str(wctx, compact->escape_str(&buf, value, compact->item_sep, wctx));
|
||||||
av_bprint_finalize(&buf, NULL);
|
av_bprint_finalize(&buf, NULL);
|
||||||
@ -229,9 +237,12 @@ static void compact_print_int(AVTextFormatContext *wctx, const char *key, int64_
|
|||||||
{
|
{
|
||||||
CompactContext *compact = wctx->priv;
|
CompactContext *compact = wctx->priv;
|
||||||
|
|
||||||
if (wctx->nb_item[wctx->level]) writer_w8(wctx, compact->item_sep);
|
if (wctx->nb_item[wctx->level])
|
||||||
|
writer_w8(wctx, compact->item_sep);
|
||||||
|
|
||||||
if (!compact->nokey)
|
if (!compact->nokey)
|
||||||
writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
||||||
|
|
||||||
writer_printf(wctx, "%"PRId64, value);
|
writer_printf(wctx, "%"PRId64, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +126,7 @@ static void flat_print_section_header(AVTextFormatContext *wctx, const void *dat
|
|||||||
av_bprint_clear(buf);
|
av_bprint_clear(buf);
|
||||||
if (!parent_section)
|
if (!parent_section)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level - 1].str);
|
av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level - 1].str);
|
||||||
|
|
||||||
if (flat->hierarchical ||
|
if (flat->hierarchical ||
|
||||||
@ -133,9 +134,10 @@ static void flat_print_section_header(AVTextFormatContext *wctx, const void *dat
|
|||||||
av_bprintf(buf, "%s%s", wctx->section[wctx->level]->name, flat->sep_str);
|
av_bprintf(buf, "%s%s", wctx->section[wctx->level]->name, flat->sep_str);
|
||||||
|
|
||||||
if (parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) {
|
if (parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) {
|
||||||
int n = parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE ?
|
int n = parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE
|
||||||
wctx->nb_item_type[wctx->level-1][section->id] :
|
? wctx->nb_item_type[wctx->level - 1][section->id]
|
||||||
wctx->nb_item[wctx->level-1];
|
: wctx->nb_item[wctx->level - 1];
|
||||||
|
|
||||||
av_bprintf(buf, "%d%s", n, flat->sep_str);
|
av_bprintf(buf, "%d%s", n, flat->sep_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,9 +74,9 @@ DEFINE_FORMATTER_CLASS(ini);
|
|||||||
static char *ini_escape_str(AVBPrint *dst, const char *src)
|
static char *ini_escape_str(AVBPrint *dst, const char *src)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char c = 0;
|
char c;
|
||||||
|
|
||||||
while (c = src[i++]) {
|
while ((c = src[i++])) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '\b': av_bprintf(dst, "%s", "\\b"); break;
|
case '\b': av_bprintf(dst, "%s", "\\b"); break;
|
||||||
case '\f': av_bprintf(dst, "%s", "\\f"); break;
|
case '\f': av_bprintf(dst, "%s", "\\f"); break;
|
||||||
@ -86,7 +86,9 @@ static char *ini_escape_str(AVBPrint *dst, const char *src)
|
|||||||
case '\\':
|
case '\\':
|
||||||
case '#':
|
case '#':
|
||||||
case '=':
|
case '=':
|
||||||
case ':' : av_bprint_chars(dst, '\\', 1);
|
case ':':
|
||||||
|
av_bprint_chars(dst, '\\', 1);
|
||||||
|
/* fallthrough */
|
||||||
default:
|
default:
|
||||||
if ((unsigned char)c < 32)
|
if ((unsigned char)c < 32)
|
||||||
av_bprintf(dst, "\\x00%02x", c & 0xff);
|
av_bprintf(dst, "\\x00%02x", c & 0xff);
|
||||||
@ -121,10 +123,10 @@ static void ini_print_section_header(AVTextFormatContext *wctx, const void *data
|
|||||||
av_bprintf(buf, "%s%s", buf->str[0] ? "." : "", wctx->section[wctx->level]->name);
|
av_bprintf(buf, "%s%s", buf->str[0] ? "." : "", wctx->section[wctx->level]->name);
|
||||||
|
|
||||||
if (parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) {
|
if (parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) {
|
||||||
int n = parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE ?
|
unsigned n = parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE
|
||||||
wctx->nb_item_type[wctx->level-1][section->id] :
|
? wctx->nb_item_type[wctx->level - 1][section->id]
|
||||||
wctx->nb_item[wctx->level-1];
|
: wctx->nb_item[wctx->level - 1];
|
||||||
av_bprintf(buf, ".%d", n);
|
av_bprintf(buf, ".%u", n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,8 @@ static void xml_print_section_header(AVTextFormatContext *wctx, const void *data
|
|||||||
xml->indent_level++;
|
xml->indent_level++;
|
||||||
|
|
||||||
if (section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY | AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS)) {
|
if (section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY | AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS)) {
|
||||||
XML_INDENT(); writer_printf(wctx, "<%s", section->name);
|
XML_INDENT();
|
||||||
|
writer_printf(wctx, "<%s", section->name);
|
||||||
|
|
||||||
if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE) {
|
if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE) {
|
||||||
AVBPrint buf;
|
AVBPrint buf;
|
||||||
@ -131,7 +132,8 @@ static void xml_print_section_header(AVTextFormatContext *wctx, const void *data
|
|||||||
}
|
}
|
||||||
writer_printf(wctx, ">\n", section->name);
|
writer_printf(wctx, ">\n", section->name);
|
||||||
} else {
|
} else {
|
||||||
XML_INDENT(); writer_printf(wctx, "<%s ", section->name);
|
XML_INDENT();
|
||||||
|
writer_printf(wctx, "<%s ", section->name);
|
||||||
xml->within_tag = 1;
|
xml->within_tag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,7 +150,8 @@ static void xml_print_section_footer(AVTextFormatContext *wctx)
|
|||||||
writer_put_str(wctx, "/>\n");
|
writer_put_str(wctx, "/>\n");
|
||||||
xml->indent_level--;
|
xml->indent_level--;
|
||||||
} else {
|
} else {
|
||||||
XML_INDENT(); writer_printf(wctx, "</%s>\n", section->name);
|
XML_INDENT();
|
||||||
|
writer_printf(wctx, "</%s>\n", section->name);
|
||||||
xml->indent_level--;
|
xml->indent_level--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,7 +198,8 @@ static void xml_print_value(AVTextFormatContext *wctx, const char *key,
|
|||||||
av_bprint_finalize(&buf, NULL);
|
av_bprint_finalize(&buf, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void xml_print_str(AVTextFormatContext *wctx, const char *key, const char *value) {
|
static inline void xml_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
|
||||||
|
{
|
||||||
xml_print_value(wctx, key, value, 0, 0);
|
xml_print_value(wctx, key, value, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user