Go to the documentation of this file.
35 #define writer_w8(wctx_, b_) (wctx_)->writer->writer->writer_w8((wctx_)->writer, b_)
36 #define writer_put_str(wctx_, str_) (wctx_)->writer->writer->writer_put_str((wctx_)->writer, str_)
37 #define writer_printf(wctx_, fmt_, ...) (wctx_)->writer->writer->writer_printf((wctx_)->writer, fmt_, __VA_ARGS__)
39 #define DEFINE_FORMATTER_CLASS(name) \
40 static const char *name##_get_name(void *ctx) \
44 static const AVClass name##_class = { \
45 .class_name = #name, \
46 .item_name = name##_get_name, \
47 .option = name##_options \
61 #define OFFSET(x) offsetof(XMLContext, x)
64 {
"fully_qualified",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
65 {
"q",
"specify if the output should be fully qualified",
OFFSET(fully_qualified),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
66 {
"xsd_strict",
"ensure that the output is XSD compliant",
OFFSET(xsd_strict),
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
79 #define CHECK_COMPLIANCE(opt, opt_name) \
81 av_log(wctx, AV_LOG_ERROR, \
82 "XSD-compliant output selected but option '%s' was selected, XML output may be non-compliant.\n" \
83 "You need to disable such option with '-no%s'\n", opt_name, opt_name); \
84 return AVERROR(EINVAL); \
94 #define XML_INDENT() writer_printf(wctx, "%*c", xml->indent_level * 4, ' ')
103 if (wctx->
level == 0) {
104 const char *qual =
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
105 "xmlns:ffprobe=\"http://www.ffmpeg.org/schema/ffprobe\" "
106 "xsi:schemaLocation=\"http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd\"";
108 writer_put_str(wctx,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
147 if (wctx->
level == 0) {
160 const char *str,
int64_t num,
const int is_int)
219 .priv_class = &xml_class,
#define AV_BPRINT_SIZE_UNLIMITED
const struct AVTextFormatSection * section[SECTION_MAX_NB_LEVELS]
section per each level
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
const AVTextFormatter avtextformatter_xml
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
#define writer_w8(wctx_, b_)
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.
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 void xml_print_value(AVTextFormatContext *wctx, const char *key, const char *str, int64_t num, const int is_int)
#define writer_printf(wctx_, fmt_,...)
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 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 writer_put_str(wctx_, str_)
#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.
#define AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY
the section contains an array of elements of the same type
#define DEFINE_FORMATTER_CLASS(name)