FFmpeg  4.0
Macros | Functions
graphparser.c File Reference
#include <string.h>
#include <stdio.h>
#include "libavutil/avstring.h"
#include "libavutil/mem.h"
#include "avfilter.h"

Go to the source code of this file.

Macros

#define WHITESPACES   " \n\t\r"
 

Functions

static int link_filter (AVFilterContext *src, int srcpad, AVFilterContext *dst, int dstpad, void *log_ctx)
 Link two filters together. More...
 
static char * parse_link_name (const char **buf, void *log_ctx)
 Parse the name of a link, which has the format "[linkname]". More...
 
static int create_filter (AVFilterContext **filt_ctx, AVFilterGraph *ctx, int index, const char *name, const char *args, void *log_ctx)
 Create an instance of a filter, initialize and insert it in the filtergraph in *ctx. More...
 
static int parse_filter (AVFilterContext **filt_ctx, const char **buf, AVFilterGraph *graph, int index, void *log_ctx)
 Parse a string of the form FILTER_NAME[=PARAMS], and create a corresponding filter instance which is added to graph with create_filter(). More...
 
AVFilterInOutavfilter_inout_alloc (void)
 Allocate a single AVFilterInOut entry. More...
 
void avfilter_inout_free (AVFilterInOut **inout)
 Free the supplied list of AVFilterInOut and set *inout to NULL. More...
 
static AVFilterInOutextract_inout (const char *label, AVFilterInOut **links)
 
static void insert_inout (AVFilterInOut **inouts, AVFilterInOut *element)
 
static void append_inout (AVFilterInOut **inouts, AVFilterInOut **element)
 
static int link_filter_inouts (AVFilterContext *filt_ctx, AVFilterInOut **curr_inputs, AVFilterInOut **open_inputs, void *log_ctx)
 
static int parse_inputs (const char **buf, AVFilterInOut **curr_inputs, AVFilterInOut **open_outputs, void *log_ctx)
 
static int parse_outputs (const char **buf, AVFilterInOut **curr_inputs, AVFilterInOut **open_inputs, AVFilterInOut **open_outputs, void *log_ctx)
 
static int parse_sws_flags (const char **buf, AVFilterGraph *graph)
 
int avfilter_graph_parse2 (AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs)
 Add a graph described by a string to a graph. More...
 
int avfilter_graph_parse (AVFilterGraph *graph, const char *filters, AVFilterInOut *open_inputs, AVFilterInOut *open_outputs, void *log_ctx)
 Add a graph described by a string to a graph. More...
 
int avfilter_graph_parse_ptr (AVFilterGraph *graph, const char *filters, AVFilterInOut **open_inputs_ptr, AVFilterInOut **open_outputs_ptr, void *log_ctx)
 Add a graph described by a string to a graph. More...
 

Macro Definition Documentation

◆ WHITESPACES

#define WHITESPACES   " \n\t\r"

Function Documentation

◆ link_filter()

static int link_filter ( AVFilterContext src,
int  srcpad,
AVFilterContext dst,
int  dstpad,
void log_ctx 
)
static

Link two filters together.

See also
avfilter_link()

Definition at line 37 of file graphparser.c.

Referenced by link_filter_inouts(), and parse_outputs().

◆ parse_link_name()

static char* parse_link_name ( const char **  buf,
void log_ctx 
)
static

Parse the name of a link, which has the format "[linkname]".

Returns
a pointer (that need to be freed after use) to the name between parenthesis

Definition at line 58 of file graphparser.c.

Referenced by parse_inputs(), and parse_outputs().

◆ create_filter()

static int create_filter ( AVFilterContext **  filt_ctx,
AVFilterGraph ctx,
int  index,
const char *  name,
const char *  args,
void log_ctx 
)
static

Create an instance of a filter, initialize and insert it in the filtergraph in *ctx.

Parameters
filt_ctxput here a filter context in case of successful creation and configuration, NULL otherwise.
ctxthe filtergraph context
indexan index which is supposed to be unique for each filter instance added to the filtergraph
namethe name of the filter to create, can be filter name or filter_name@id as instance name
argsthe arguments provided to the filter during its initialization
log_ctxthe log context to use
Returns
>= 0 in case of success, a negative AVERROR code otherwise

Definition at line 96 of file graphparser.c.

Referenced by parse_filter().

◆ parse_filter()

static int parse_filter ( AVFilterContext **  filt_ctx,
const char **  buf,
AVFilterGraph graph,
int  index,
void log_ctx 
)
static

Parse a string of the form FILTER_NAME[=PARAMS], and create a corresponding filter instance which is added to graph with create_filter().

Parameters
filt_ctxPointer that is set to the created and configured filter context on success, set to NULL on failure.
filt_ctxput here a pointer to the created filter context on success, NULL otherwise
bufpointer to the buffer to parse, *buf will be updated to point to the char next after the parsed string
indexan index which is assigned to the created filter instance, and which is supposed to be unique for each filter instance added to the filtergraph
Returns
>= 0 in case of success, a negative AVERROR code otherwise

Definition at line 180 of file graphparser.c.

Referenced by avfilter_graph_parse2(), and avfilter_graph_parse_ptr().

◆ extract_inout()

static AVFilterInOut* extract_inout ( const char *  label,
AVFilterInOut **  links 
)
static

Definition at line 213 of file graphparser.c.

Referenced by avfilter_graph_parse(), parse_inputs(), and parse_outputs().

◆ insert_inout()

static void insert_inout ( AVFilterInOut **  inouts,
AVFilterInOut element 
)
static

Definition at line 230 of file graphparser.c.

Referenced by link_filter_inouts(), and parse_outputs().

◆ append_inout()

static void append_inout ( AVFilterInOut **  inouts,
AVFilterInOut **  element 
)
static

Definition at line 236 of file graphparser.c.

Referenced by avfilter_graph_parse2(), link_filter_inouts(), and parse_inputs().

◆ link_filter_inouts()

static int link_filter_inouts ( AVFilterContext filt_ctx,
AVFilterInOut **  curr_inputs,
AVFilterInOut **  open_inputs,
void log_ctx 
)
static

Definition at line 248 of file graphparser.c.

Referenced by avfilter_graph_parse2(), and avfilter_graph_parse_ptr().

◆ parse_inputs()

static int parse_inputs ( const char **  buf,
AVFilterInOut **  curr_inputs,
AVFilterInOut **  open_outputs,
void log_ctx 
)
static

Definition at line 296 of file graphparser.c.

Referenced by avfilter_graph_parse2(), and avfilter_graph_parse_ptr().

◆ parse_outputs()

static int parse_outputs ( const char **  buf,
AVFilterInOut **  curr_inputs,
AVFilterInOut **  open_inputs,
AVFilterInOut **  open_outputs,
void log_ctx 
)
static

Definition at line 336 of file graphparser.c.

Referenced by avfilter_graph_parse2(), and avfilter_graph_parse_ptr().

◆ parse_sws_flags()

static int parse_sws_flags ( const char **  buf,
AVFilterGraph graph 
)
static

Definition at line 384 of file graphparser.c.

Referenced by avfilter_graph_parse2(), and avfilter_graph_parse_ptr().