Go to the documentation of this file.
27 #include <stdatomic.h>
78 [
SECTION_ID_ROOT] = {
SECTION_ID_ROOT,
"root",
AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER, {
SECTION_ID_FILTERGRAPHS,
SECTION_ID_INPUTFILES,
SECTION_ID_OUTPUTFILES,
SECTION_ID_DECODERS,
SECTION_ID_ENCODERS,
SECTION_ID_STREAMLINKS, -1 } },
136 #define print_id(k, v) print_sanizied_id(gpc, k, v, 0)
137 #define print_id_noprefix(k, v) print_sanizied_id(gpc, k, v, 1)
138 #define print_int(k, v) avtext_print_integer(tfc, k, v, 0)
139 #define print_int_opt(k, v) avtext_print_integer(tfc, k, v, gpc->opt_flags)
140 #define print_q(k, v, s) avtext_print_rational(tfc, k, v, s)
141 #define print_str(k, v) avtext_print_string(tfc, k, v, 0)
142 #define print_str_opt(k, v) avtext_print_string(tfc, k, v, gpc->opt_flags)
143 #define print_val(k, v, u) avtext_print_unit_int(tfc, k, v, u)
145 #define print_fmt(k, f, ...) do { \
146 av_bprint_clear(&gpc->pbuf); \
147 av_bprintf(&gpc->pbuf, f, __VA_ARGS__); \
148 avtext_print_string(tfc, k, gpc->pbuf.str, 0); \
151 #define print_fmt_opt(k, f, ...) do { \
152 av_bprint_clear(&gpc->pbuf); \
153 av_bprintf(&gpc->pbuf, f, __VA_ARGS__); \
154 avtext_print_string(tfc, k, gpc->pbuf.str, gpc->opt_flags); \
163 for (
i = 0;
src[
i] &&
i < dst_size - 1;
i++)
171 const char *dot =
NULL;
172 const char *sep =
NULL;
180 end = strpbrk(url,
"?#");
182 end = url + strlen(url);
185 for (
const char *p = url; p < end; p++) {
188 else if (*p ==
'/' || *p ==
'\\')
193 if (dot && dot != url && (!sep || dot > sep + 1) && (dot + 1) < end) {
205 if (!hw_device_context)
218 if (!hw_frames_context || !hw_frames_context->
device_ctx)
229 if (pix_desc_hw->
alias)
236 if (pix_desc_sw->
alias)
251 char layout_string[64];
260 switch (
link->type) {
263 if (hw_frames_ctx && hw_frames_ctx->
data) {
267 if (pix_desc_hw && pix_desc_sw)
268 print_fmt(
"format",
"%s | %s", pix_desc_hw->name, pix_desc_sw->
name);
307 print_str(
"channel_layout", layout_string);
319 if (hw_frames_ctx && hw_frames_ctx->
data)
326 if ((
c >=
'0' &&
c <=
'9') || (
c >=
'a' &&
c <=
'z') || (
c >=
'A' &&
c <=
'Z'))
345 for (
const char *p = id_str; *p; p++)
368 for (
const char *p = id_str; *p; p++)
399 if (
filter->hw_device_ctx) {
402 if (
filter->extra_hw_frames > 0)
408 for (
unsigned i = 0;
i <
filter->nb_inputs;
i++) {
440 for (
unsigned i = 0;
i <
filter->nb_outputs;
i++) {
451 (void)
snprintf(buf,
sizeof(buf),
"out_%s", dic_entry->
value);
598 for (
int n = nb_ifiles - 1; n >= 0; n--) {
630 if (!ist || !ist->
par)
647 if (codec_desc && codec_desc->
name) {
650 }
else if (ist->
dec) {
677 for (
int n = 0; n < nb_ifiles; n++) {
714 for (
int n = 0; n < nb_ofiles; n++) {
753 for (
int n = nb_ofiles - 1; n >= 0; n--) {
799 if (codec_desc && codec_desc->
name) {
822 for (
int n = 0; n < nb_ofiles; n++) {
828 if (
ost->ist && !
ost->filter) {
834 print_fmt(
"dest_stream_id",
"out__%d_%d", n,
i);
838 print_fmt(
"dest_stream_id",
"r_out__%d_%d", n,
i);
887 if (!text_formatter) {
930 if (!strcmp(text_formatter->
name,
"mermaid") || !strcmp(text_formatter->
name,
"mermaidhtml")) {
933 if (!strcmp(text_formatter->
name,
"mermaidhtml"))
1007 AVBPrint target_buf;
1024 for (
int i = 0;
i < nb_graphs;
i++) {
1027 if (graph_buf->len > 0) {
1035 for (
int n = 0; n < nb_ofiles; n++) {
1041 if (
ost->fg_simple) {
1042 AVBPrint *graph_buf = &
ost->fg_simple->graph_print_buf;
1044 if (graph_buf->len > 0) {
1064 printf(
"%s", target_buf.str);
1072 avio_write(avio, (
const unsigned char *)target_buf.str,
FFMIN(target_buf.len, target_buf.size - 1));
@ SECTION_ID_HWFRAMESCONTEXT
static char * upcase_string(char *dst, size_t dst_size, const char *src)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
#define AV_BPRINT_SIZE_UNLIMITED
@ SECTION_ID_GRAPH_INPUTS
static void print_filter(GraphPrintContext *gpc, const AVFilterContext *filter, AVDictionary *input_map, AVDictionary *output_map)
#define AV_TEXTFORMAT_PRINT_STRING_OPTIONAL
#define AV_TEXTFORMAT_SECTION_PRINT_TAGS
...
#define AV_TEXTFORMAT_FLAG_IS_DIAGRAM_FORMATTER
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
__device__ int printf(const char *,...)
enum AVMediaType codec_type
General type of the encoded data.
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Get the name of an AVFilterPad.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define atomic_fetch_add(object, operand)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
uint8_t * data
The data buffer.
@ SECTION_ID_OUTPUTSTREAM
const char * long_name
A more descriptive name for this codec.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
const char * name
Name of the codec described by this descriptor.
char * av_asprintf(const char *fmt,...)
const char * context_type
@ SECTION_ID_GRAPH_OUTPUT
enum AVColorSpace colorspace
YUV colorspace type.
static av_cold void cleanup(FlashSV2Context *s)
static void print_section_header_id(const GraphPrintContext *gpc, int section_id, const char *id_str, int skip_prefix)
#define AV_TEXTFORMAT_SECTION_FLAG_IS_SUBGRAPH
...
void ff_resman_uninit(void)
void(* filter)(uint8_t *src, int stride, int qscale)
const char * name
Filter name.
int width
The allocated dimensions of the frames in this pool.
int nb_channels
Number of channels in this layout.
A link between two filters.
#define print_str_opt(k, v)
const char * av_color_space_name(enum AVColorSpace space)
@ SECTION_ID_INPUTSTREAMS
int print_filtergraph(FilterGraph *fg, AVFilterGraph *graph)
AVChannelLayout ch_layout
Channel layout of the audio data.
A filter pad used for either input or output.
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
char * ff_resman_get_string(FFResourceId resource_id)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
int avtextwriter_create_buffer(AVTextWriterContext **pwctx, AVBPrint *buffer)
static void print_hwframescontext(const GraphPrintContext *gpc, const AVHWFramesContext *hw_frames_context)
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
This struct describes the properties of a single codec described by an AVCodecID.
@ SECTION_ID_OUTPUTSTREAMS
static void print_filtergraph_single(GraphPrintContext *gpc, FilterGraph *fg, AVFilterGraph *graph)
int print_filtergraphs(FilterGraph **graphs, int nb_graphs, InputFile **ifiles, int nb_ifiles, OutputFile **ofiles, int nb_ofiles)
int avtextwriter_context_close(AVTextWriterContext **pwctx)
#define fc(width, name, range_min, range_max)
#define AVIO_FLAG_WRITE
write-only
int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter *formatter, AVTextWriterContext *writer_context, const char *args, const AVTextFormatSection *sections, int nb_sections, AVTextFormatOptions options, char *show_data_hash)
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
static void init_sections(void)
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 link
#define print_fmt(k, f,...)
@ SECTION_ID_FILTER_OUTPUT
const char * av_color_range_name(enum AVColorRange range)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static const char * get_filterpad_name(const AVFilterPad *pad)
#define print_val(k, v, u)
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVFilterContext ** filters
char * name
name of this filter instance
AVBufferRef * avfilter_link_get_hw_frames_ctx(AVFilterLink *link)
Get the hardware frames context of a filter link.
const AVTextFormatter * formatter
the AVTextFormatter of which this is an instance
static char sanitize_char(const char c)
const AVTextFormatter * avtext_get_formatter_by_name(const char *name)
@ AVCOL_RANGE_UNSPECIFIED
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
char * print_graphs_format
static int init_graphprint(GraphPrintContext **pgpc, AVBPrint *target_buf)
@ SECTION_ID_FILTERGRAPHS
static int print_streams(GraphPrintContext *gpc, InputFile **ifiles, int nb_ifiles, OutputFile **ofiles, int nb_ofiles)
AVDiagramConfig diagram_config
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
static char * get_extension(const char *url)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
AVTextWriterContext * wctx
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int sample_rate
Sample rate of the audio data.
void avtext_print_section_footer(AVTextFormatContext *tctx)
#define AV_TEXTFORMAT_SECTION_FLAG_IS_SHAPE
...
AVRational time_base
Time base for the timestamps in this frame.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
struct AVBPrint graph_print_buf
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static void print_sanizied_id(const GraphPrintContext *gpc, const char *key, const char *id_str, int skip_prefix)
int flags
a combination or AV_TEXTFORMAT__FLAG_*
static struct AVTextFormatSection sections[]
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#define AV_LOG_INFO
Standard information.
#define i(width, name, range_min, range_max)
const char * alias
Alternative comma-separated names.
#define AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS
the section may contain a variable number of fields with variable keys.
@ SECTION_ID_GRAPH_OUTPUTS
const AVClass * av_class
A class for AVOptions.
static av_const int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
#define print_int_opt(k, v)
static void print_link(GraphPrintContext *gpc, AVFilterLink *link)
This struct describes a set or pool of "hardware" frames (i.e.
enum AVHWDeviceType type
This field identifies the underlying API used for hardware access.
const struct AVOutputFormat * oformat
The output container format.
AVHWDeviceContext * device_ctx
The parent AVHWDeviceContext.
@ SECTION_ID_FILTER_OUTPUTS
#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,...)
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
#define AV_TEXTFORMAT_SECTION_FLAG_HAS_LINKS
...
const char * html_template
AVTextFormatContext * tfc
static atomic_int prefix_num
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
int index
stream index in AVFormatContext
static void print_hwdevicecontext(const GraphPrintContext *gpc, const AVHWDeviceContext *hw_device_context)
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
#define print_id_noprefix(k, v)
static void uninit_graphprint(GraphPrintContext *gpc)
int initial_pool_size
Initial size of the frame pool.
A reference to a data buffer.
int avio_open2(AVIOContext **s, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
@ SECTION_ID_FILTER_INPUT
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
void av_diagram_init(AVTextFormatContext *tfc, AVDiagramConfig *diagram_config)
#define print_fmt_opt(k, f,...)
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
const AVFilter * filter
the AVFilter of which this is an instance
const char *(* item_name)(void *ctx)
A pointer to a function which returns the name of a context instance ctx associated with the class.
static int print_filtergraphs_priv(FilterGraph **graphs, int nb_graphs, InputFile **ifiles, int nb_ifiles, OutputFile **ofiles, int nb_ofiles)
char * av_strndup(const char *s, size_t len)
Duplicate a substring of a string.
int avtext_context_close(AVTextFormatContext **ptctx)
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
#define AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY
the section contains an array of elements of the same type
@ SECTION_ID_FILTER_INPUTS
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
void avtext_print_section_header(AVTextFormatContext *tctx, const void *data, int section_id)