Go to the documentation of this file.
31 #define writer_w8(wctx_, b_) (wctx_)->writer->writer->writer_w8((wctx_)->writer, b_)
32 #define writer_put_str(wctx_, str_) (wctx_)->writer->writer->writer_put_str((wctx_)->writer, str_)
33 #define writer_printf(wctx_, fmt_, ...) (wctx_)->writer->writer->writer_printf((wctx_)->writer, fmt_, __VA_ARGS__)
35 #define DEFINE_FORMATTER_CLASS(name) \
36 static const char *name##_get_name(void *ctx) \
40 static const AVClass name##_class = { \
41 .class_name = #name, \
42 .item_name = name##_get_name, \
43 .option = name##_options \
57 #define OFFSET(x) offsetof(JSONContext, x)
79 static const char json_escape[] = {
'"',
'\\',
'\b',
'\f',
'\n',
'\r',
'\t', 0};
80 static const char json_subst[] = {
'"',
'\\',
'b',
'f',
'n',
'r',
't', 0};
83 for (p =
src; *p; p++) {
84 char *
s = strchr(json_escape, *p);
88 }
else if ((
unsigned char)*p < 32) {
97 #define JSON_INDENT() writer_printf(wctx, "%*c", json->indent_level * 4, ' ')
143 if (wctx->
level == 0) {
211 .priv_class = &json_class,
static const char * json_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
#define AV_BPRINT_SIZE_UNLIMITED
static const AVOption json_options[]
const struct AVTextFormatSection * section[SECTION_MAX_NB_LEVELS]
section per each level
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
static void json_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
int level
current level, starting from 0
#define AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE
the items in this array section should be numbered individually by type
#define writer_put_str(wctx_, str_)
static av_cold int json_init(AVTextFormatContext *wctx)
void * priv
private data for use by the filter
Describe the class of an AVClass context structure.
#define DEFINE_FORMATTER_CLASS(name)
const AVTextFormatter avtextformatter_json
int(* init)(AVBSFContext *ctx)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static void json_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
static void json_print_section_header(AVTextFormatContext *wctx, const void *data)
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 writer_printf(wctx_, fmt_,...)
#define AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER
the section only contains other sections, but has no data at its own level
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
#define writer_w8(wctx_, b_)
static void json_print_section_footer(AVTextFormatContext *wctx)
unsigned int nb_item[SECTION_MAX_NB_LEVELS]
number of the item printed in the given section, starting from 0
const char * item_start_end
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
static void json_print_item_str(AVTextFormatContext *wctx, const char *key, const char *value)
#define AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY
the section contains an array of elements of the same type