Go to the documentation of this file.
42 #define OFFSET(x) offsetof(JSONContext, x)
64 static const char json_escape[] = {
'"',
'\\',
'\b',
'\f',
'\n',
'\r',
'\t', 0 };
65 static const char json_subst[] = {
'"',
'\\',
'b',
'f',
'n',
'r',
't', 0 };
73 for (p =
src; *p; p++) {
74 char *
s = strchr(json_escape, *p);
78 }
else if ((
unsigned char)*p < 32) {
87 #define JSON_INDENT() writer_printf(wctx, "%*c", json->indent_level * 4, ' ')
138 if (wctx->
level == 0) {
212 .priv_class = &json_class,
static const char * json_escape_str(AVBPrint *dst, const char *src, void *log_ctx)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_BPRINT_SIZE_UNLIMITED
static const AVOption json_options[]
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
static void writer_printf(AVTextFormatContext *wctx, const char *fmt,...)
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
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.
static void writer_w8(AVTextFormatContext *wctx, int b)
static const AVTextFormatSection * tf_get_parent_section(AVTextFormatContext *tfc, int level)
Safely access the parent section.
const AVTextFormatter avtextformatter_json
int(* init)(AVBSFContext *ctx)
DEFINE_FORMATTER_CLASS(json)
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)
static void writer_put_str(AVTextFormatContext *wctx, const char *str)
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_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
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.
static const AVTextFormatSection * tf_get_section(AVTextFormatContext *tfc, int level)
Safely validate and access a section at a given level.
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