43 for (p =
src; *p; p++) {
64 char meta_chars[] = { sep,
'"',
'\n',
'\r',
'\0' };
66 int needs_quoting = !!
src[strcspn(
src, meta_chars)];
93 const char * (*escape_str)(AVBPrint *
dst,
const char *
src,
const char sep,
void *log_ctx);
100#define OFFSET(x) offsetof(CompactContext, x)
121 av_log(wctx,
AV_LOG_ERROR,
"Item separator '%s' specified, but must contain a single character\n",
154 if (parent_section &&
175 for (
const char *p = section->
get_type(
data); *p; p++) {
177 (*p >=
'0' && *p <=
'9') ||
178 (*p >=
'a' && *p <=
'z') ||
179 (*p >=
'A' && *p <=
'Z') ?
av_tolower(*p) :
'_';
248 .priv_class = &compact_class,
254#define OFFSET(x) offsetof(CompactContext, x)
279 .priv_class = &csv_class,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const AVTextFormatter avtextformatter_compact
#define AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE
For these sections the element_name field is mandatory.
#define SECTION_MAX_NB_LEVELS
#define AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS
const AVTextFormatter avtextformatter_csv
#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
Convenience header that includes libavutil's core.
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)
static void print_section(SectionID id, int level)
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
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_ERROR
Something went wrong and cannot losslessly be recovered.
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
static av_const int av_tolower(int c)
Locale-independent conversion of ASCII characters to lowercase.
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
AVBPrint section_pbuf[SECTION_MAX_NB_LEVELS]
generic print buffer dedicated to each section, used by various formatters
const char * element_name
name of the contained element, if provided
const char *(* get_type)(const void *data)
function returning a type if defined, must be defined when SECTION_FLAG_HAS_TYPE is defined
int terminate_line[SECTION_MAX_NB_LEVELS]
int has_nested_elems[SECTION_MAX_NB_LEVELS]
int nested_section[SECTION_MAX_NB_LEVELS]
const char *(* escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
static void compact_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
static void compact_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
static const AVOption csv_options[]
static const AVOption compact_options[]
static void compact_print_section_header(AVTextFormatContext *wctx, const void *data)
static const char * csv_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Quote fields containing special characters, check RFC4180.
static const char * c_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
Apply C-language-like string escaping.
static void compact_print_section_footer(AVTextFormatContext *wctx)
static av_cold int compact_init(AVTextFormatContext *wctx)
static const char * none_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx)
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)