41#define OFFSET(x) offsetof(XMLContext, x)
44 {
"fully_qualified",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1 },
45 {
"q",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1 },
46 {
"xsd_strict",
"ensure that the output is XSD compliant",
OFFSET(xsd_strict),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1 },
47 {
"x",
"ensure that the output is XSD compliant",
OFFSET(xsd_strict),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1 },
59#define CHECK_COMPLIANCE(opt, opt_name) \
61 av_log(wctx, AV_LOG_ERROR, \
62 "XSD-compliant output selected but option '%s' was selected, XML output may be non-compliant.\n" \
63 "You need to disable such option with '-no%s'\n", opt_name, opt_name); \
64 return AVERROR(EINVAL); \
74#define XML_INDENT() writer_printf(wctx, "%*c", xml->indent_level * 4, ' ')
85 if (wctx->
level == 0) {
86 const char *qual =
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
87 "xmlns:ffprobe=\"http://www.ffmpeg.org/schema/ffprobe\" "
88 "xsi:schemaLocation=\"http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd\"";
90 writer_put_str(wctx,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
134 if (wctx->
level == 0) {
148 const char *str,
int64_t num,
const int is_int)
211 .priv_class = &xml_class,
#define AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE
For these sections the element_name field is mandatory.
#define AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER
the section only contains other sections, but has no data at its own level
#define AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS
the section may contain a variable number of fields with variable keys.
#define AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY
the section contains an array of elements of the same type
#define AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT
const AVTextFormatter avtextformatter_xml
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define flags(name, subs,...)
int(* init)(AVBSFContext *ctx)
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags)
Escape the content in src and append it to dstbuf.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
#define AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES
Within AV_ESCAPE_MODE_XML, additionally escape double quotes for double quoted attributes.
@ AV_ESCAPE_MODE_XML
Use XML non-markup character data escaping.
Describe the class of an AVClass context structure.
void * priv
private data for use by the filter
int level
current level, starting from 0
unsigned int nb_item[SECTION_MAX_NB_LEVELS]
number of the item printed in the given section, starting from 0
const char * element_name
name of the contained element, if provided
const char *(* get_type)(const void *data)
function returning a type if defined, must be defined when SECTION_FLAG_HAS_TYPE is defined
Internal utilities for text formatters.
static const AVTextFormatSection * tf_get_section(AVTextFormatContext *tfc, int level)
Safely validate and access a section at a given level.
static const AVTextFormatSection * tf_get_parent_section(AVTextFormatContext *tfc, int level)
Safely access the parent section.
#define DEFINE_FORMATTER_CLASS(name)
static void writer_w8(AVTextFormatContext *wctx, int b)
static void writer_printf(AVTextFormatContext *wctx, const char *fmt,...)
static void writer_put_str(AVTextFormatContext *wctx, const char *str)
static void xml_print_value(AVTextFormatContext *wctx, const char *key, const char *str, int64_t num, const int is_int)
#define CHECK_COMPLIANCE(opt, opt_name)
static void xml_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
static void xml_print_section_header(AVTextFormatContext *wctx, const void *data)
static const AVOption xml_options[]
static void xml_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
static av_cold int xml_init(AVTextFormatContext *wctx)
static void xml_print_section_footer(AVTextFormatContext *wctx)