FFmpeg
Loading...
Searching...
No Matches
tf_json.c File Reference
#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
#include <string.h>
#include "avtextformat.h"
#include "libavutil/bprint.h"
#include "libavutil/opt.h"
#include "tf_internal.h"

Go to the source code of this file.

Data Structures

struct  JSONContext
 

Macros

#define OFFSET(x)
 
#define JSON_INDENT()
 

Functions

 DEFINE_FORMATTER_CLASS (json)
 
static av_cold int json_init (AVTextFormatContext *wctx)
 
static const char * json_escape_str (AVBPrint *dst, const char *src, void *log_ctx)
 
static void json_print_section_header (AVTextFormatContext *wctx, const void *data)
 
static void json_print_section_footer (AVTextFormatContext *wctx)
 
static void json_print_item_str (AVTextFormatContext *wctx, const char *key, const char *value)
 
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)
 

Variables

static const AVOption json_options []
 
const AVTextFormatter avtextformatter_json
 

Macro Definition Documentation

◆ OFFSET

#define OFFSET ( x)
Value:
offsetof(JSONContext, x)

Definition at line 41 of file tf_json.c.

◆ JSON_INDENT

#define JSON_INDENT ( )
Value:
writer_printf(wctx, "%*c", json->indent_level * 4, ' ')
static void writer_printf(AVTextFormatContext *wctx, const char *fmt,...)
Definition tf_internal.h:73

Definition at line 86 of file tf_json.c.

Referenced by json_print_int(), json_print_section_footer(), json_print_section_header(), and json_print_str().

Function Documentation

◆ DEFINE_FORMATTER_CLASS()

DEFINE_FORMATTER_CLASS ( json )

◆ json_init()

static av_cold int json_init ( AVTextFormatContext * wctx)
static

Definition at line 51 of file tf_json.c.

◆ json_escape_str()

static const char * json_escape_str ( AVBPrint * dst,
const char * src,
void * log_ctx )
static

Definition at line 61 of file tf_json.c.

Referenced by json_print_int(), json_print_item_str(), and json_print_section_header().

◆ json_print_section_header()

static void json_print_section_header ( AVTextFormatContext * wctx,
const void * data )
static

Definition at line 88 of file tf_json.c.

◆ json_print_section_footer()

static void json_print_section_footer ( AVTextFormatContext * wctx)
static

Definition at line 129 of file tf_json.c.

◆ json_print_item_str()

static void json_print_item_str ( AVTextFormatContext * wctx,
const char * key,
const char * value )
inlinestatic

Definition at line 154 of file tf_json.c.

Referenced by json_print_str().

◆ json_print_str()

static void json_print_str ( AVTextFormatContext * wctx,
const char * key,
const char * value )
static

Definition at line 166 of file tf_json.c.

◆ json_print_int()

static void json_print_int ( AVTextFormatContext * wctx,
const char * key,
int64_t value )
static

Definition at line 182 of file tf_json.c.

Variable Documentation

◆ json_options

const AVOption json_options[]
static
Initial value:
= {
{ "compact", "enable compact output", OFFSET(compact), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1 },
{ "c", "enable compact output", OFFSET(compact), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1 },
{ NULL }
}
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326

Definition at line 43 of file tf_json.c.

◆ avtextformatter_json

const AVTextFormatter avtextformatter_json
Initial value:
= {
.name = "json",
.priv_size = sizeof(JSONContext),
.print_section_header = json_print_section_header,
.print_section_footer = json_print_section_footer,
.print_integer = json_print_int,
.print_string = json_print_str,
.priv_class = &json_class,
}
#define AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT
#define flags(name, subs,...)
Definition cbs_h264.c:74
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static void json_print_section_header(AVTextFormatContext *wctx, const void *data)
Definition tf_json.c:88
static av_cold int json_init(AVTextFormatContext *wctx)
Definition tf_json.c:51
static void json_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
Definition tf_json.c:166
static void json_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
Definition tf_json.c:182
static void json_print_section_footer(AVTextFormatContext *wctx)
Definition tf_json.c:129

Definition at line 202 of file tf_json.c.