FFmpeg
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Functions | Variables
tf_xml.c File Reference
#include <limits.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "avtextformat.h"
#include "libavutil/bprint.h"
#include "libavutil/error.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  XMLContext
 

Macros

#define writer_w8(wctx_, b_)   (wctx_)->writer->writer->writer_w8((wctx_)->writer, b_)
 
#define writer_put_str(wctx_, str_)   (wctx_)->writer->writer->writer_put_str((wctx_)->writer, str_)
 
#define writer_printf(wctx_, fmt_, ...)   (wctx_)->writer->writer->writer_printf((wctx_)->writer, fmt_, __VA_ARGS__)
 
#define DEFINE_FORMATTER_CLASS(name)
 
#define OFFSET(x)   offsetof(XMLContext, x)
 
#define CHECK_COMPLIANCE(opt, opt_name)
 
#define XML_INDENT()   writer_printf(wctx, "%*c", xml->indent_level * 4, ' ')
 

Functions

 DEFINE_FORMATTER_CLASS (xml)
 
static av_cold int xml_init (AVTextFormatContext *wctx)
 
static void xml_print_section_header (AVTextFormatContext *wctx, const void *data)
 
static void xml_print_section_footer (AVTextFormatContext *wctx)
 
static void xml_print_value (AVTextFormatContext *wctx, const char *key, const char *str, int64_t num, const int is_int)
 
static void xml_print_str (AVTextFormatContext *wctx, const char *key, const char *value)
 
static void xml_print_int (AVTextFormatContext *wctx, const char *key, int64_t value)
 

Variables

static const AVOption xml_options []
 
const AVTextFormatter avtextformatter_xml
 

Macro Definition Documentation

◆ writer_w8

#define writer_w8 (   wctx_,
  b_ 
)    (wctx_)->writer->writer->writer_w8((wctx_)->writer, b_)

Definition at line 32 of file tf_xml.c.

◆ writer_put_str

#define writer_put_str (   wctx_,
  str_ 
)    (wctx_)->writer->writer->writer_put_str((wctx_)->writer, str_)

Definition at line 33 of file tf_xml.c.

◆ writer_printf

#define writer_printf (   wctx_,
  fmt_,
  ... 
)    (wctx_)->writer->writer->writer_printf((wctx_)->writer, fmt_, __VA_ARGS__)

Definition at line 34 of file tf_xml.c.

◆ DEFINE_FORMATTER_CLASS

#define DEFINE_FORMATTER_CLASS (   name)
Value:
static const char *name##_get_name(void *ctx) \
{ \
return #name ; \
} \
static const AVClass name##_class = { \
.class_name = #name, \
.item_name = name##_get_name, \
.option = name##_options \
}

Definition at line 36 of file tf_xml.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(XMLContext, x)

Definition at line 58 of file tf_xml.c.

◆ CHECK_COMPLIANCE

#define CHECK_COMPLIANCE (   opt,
  opt_name 
)
Value:
if (opt) { \
av_log(wctx, AV_LOG_ERROR, \
"XSD-compliant output selected but option '%s' was selected, XML output may be non-compliant.\n" \
"You need to disable such option with '-no%s'\n", opt_name, opt_name); \
return AVERROR(EINVAL); \
}

◆ XML_INDENT

#define XML_INDENT ( )    writer_printf(wctx, "%*c", xml->indent_level * 4, ' ')

Definition at line 91 of file tf_xml.c.

Function Documentation

◆ DEFINE_FORMATTER_CLASS()

DEFINE_FORMATTER_CLASS ( xml  )

◆ xml_init()

static av_cold int xml_init ( AVTextFormatContext wctx)
static

Definition at line 70 of file tf_xml.c.

◆ xml_print_section_header()

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

Definition at line 93 of file tf_xml.c.

◆ xml_print_section_footer()

static void xml_print_section_footer ( AVTextFormatContext wctx)
static

Definition at line 139 of file tf_xml.c.

◆ xml_print_value()

static void xml_print_value ( AVTextFormatContext wctx,
const char *  key,
const char *  str,
int64_t  num,
const int  is_int 
)
static

Definition at line 156 of file tf_xml.c.

Referenced by xml_print_int(), and xml_print_str().

◆ xml_print_str()

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

Definition at line 198 of file tf_xml.c.

◆ xml_print_int()

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

Definition at line 202 of file tf_xml.c.

Variable Documentation

◆ xml_options

const AVOption xml_options[]
static
Initial value:
= {
{"fully_qualified", "specify if the output should be fully qualified", OFFSET(fully_qualified), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
{"q", "specify if the output should be fully qualified", OFFSET(fully_qualified), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
{"xsd_strict", "ensure that the output is XSD compliant", OFFSET(xsd_strict), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
{"x", "ensure that the output is XSD compliant", OFFSET(xsd_strict), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
{NULL},
}

Definition at line 60 of file tf_xml.c.

◆ avtextformatter_xml

const AVTextFormatter avtextformatter_xml
Initial value:
= {
.name = "xml",
.priv_size = sizeof(XMLContext),
.print_section_header = xml_print_section_header,
.print_section_footer = xml_print_section_footer,
.print_integer = xml_print_int,
.print_string = xml_print_str,
.priv_class = &xml_class,
}

Definition at line 207 of file tf_xml.c.

Referenced by formatters_register_all(), and main().

flags
const SwsFlags flags[]
Definition: swscale.c:61
name
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 minimum maximum flags name is the option name
Definition: writing_filters.txt:88
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
xml_print_section_header
static void xml_print_section_header(AVTextFormatContext *wctx, const void *data)
Definition: tf_xml.c:93
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
NULL
#define NULL
Definition: coverity.c:32
xml_print_int
static void xml_print_int(AVTextFormatContext *wctx, const char *key, int64_t value)
Definition: tf_xml.c:202
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
xml_init
static av_cold int xml_init(AVTextFormatContext *wctx)
Definition: tf_xml.c:70
xml_print_str
static void xml_print_str(AVTextFormatContext *wctx, const char *key, const char *value)
Definition: tf_xml.c:198
xml_print_section_footer
static void xml_print_section_footer(AVTextFormatContext *wctx)
Definition: tf_xml.c:139
AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT
#define AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT
Definition: avtextformat.h:60
XMLContext
Definition: tf_xml.c:49
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
OFFSET
#define OFFSET(x)
Definition: tf_xml.c:58