Go to the documentation of this file.
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_BPRINT_SIZE_UNLIMITED
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
const AVTextFormatter avtextformatter_xml
static void writer_printf(AVTextFormatContext *wctx, const char *fmt,...)
int level
current level, starting from 0
static void xml_print_section_header(AVTextFormatContext *wctx, const void *data)
#define AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES
Within AV_ESCAPE_MODE_XML, additionally escape double quotes for double quoted attributes.
const char * element_name
name of the contained element, if provided
void * priv
private data for use by the filter
#define AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE
For these sections the element_name field is mandatory.
Describe the class of an AVClass context structure.
static void writer_w8(AVTextFormatContext *wctx, int b)
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.
static const AVTextFormatSection * tf_get_parent_section(AVTextFormatContext *tfc, int level)
Safely access the parent section.
static void xml_print_value(AVTextFormatContext *wctx, const char *key, const char *str, int64_t num, const int is_int)
static const AVOption xml_options[]
static void xml_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
int(* init)(AVBSFContext *ctx)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
@ AV_ESCAPE_MODE_XML
Use XML non-markup character data escaping.
const char *(* get_type)(const void *data)
function returning a type if defined, must be defined when SECTION_FLAG_HAS_TYPE is defined
static av_cold int xml_init(AVTextFormatContext *wctx)
static void writer_put_str(AVTextFormatContext *wctx, const char *str)
static void xml_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
#define AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS
the section may contain a variable number of fields with variable keys.
static void xml_print_section_footer(AVTextFormatContext *wctx)
#define CHECK_COMPLIANCE(opt, opt_name)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
#define AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT
#define AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER
the section only contains other sections, but has no data at its own level
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
unsigned int nb_item[SECTION_MAX_NB_LEVELS]
number of the item printed in the given section, starting from 0
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
static const AVTextFormatSection * tf_get_section(AVTextFormatContext *tfc, int level)
Safely validate and access a section at a given level.
DEFINE_FORMATTER_CLASS(xml)
#define AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY
the section contains an array of elements of the same type