41#define OFFSET(x) offsetof(JSONContext, x)
63 static const char json_escape[] = {
'"',
'\\',
'\b',
'\f',
'\n',
'\r',
'\t', 0 };
64 static const char json_subst[] = {
'"',
'\\',
'b',
'f',
'n',
'r',
't', 0 };
72 for (p =
src; *p; p++) {
73 const char *
s = strchr(json_escape, *p);
77 }
else if ((
unsigned char)*p < 32) {
86#define JSON_INDENT() writer_printf(wctx, "%*c", json->indent_level * 4, ' ')
137 if (wctx->
level == 0) {
211 .priv_class = &json_class,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#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_IS_ARRAY
the section contains an array of elements of the same type
const AVTextFormatter avtextformatter_json
#define AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT
#define AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE
the items in this array section should be numbered individually by type
void av_bprintf(AVBPrint *buf, const char *fmt,...)
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.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
#define AV_LOG_WARNING
Something somehow does not look correct.
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 * item_start_end
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 json_print_section_header(AVTextFormatContext *wctx, const void *data)
static av_cold int json_init(AVTextFormatContext *wctx)
static void json_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
static void json_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
static const char * json_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
static void json_print_section_footer(AVTextFormatContext *wctx)
static void json_print_item_str(AVTextFormatContext *wctx, const char *key, const char *value)
static const AVOption json_options[]