Go to the documentation of this file.
30 #define WHITESPACES " \n\t\r"
44 "Cannot create the link %s:%d -> %s:%d\n",
70 "Bad (empty?) label found in the following: \"%s\".\n",
start);
74 if (*(*
buf)++ !=
']') {
76 "Mismatched '[' found in the following: \"%s\".\n",
start);
97 const char *
name,
const char *
args,
void *log_ctx)
101 const char *inst_name =
NULL, *filt_name =
NULL;
102 char *tmp_args =
NULL;
107 for (k = 0; name2[k]; k++) {
108 if (name2[k] ==
'@' &&
name[k+1]) {
126 "No such filter: '%s'\n", filt_name);
133 "Error creating filter '%s'\n", filt_name);
137 if (!strcmp(filt_name,
"scale") && (!
args || !strstr(
args,
"flags")) &&
138 ctx->scale_sws_opts) {
152 "Error initializing filter '%s'", filt_name);
181 int index,
void *log_ctx)
217 while (*
links && (!(*links)->name || strcmp((*links)->name, label)))
218 links = &((*links)->next);
232 element->
next = *inouts;
238 while (*inouts && (*inouts)->
next)
239 inouts = &((*inouts)->next);
244 (*inouts)->
next = *element;
254 for (pad = 0; pad < filt_ctx->
nb_inputs; pad++) {
258 *curr_inputs = (*curr_inputs)->
next;
278 "Too many inputs specified for the \"%s\" filter.\n",
302 while (**
buf ==
'[') {
331 *curr_inputs = parsed_inputs;
342 while (**
buf ==
'[') {
353 "No output pad can be associated to link label '%s'.\n",
name);
357 *curr_inputs = (*curr_inputs)->
next;
386 char *p = strchr(*
buf,
';');
388 if (strncmp(*
buf,
"sws_flags=", 10))
441 if (chr ==
';' && curr_inputs)
444 }
while (chr ==
',' || chr ==
';');
448 "Unable to parse graph description substring: \"%s\"\n",
491 "Not enough inputs specified for the \"%s\" filter.\n",
511 "Invalid filterchain containing an unlabelled output pad: \"%s\"\n",
554 const char *filterchain =
filters;
563 if (
filter->nb_inputs == 1 && !curr_inputs && !
index) {
565 const char *
tmp =
"[in]";
580 if (chr ==
';' && curr_inputs) {
582 "Invalid filterchain containing an unlabelled output pad: \"%s\"\n",
588 }
while (chr ==
',' || chr ==
';');
592 "Unable to parse graph description substring: \"%s\"\n",
600 const char *
tmp =
"[out]";
608 if (open_inputs_ptr) *open_inputs_ptr = open_inputs;
610 if (open_outputs_ptr) *open_outputs_ptr = open_outputs;
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
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
static const struct PPFilter filters[]
char * av_asprintf(const char *fmt,...)
static av_cold int end(AVCodecContext *avctx)
struct AVFilterInOut * next
next input/input in the list, NULL if this is the last
unsigned nb_outputs
number of output pads
static int link_filter_inouts(AVFilterContext *filt_ctx, AVFilterInOut **curr_inputs, AVFilterInOut **open_inputs, void *log_ctx)
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
static int link_filter(AVFilterContext *src, int srcpad, AVFilterContext *dst, int dstpad, void *log_ctx)
Link two filters together.
const char * name
Filter name.
static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
AVFilterContext * avfilter_graph_alloc_filter(AVFilterGraph *graph, const AVFilter *filter, const char *name)
Create a new filter instance in a filter graph.
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const AVFilterPad outputs[]
const AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
AVFilterContext ** filters
AVFilterInOut * avfilter_inout_alloc(void)
Allocate a single AVFilterInOut entry.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs)
Add a graph described by a string to a graph.
int pad_idx
index of the filt_ctx pad to use for linking
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
unsigned nb_inputs
number of input pads
AVFilterContext * filter_ctx
filter context associated to this input/output
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
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.
static char * parse_link_name(const char **buf, void *log_ctx)
Parse the name of a link, which has the format "[linkname]".
static void insert_inout(AVFilterInOut **inouts, AVFilterInOut *element)
static const int8_t filt[NUMTAPS]
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 ...
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
int avfilter_init_str(AVFilterContext *filter, const char *args)
Initialize a filter with the supplied parameters.
static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs, AVFilterInOut **open_inputs, AVFilterInOut **open_outputs, void *log_ctx)
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.
static AVFilterInOut * extract_inout(const char *label, AVFilterInOut **links)
const char AVS_Value args
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Pad name.
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 links
static int parse_inputs(const char **buf, AVFilterInOut **curr_inputs, AVFilterInOut **open_outputs, void *log_ctx)
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.
char * av_strdup(const char *s)
Duplicate a string.
void avfilter_free(AVFilterContext *filter)
Free a filter context.
static int parse_sws_flags(const char **buf, AVFilterGraph *graph)
char * name
unique name for this input/output in the list
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
const AVFilter * filter
the AVFilter of which this is an instance
A linked-list of the inputs/outputs of the filter chain.