FFmpeg
avfilter.h
Go to the documentation of this file.
1 /*
2  * filter layer
3  * Copyright (c) 2007 Bobby Bingham
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVFILTER_AVFILTER_H
23 #define AVFILTER_AVFILTER_H
24 
25 /**
26  * @file
27  * @ingroup lavfi
28  * Main libavfilter public API header
29  */
30 
31 /**
32  * @defgroup lavfi libavfilter
33  * Graph-based frame editing library.
34  *
35  * @{
36  */
37 
38 #include <stddef.h>
39 
40 #include "libavutil/attributes.h"
41 #include "libavutil/avutil.h"
42 #include "libavutil/buffer.h"
43 #include "libavutil/dict.h"
44 #include "libavutil/frame.h"
45 #include "libavutil/log.h"
46 #include "libavutil/pixfmt.h"
47 #include "libavutil/rational.h"
48 
50 #ifndef HAVE_AV_CONFIG_H
51 /* When included as part of the ffmpeg build, only include the major version
52  * to avoid unnecessary rebuilds. When included externally, keep including
53  * the full version information. */
54 #include "libavfilter/version.h"
55 #endif
56 
57 /**
58  * Return the LIBAVFILTER_VERSION_INT constant.
59  */
60 unsigned avfilter_version(void);
61 
62 /**
63  * Return the libavfilter build-time configuration.
64  */
65 const char *avfilter_configuration(void);
66 
67 /**
68  * Return the libavfilter license.
69  */
70 const char *avfilter_license(void);
71 
72 typedef struct AVFilterLink AVFilterLink;
73 typedef struct AVFilterPad AVFilterPad;
74 typedef struct AVFilterFormats AVFilterFormats;
76 
77 /**
78  * Get the name of an AVFilterPad.
79  *
80  * @param pads an array of AVFilterPads
81  * @param pad_idx index of the pad in the array; it is the caller's
82  * responsibility to ensure the index is valid
83  *
84  * @return name of the pad_idx'th pad in pads
85  */
86 const char *avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx);
87 
88 /**
89  * Get the type of an AVFilterPad.
90  *
91  * @param pads an array of AVFilterPads
92  * @param pad_idx index of the pad in the array; it is the caller's
93  * responsibility to ensure the index is valid
94  *
95  * @return type of the pad_idx'th pad in pads
96  */
97 enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx);
98 
99 /**
100  * Lists of formats / etc. supported by an end of a link.
101  *
102  * This structure is directly part of AVFilterLink, in two copies:
103  * one for the source filter, one for the destination filter.
104 
105  * These lists are used for negotiating the format to actually be used,
106  * which will be loaded into the format and channel_layout members of
107  * AVFilterLink, when chosen.
108  */
109 typedef struct AVFilterFormatsConfig {
110 
111  /**
112  * List of supported formats (pixel or sample).
113  */
115 
116  /**
117  * Lists of supported sample rates, only for audio.
118  */
120 
121  /**
122  * Lists of supported channel layouts, only for audio.
123  */
125 
126  /**
127  * Lists of supported YUV color metadata, only for YUV video.
128  */
129  AVFilterFormats *color_spaces; ///< AVColorSpace
130  AVFilterFormats *color_ranges; ///< AVColorRange
131 
133 
134 /**
135  * The number of the filter inputs is not determined just by AVFilter.inputs.
136  * The filter might add additional inputs during initialization depending on the
137  * options supplied to it.
138  */
139 #define AVFILTER_FLAG_DYNAMIC_INPUTS (1 << 0)
140 /**
141  * The number of the filter outputs is not determined just by AVFilter.outputs.
142  * The filter might add additional outputs during initialization depending on
143  * the options supplied to it.
144  */
145 #define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1)
146 /**
147  * The filter supports multithreading by splitting frames into multiple parts
148  * and processing them concurrently.
149  */
150 #define AVFILTER_FLAG_SLICE_THREADS (1 << 2)
151 /**
152  * The filter is a "metadata" filter - it does not modify the frame data in any
153  * way. It may only affect the metadata (i.e. those fields copied by
154  * av_frame_copy_props()).
155  *
156  * More precisely, this means:
157  * - video: the data of any frame output by the filter must be exactly equal to
158  * some frame that is received on one of its inputs. Furthermore, all frames
159  * produced on a given output must correspond to frames received on the same
160  * input and their order must be unchanged. Note that the filter may still
161  * drop or duplicate the frames.
162  * - audio: the data produced by the filter on any of its outputs (viewed e.g.
163  * as an array of interleaved samples) must be exactly equal to the data
164  * received by the filter on one of its inputs.
165  */
166 #define AVFILTER_FLAG_METADATA_ONLY (1 << 3)
167 
168 /**
169  * The filter can create hardware frames using AVFilterContext.hw_device_ctx.
170  */
171 #define AVFILTER_FLAG_HWDEVICE (1 << 4)
172 /**
173  * Some filters support a generic "enable" expression option that can be used
174  * to enable or disable a filter in the timeline. Filters supporting this
175  * option have this flag set. When the enable expression is false, the default
176  * no-op filter_frame() function is called in place of the filter_frame()
177  * callback defined on each input pad, thus the frame is passed unchanged to
178  * the next filters.
179  */
180 #define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC (1 << 16)
181 /**
182  * Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will
183  * have its filter_frame() callback(s) called as usual even when the enable
184  * expression is false. The filter will disable filtering within the
185  * filter_frame() callback(s) itself, for example executing code depending on
186  * the AVFilterContext->is_disabled value.
187  */
188 #define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL (1 << 17)
189 /**
190  * Handy mask to test whether the filter supports or no the timeline feature
191  * (internally or generically).
192  */
193 #define AVFILTER_FLAG_SUPPORT_TIMELINE (AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL)
194 
195 /**
196  * Filter definition. This defines the pads a filter contains, and all the
197  * callback functions used to interact with the filter.
198  */
199 typedef struct AVFilter {
200  /**
201  * Filter name. Must be non-NULL and unique among filters.
202  */
203  const char *name;
204 
205  /**
206  * A description of the filter. May be NULL.
207  *
208  * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
209  */
210  const char *description;
211 
212  /**
213  * List of static inputs.
214  *
215  * NULL if there are no (static) inputs. Instances of filters with
216  * AVFILTER_FLAG_DYNAMIC_INPUTS set may have more inputs than present in
217  * this list.
218  */
220 
221  /**
222  * List of static outputs.
223  *
224  * NULL if there are no (static) outputs. Instances of filters with
225  * AVFILTER_FLAG_DYNAMIC_OUTPUTS set may have more outputs than present in
226  * this list.
227  */
229 
230  /**
231  * A class for the private data, used to declare filter private AVOptions.
232  * This field is NULL for filters that do not declare any options.
233  *
234  * If this field is non-NULL, the first member of the filter private data
235  * must be a pointer to AVClass, which will be set by libavfilter generic
236  * code to this class.
237  */
239 
240  /**
241  * A combination of AVFILTER_FLAG_*
242  */
243  int flags;
244 } AVFilter;
245 
246 /**
247  * Get the number of elements in an AVFilter's inputs or outputs array.
248  */
249 unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output);
250 
251 /**
252  * Process multiple parts of the frame concurrently.
253  */
254 #define AVFILTER_THREAD_SLICE (1 << 0)
255 
256 /** An instance of a filter */
257 typedef struct AVFilterContext {
258  const AVClass *av_class; ///< needed for av_log() and filters common options
259 
260  const AVFilter *filter; ///< the AVFilter of which this is an instance
261 
262  char *name; ///< name of this filter instance
263 
264  AVFilterPad *input_pads; ///< array of input pads
265  AVFilterLink **inputs; ///< array of pointers to input links
266  unsigned nb_inputs; ///< number of input pads
267 
268  AVFilterPad *output_pads; ///< array of output pads
269  AVFilterLink **outputs; ///< array of pointers to output links
270  unsigned nb_outputs; ///< number of output pads
271 
272  void *priv; ///< private data for use by the filter
273 
274  struct AVFilterGraph *graph; ///< filtergraph this filter belongs to
275 
276  /**
277  * Type of multithreading being allowed/used. A combination of
278  * AVFILTER_THREAD_* flags.
279  *
280  * May be set by the caller before initializing the filter to forbid some
281  * or all kinds of multithreading for this filter. The default is allowing
282  * everything.
283  *
284  * When the filter is initialized, this field is combined using bit AND with
285  * AVFilterGraph.thread_type to get the final mask used for determining
286  * allowed threading types. I.e. a threading type needs to be set in both
287  * to be allowed.
288  *
289  * After the filter is initialized, libavfilter sets this field to the
290  * threading type that is actually used (0 for no multithreading).
291  */
293 
294  /**
295  * Max number of threads allowed in this filter instance.
296  * If <= 0, its value is ignored.
297  * Overrides global number of threads set per filter graph.
298  */
300 
301 #if FF_API_CONTEXT_PUBLIC
302  /**
303  * @deprecated unused
304  */
306  struct AVFilterCommand *command_queue;
307 #endif
308 
309  char *enable_str; ///< enable expression string
310 #if FF_API_CONTEXT_PUBLIC
311  /**
312  * @deprecated unused
313  */
315  void *enable;
316  /**
317  * @deprecated unused
318  */
319  double *var_values;
320 #endif
321  /**
322  * MUST NOT be accessed from outside avfilter.
323  *
324  * the enabled state from the last expression evaluation
325  */
327 
328  /**
329  * For filters which will create hardware frames, sets the device the
330  * filter should create them in. All other filters will ignore this field:
331  * in particular, a filter which consumes or processes hardware frames will
332  * instead use the hw_frames_ctx field in AVFilterLink to carry the
333  * hardware context information.
334  *
335  * May be set by the caller on filters flagged with AVFILTER_FLAG_HWDEVICE
336  * before initializing the filter with avfilter_init_str() or
337  * avfilter_init_dict().
338  */
340 
341 #if FF_API_CONTEXT_PUBLIC
342  /**
343  * @deprecated this field should never have been accessed by callers
344  */
346  unsigned ready;
347 #endif
348 
349  /**
350  * Sets the number of extra hardware frames which the filter will
351  * allocate on its output links for use in following filters or by
352  * the caller.
353  *
354  * Some hardware filters require all frames that they will use for
355  * output to be defined in advance before filtering starts. For such
356  * filters, any hardware frame pools used for output must therefore be
357  * of fixed size. The extra frames set here are on top of any number
358  * that the filter needs internally in order to operate normally.
359  *
360  * This field must be set before the graph containing this filter is
361  * configured.
362  */
365 
366 /**
367  * A link between two filters. This contains pointers to the source and
368  * destination filters between which this link exists, and the indexes of
369  * the pads involved. In addition, this link also contains the parameters
370  * which have been negotiated and agreed upon between the filter, such as
371  * image dimensions, format, etc.
372  *
373  * Applications must not normally access the link structure directly.
374  * Use the buffersrc and buffersink API instead.
375  * In the future, access to the header may be reserved for filters
376  * implementation.
377  */
378 struct AVFilterLink {
379  AVFilterContext *src; ///< source filter
380  AVFilterPad *srcpad; ///< output pad on the source filter
381 
382  AVFilterContext *dst; ///< dest filter
383  AVFilterPad *dstpad; ///< input pad on the dest filter
384 
385  enum AVMediaType type; ///< filter media type
386 
387  int format; ///< agreed upon media format
388 
389  /* These parameters apply only to video */
390  int w; ///< agreed upon image width
391  int h; ///< agreed upon image height
392  AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
393  /**
394  * For non-YUV links, these are respectively set to fallback values (as
395  * appropriate for that colorspace).
396  *
397  * Note: This includes grayscale formats, as these are currently treated
398  * as forced full range always.
399  */
400  enum AVColorSpace colorspace; ///< agreed upon YUV color space
401  enum AVColorRange color_range; ///< agreed upon YUV color range
402 
403  /* These parameters apply only to audio */
404  int sample_rate; ///< samples per second
405  AVChannelLayout ch_layout; ///< channel layout of current buffer (see libavutil/channel_layout.h)
406 
407  /**
408  * Define the time base used by the PTS of the frames/samples
409  * which will pass through this link.
410  * During the configuration stage, each filter is supposed to
411  * change only the output timebase, while the timebase of the
412  * input link is assumed to be an unchangeable property.
413  */
415 
418 
419  /*****************************************************************
420  * All fields below this line are not part of the public API. They
421  * may not be used outside of libavfilter and can be changed and
422  * removed at will.
423  * New public fields should be added right above.
424  *****************************************************************
425  */
426 
427  /**
428  * Lists of supported formats / etc. supported by the input filter.
429  */
431 
432  /**
433  * Lists of supported formats / etc. supported by the output filter.
434  */
436 };
437 
438 /**
439  * Link two filters together.
440  *
441  * @param src the source filter
442  * @param srcpad index of the output pad on the source filter
443  * @param dst the destination filter
444  * @param dstpad index of the input pad on the destination filter
445  * @return zero on success
446  */
447 int avfilter_link(AVFilterContext *src, unsigned srcpad,
448  AVFilterContext *dst, unsigned dstpad);
449 
450 #if FF_API_LINK_PUBLIC
451 /**
452  * @deprecated this function should never be called by users
453  */
455 void avfilter_link_free(AVFilterLink **link);
456 
457 /**
458  * @deprecated this function should never be called by users
459  */
461 int avfilter_config_links(AVFilterContext *filter);
462 #endif
463 
464 #define AVFILTER_CMD_FLAG_ONE 1 ///< Stop once a filter understood the command (for target=all for example), fast filters are favored automatically
465 #define AVFILTER_CMD_FLAG_FAST 2 ///< Only execute command when its fast (like a video out that supports contrast adjustment in hw)
466 
467 /**
468  * Make the filter instance process a command.
469  * It is recommended to use avfilter_graph_send_command().
470  */
471 int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags);
472 
473 /**
474  * Iterate over all registered filters.
475  *
476  * @param opaque a pointer where libavfilter will store the iteration state. Must
477  * point to NULL to start the iteration.
478  *
479  * @return the next registered filter or NULL when the iteration is
480  * finished
481  */
482 const AVFilter *av_filter_iterate(void **opaque);
483 
484 /**
485  * Get a filter definition matching the given name.
486  *
487  * @param name the filter name to find
488  * @return the filter definition, if any matching one is registered.
489  * NULL if none found.
490  */
491 const AVFilter *avfilter_get_by_name(const char *name);
492 
493 
494 /**
495  * Initialize a filter with the supplied parameters.
496  *
497  * @param ctx uninitialized filter context to initialize
498  * @param args Options to initialize the filter with. This must be a
499  * ':'-separated list of options in the 'key=value' form.
500  * May be NULL if the options have been set directly using the
501  * AVOptions API or there are no options that need to be set.
502  * @return 0 on success, a negative AVERROR on failure
503  */
504 int avfilter_init_str(AVFilterContext *ctx, const char *args);
505 
506 /**
507  * Initialize a filter with the supplied dictionary of options.
508  *
509  * @param ctx uninitialized filter context to initialize
510  * @param options An AVDictionary filled with options for this filter. On
511  * return this parameter will be destroyed and replaced with
512  * a dict containing options that were not found. This dictionary
513  * must be freed by the caller.
514  * May be NULL, then this function is equivalent to
515  * avfilter_init_str() with the second parameter set to NULL.
516  * @return 0 on success, a negative AVERROR on failure
517  *
518  * @note This function and avfilter_init_str() do essentially the same thing,
519  * the difference is in manner in which the options are passed. It is up to the
520  * calling code to choose whichever is more preferable. The two functions also
521  * behave differently when some of the provided options are not declared as
522  * supported by the filter. In such a case, avfilter_init_str() will fail, but
523  * this function will leave those extra options in the options AVDictionary and
524  * continue as usual.
525  */
527 
528 /**
529  * Free a filter context. This will also remove the filter from its
530  * filtergraph's list of filters.
531  *
532  * @param filter the filter to free
533  */
535 
536 /**
537  * Insert a filter in the middle of an existing link.
538  *
539  * @param link the link into which the filter should be inserted
540  * @param filt the filter to be inserted
541  * @param filt_srcpad_idx the input pad on the filter to connect
542  * @param filt_dstpad_idx the output pad on the filter to connect
543  * @return zero on success
544  */
546  unsigned filt_srcpad_idx, unsigned filt_dstpad_idx);
547 
548 /**
549  * @return AVClass for AVFilterContext.
550  *
551  * @see av_opt_find().
552  */
553 const AVClass *avfilter_get_class(void);
554 
555 /**
556  * A function pointer passed to the @ref AVFilterGraph.execute callback to be
557  * executed multiple times, possibly in parallel.
558  *
559  * @param ctx the filter context the job belongs to
560  * @param arg an opaque parameter passed through from @ref
561  * AVFilterGraph.execute
562  * @param jobnr the index of the job being executed
563  * @param nb_jobs the total number of jobs
564  *
565  * @return 0 on success, a negative AVERROR on error
566  */
567 typedef int (avfilter_action_func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
568 
569 /**
570  * A function executing multiple jobs, possibly in parallel.
571  *
572  * @param ctx the filter context to which the jobs belong
573  * @param func the function to be called multiple times
574  * @param arg the argument to be passed to func
575  * @param ret a nb_jobs-sized array to be filled with return values from each
576  * invocation of func
577  * @param nb_jobs the number of jobs to execute
578  *
579  * @return 0 on success, a negative AVERROR on error
580  */
582  void *arg, int *ret, int nb_jobs);
583 
584 typedef struct AVFilterGraph {
587  unsigned nb_filters;
588 
589  char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters
590 
591  /**
592  * Type of multithreading allowed for filters in this graph. A combination
593  * of AVFILTER_THREAD_* flags.
594  *
595  * May be set by the caller at any point, the setting will apply to all
596  * filters initialized after that. The default is allowing everything.
597  *
598  * When a filter in this graph is initialized, this field is combined using
599  * bit AND with AVFilterContext.thread_type to get the final mask used for
600  * determining allowed threading types. I.e. a threading type needs to be
601  * set in both to be allowed.
602  */
604 
605  /**
606  * Maximum number of threads used by filters in this graph. May be set by
607  * the caller before adding any filters to the filtergraph. Zero (the
608  * default) means that the number of threads is determined automatically.
609  */
611 
612  /**
613  * Opaque user data. May be set by the caller to an arbitrary value, e.g. to
614  * be used from callbacks like @ref AVFilterGraph.execute.
615  * Libavfilter will not touch this field in any way.
616  */
617  void *opaque;
618 
619  /**
620  * This callback may be set by the caller immediately after allocating the
621  * graph and before adding any filters to it, to provide a custom
622  * multithreading implementation.
623  *
624  * If set, filters with slice threading capability will call this callback
625  * to execute multiple jobs in parallel.
626  *
627  * If this field is left unset, libavfilter will use its internal
628  * implementation, which may or may not be multithreaded depending on the
629  * platform and build options.
630  */
632 
633  char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions
634 } AVFilterGraph;
635 
636 /**
637  * Allocate a filter graph.
638  *
639  * @return the allocated filter graph on success or NULL.
640  */
642 
643 /**
644  * Create a new filter instance in a filter graph.
645  *
646  * @param graph graph in which the new filter will be used
647  * @param filter the filter to create an instance of
648  * @param name Name to give to the new instance (will be copied to
649  * AVFilterContext.name). This may be used by the caller to identify
650  * different filters, libavfilter itself assigns no semantics to
651  * this parameter. May be NULL.
652  *
653  * @return the context of the newly created filter instance (note that it is
654  * also retrievable directly through AVFilterGraph.filters or with
655  * avfilter_graph_get_filter()) on success or NULL on failure.
656  */
658  const AVFilter *filter,
659  const char *name);
660 
661 /**
662  * Get a filter instance identified by instance name from graph.
663  *
664  * @param graph filter graph to search through.
665  * @param name filter instance name (should be unique in the graph).
666  * @return the pointer to the found filter instance or NULL if it
667  * cannot be found.
668  */
670 
671 /**
672  * A convenience wrapper that allocates and initializes a filter in a single
673  * step. The filter instance is created from the filter filt and inited with the
674  * parameter args. opaque is currently ignored.
675  *
676  * In case of success put in *filt_ctx the pointer to the created
677  * filter instance, otherwise set *filt_ctx to NULL.
678  *
679  * @param name the instance name to give to the created filter instance
680  * @param graph_ctx the filter graph
681  * @return a negative AVERROR error code in case of failure, a non
682  * negative value otherwise
683  *
684  * @warning Since the filter is initialized after this function successfully
685  * returns, you MUST NOT set any further options on it. If you need to
686  * do that, call ::avfilter_graph_alloc_filter(), followed by setting
687  * the options, followed by ::avfilter_init_dict() instead of this
688  * function.
689  */
691  const char *name, const char *args, void *opaque,
692  AVFilterGraph *graph_ctx);
693 
694 /**
695  * Enable or disable automatic format conversion inside the graph.
696  *
697  * Note that format conversion can still happen inside explicitly inserted
698  * scale and aresample filters.
699  *
700  * @param flags any of the AVFILTER_AUTO_CONVERT_* constants
701  */
703 
704 enum {
705  AVFILTER_AUTO_CONVERT_ALL = 0, /**< all automatic conversions enabled */
706  AVFILTER_AUTO_CONVERT_NONE = -1, /**< all automatic conversions disabled */
707 };
708 
709 /**
710  * Check validity and configure all the links and formats in the graph.
711  *
712  * @param graphctx the filter graph
713  * @param log_ctx context used for logging
714  * @return >= 0 in case of success, a negative AVERROR code otherwise
715  */
716 int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx);
717 
718 /**
719  * Free a graph, destroy its links, and set *graph to NULL.
720  * If *graph is NULL, do nothing.
721  */
722 void avfilter_graph_free(AVFilterGraph **graph);
723 
724 /**
725  * A linked-list of the inputs/outputs of the filter chain.
726  *
727  * This is mainly useful for avfilter_graph_parse() / avfilter_graph_parse2(),
728  * where it is used to communicate open (unlinked) inputs and outputs from and
729  * to the caller.
730  * This struct specifies, per each not connected pad contained in the graph, the
731  * filter context and the pad index required for establishing a link.
732  */
733 typedef struct AVFilterInOut {
734  /** unique name for this input/output in the list */
735  char *name;
736 
737  /** filter context associated to this input/output */
739 
740  /** index of the filt_ctx pad to use for linking */
741  int pad_idx;
742 
743  /** next input/input in the list, NULL if this is the last */
745 } AVFilterInOut;
746 
747 /**
748  * Allocate a single AVFilterInOut entry.
749  * Must be freed with avfilter_inout_free().
750  * @return allocated AVFilterInOut on success, NULL on failure.
751  */
753 
754 /**
755  * Free the supplied list of AVFilterInOut and set *inout to NULL.
756  * If *inout is NULL, do nothing.
757  */
758 void avfilter_inout_free(AVFilterInOut **inout);
759 
760 /**
761  * Add a graph described by a string to a graph.
762  *
763  * @note The caller must provide the lists of inputs and outputs,
764  * which therefore must be known before calling the function.
765  *
766  * @note The inputs parameter describes inputs of the already existing
767  * part of the graph; i.e. from the point of view of the newly created
768  * part, they are outputs. Similarly the outputs parameter describes
769  * outputs of the already existing filters, which are provided as
770  * inputs to the parsed filters.
771  *
772  * @param graph the filter graph where to link the parsed graph context
773  * @param filters string to be parsed
774  * @param inputs linked list to the inputs of the graph
775  * @param outputs linked list to the outputs of the graph
776  * @return zero on success, a negative AVERROR code on error
777  */
778 int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
780  void *log_ctx);
781 
782 /**
783  * Add a graph described by a string to a graph.
784  *
785  * In the graph filters description, if the input label of the first
786  * filter is not specified, "in" is assumed; if the output label of
787  * the last filter is not specified, "out" is assumed.
788  *
789  * @param graph the filter graph where to link the parsed graph context
790  * @param filters string to be parsed
791  * @param inputs pointer to a linked list to the inputs of the graph, may be NULL.
792  * If non-NULL, *inputs is updated to contain the list of open inputs
793  * after the parsing, should be freed with avfilter_inout_free().
794  * @param outputs pointer to a linked list to the outputs of the graph, may be NULL.
795  * If non-NULL, *outputs is updated to contain the list of open outputs
796  * after the parsing, should be freed with avfilter_inout_free().
797  * @return non negative on success, a negative AVERROR code on error
798  */
799 int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters,
801  void *log_ctx);
802 
803 /**
804  * Add a graph described by a string to a graph.
805  *
806  * @param[in] graph the filter graph where to link the parsed graph context
807  * @param[in] filters string to be parsed
808  * @param[out] inputs a linked list of all free (unlinked) inputs of the
809  * parsed graph will be returned here. It is to be freed
810  * by the caller using avfilter_inout_free().
811  * @param[out] outputs a linked list of all free (unlinked) outputs of the
812  * parsed graph will be returned here. It is to be freed by the
813  * caller using avfilter_inout_free().
814  * @return zero on success, a negative AVERROR code on error
815  *
816  * @note This function returns the inputs and outputs that are left
817  * unlinked after parsing the graph and the caller then deals with
818  * them.
819  * @note This function makes no reference whatsoever to already
820  * existing parts of the graph and the inputs parameter will on return
821  * contain inputs of the newly parsed part of the graph. Analogously
822  * the outputs parameter will contain outputs of the newly created
823  * filters.
824  */
825 int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
828 
829 /**
830  * Parameters of a filter's input or output pad.
831  *
832  * Created as a child of AVFilterParams by avfilter_graph_segment_parse().
833  * Freed in avfilter_graph_segment_free().
834  */
835 typedef struct AVFilterPadParams {
836  /**
837  * An av_malloc()'ed string containing the pad label.
838  *
839  * May be av_free()'d and set to NULL by the caller, in which case this pad
840  * will be treated as unlabeled for linking.
841  * May also be replaced by another av_malloc()'ed string.
842  */
843  char *label;
845 
846 /**
847  * Parameters describing a filter to be created in a filtergraph.
848  *
849  * Created as a child of AVFilterGraphSegment by avfilter_graph_segment_parse().
850  * Freed in avfilter_graph_segment_free().
851  */
852 typedef struct AVFilterParams {
853  /**
854  * The filter context.
855  *
856  * Created by avfilter_graph_segment_create_filters() based on
857  * AVFilterParams.filter_name and instance_name.
858  *
859  * Callers may also create the filter context manually, then they should
860  * av_free() filter_name and set it to NULL. Such AVFilterParams instances
861  * are then skipped by avfilter_graph_segment_create_filters().
862  */
864 
865  /**
866  * Name of the AVFilter to be used.
867  *
868  * An av_malloc()'ed string, set by avfilter_graph_segment_parse(). Will be
869  * passed to avfilter_get_by_name() by
870  * avfilter_graph_segment_create_filters().
871  *
872  * Callers may av_free() this string and replace it with another one or
873  * NULL. If the caller creates the filter instance manually, this string
874  * MUST be set to NULL.
875  *
876  * When both AVFilterParams.filter an AVFilterParams.filter_name are NULL,
877  * this AVFilterParams instance is skipped by avfilter_graph_segment_*()
878  * functions.
879  */
880  char *filter_name;
881  /**
882  * Name to be used for this filter instance.
883  *
884  * An av_malloc()'ed string, may be set by avfilter_graph_segment_parse() or
885  * left NULL. The caller may av_free() this string and replace with another
886  * one or NULL.
887  *
888  * Will be used by avfilter_graph_segment_create_filters() - passed as the
889  * third argument to avfilter_graph_alloc_filter(), then freed and set to
890  * NULL.
891  */
893 
894  /**
895  * Options to be apllied to the filter.
896  *
897  * Filled by avfilter_graph_segment_parse(). Afterwards may be freely
898  * modified by the caller.
899  *
900  * Will be applied to the filter by avfilter_graph_segment_apply_opts()
901  * with an equivalent of av_opt_set_dict2(filter, &opts, AV_OPT_SEARCH_CHILDREN),
902  * i.e. any unapplied options will be left in this dictionary.
903  */
905 
907  unsigned nb_inputs;
908 
910  unsigned nb_outputs;
912 
913 /**
914  * A filterchain is a list of filter specifications.
915  *
916  * Created as a child of AVFilterGraphSegment by avfilter_graph_segment_parse().
917  * Freed in avfilter_graph_segment_free().
918  */
919 typedef struct AVFilterChain {
921  size_t nb_filters;
922 } AVFilterChain;
923 
924 /**
925  * A parsed representation of a filtergraph segment.
926  *
927  * A filtergraph segment is conceptually a list of filterchains, with some
928  * supplementary information (e.g. format conversion flags).
929  *
930  * Created by avfilter_graph_segment_parse(). Must be freed with
931  * avfilter_graph_segment_free().
932  */
933 typedef struct AVFilterGraphSegment {
934  /**
935  * The filtergraph this segment is associated with.
936  * Set by avfilter_graph_segment_parse().
937  */
939 
940  /**
941  * A list of filter chain contained in this segment.
942  * Set in avfilter_graph_segment_parse().
943  */
945  size_t nb_chains;
946 
947  /**
948  * A string containing a colon-separated list of key=value options applied
949  * to all scale filters in this segment.
950  *
951  * May be set by avfilter_graph_segment_parse().
952  * The caller may free this string with av_free() and replace it with a
953  * different av_malloc()'ed string.
954  */
957 
958 /**
959  * Parse a textual filtergraph description into an intermediate form.
960  *
961  * This intermediate representation is intended to be modified by the caller as
962  * described in the documentation of AVFilterGraphSegment and its children, and
963  * then applied to the graph either manually or with other
964  * avfilter_graph_segment_*() functions. See the documentation for
965  * avfilter_graph_segment_apply() for the canonical way to apply
966  * AVFilterGraphSegment.
967  *
968  * @param graph Filter graph the parsed segment is associated with. Will only be
969  * used for logging and similar auxiliary purposes. The graph will
970  * not be actually modified by this function - the parsing results
971  * are instead stored in seg for further processing.
972  * @param graph_str a string describing the filtergraph segment
973  * @param flags reserved for future use, caller must set to 0 for now
974  * @param seg A pointer to the newly-created AVFilterGraphSegment is written
975  * here on success. The graph segment is owned by the caller and must
976  * be freed with avfilter_graph_segment_free() before graph itself is
977  * freed.
978  *
979  * @retval "non-negative number" success
980  * @retval "negative error code" failure
981  */
982 int avfilter_graph_segment_parse(AVFilterGraph *graph, const char *graph_str,
983  int flags, AVFilterGraphSegment **seg);
984 
985 /**
986  * Create filters specified in a graph segment.
987  *
988  * Walk through the creation-pending AVFilterParams in the segment and create
989  * new filter instances for them.
990  * Creation-pending params are those where AVFilterParams.filter_name is
991  * non-NULL (and hence AVFilterParams.filter is NULL). All other AVFilterParams
992  * instances are ignored.
993  *
994  * For any filter created by this function, the corresponding
995  * AVFilterParams.filter is set to the newly-created filter context,
996  * AVFilterParams.filter_name and AVFilterParams.instance_name are freed and set
997  * to NULL.
998  *
999  * @param seg the filtergraph segment to process
1000  * @param flags reserved for future use, caller must set to 0 for now
1001  *
1002  * @retval "non-negative number" Success, all creation-pending filters were
1003  * successfully created
1004  * @retval AVERROR_FILTER_NOT_FOUND some filter's name did not correspond to a
1005  * known filter
1006  * @retval "another negative error code" other failures
1007  *
1008  * @note Calling this function multiple times is safe, as it is idempotent.
1009  */
1011 
1012 /**
1013  * Apply parsed options to filter instances in a graph segment.
1014  *
1015  * Walk through all filter instances in the graph segment that have option
1016  * dictionaries associated with them and apply those options with
1017  * av_opt_set_dict2(..., AV_OPT_SEARCH_CHILDREN). AVFilterParams.opts is
1018  * replaced by the dictionary output by av_opt_set_dict2(), which should be
1019  * empty (NULL) if all options were successfully applied.
1020  *
1021  * If any options could not be found, this function will continue processing all
1022  * other filters and finally return AVERROR_OPTION_NOT_FOUND (unless another
1023  * error happens). The calling program may then deal with unapplied options as
1024  * it wishes.
1025  *
1026  * Any creation-pending filters (see avfilter_graph_segment_create_filters())
1027  * present in the segment will cause this function to fail. AVFilterParams with
1028  * no associated filter context are simply skipped.
1029  *
1030  * @param seg the filtergraph segment to process
1031  * @param flags reserved for future use, caller must set to 0 for now
1032  *
1033  * @retval "non-negative number" Success, all options were successfully applied.
1034  * @retval AVERROR_OPTION_NOT_FOUND some options were not found in a filter
1035  * @retval "another negative error code" other failures
1036  *
1037  * @note Calling this function multiple times is safe, as it is idempotent.
1038  */
1040 
1041 /**
1042  * Initialize all filter instances in a graph segment.
1043  *
1044  * Walk through all filter instances in the graph segment and call
1045  * avfilter_init_dict(..., NULL) on those that have not been initialized yet.
1046  *
1047  * Any creation-pending filters (see avfilter_graph_segment_create_filters())
1048  * present in the segment will cause this function to fail. AVFilterParams with
1049  * no associated filter context or whose filter context is already initialized,
1050  * are simply skipped.
1051  *
1052  * @param seg the filtergraph segment to process
1053  * @param flags reserved for future use, caller must set to 0 for now
1054  *
1055  * @retval "non-negative number" Success, all filter instances were successfully
1056  * initialized
1057  * @retval "negative error code" failure
1058  *
1059  * @note Calling this function multiple times is safe, as it is idempotent.
1060  */
1062 
1063 /**
1064  * Link filters in a graph segment.
1065  *
1066  * Walk through all filter instances in the graph segment and try to link all
1067  * unlinked input and output pads. Any creation-pending filters (see
1068  * avfilter_graph_segment_create_filters()) present in the segment will cause
1069  * this function to fail. Disabled filters and already linked pads are skipped.
1070  *
1071  * Every filter output pad that has a corresponding AVFilterPadParams with a
1072  * non-NULL label is
1073  * - linked to the input with the matching label, if one exists;
1074  * - exported in the outputs linked list otherwise, with the label preserved.
1075  * Unlabeled outputs are
1076  * - linked to the first unlinked unlabeled input in the next non-disabled
1077  * filter in the chain, if one exists
1078  * - exported in the ouputs linked list otherwise, with NULL label
1079  *
1080  * Similarly, unlinked input pads are exported in the inputs linked list.
1081  *
1082  * @param seg the filtergraph segment to process
1083  * @param flags reserved for future use, caller must set to 0 for now
1084  * @param[out] inputs a linked list of all free (unlinked) inputs of the
1085  * filters in this graph segment will be returned here. It
1086  * is to be freed by the caller using avfilter_inout_free().
1087  * @param[out] outputs a linked list of all free (unlinked) outputs of the
1088  * filters in this graph segment will be returned here. It
1089  * is to be freed by the caller using avfilter_inout_free().
1090  *
1091  * @retval "non-negative number" success
1092  * @retval "negative error code" failure
1093  *
1094  * @note Calling this function multiple times is safe, as it is idempotent.
1095  */
1099 
1100 /**
1101  * Apply all filter/link descriptions from a graph segment to the associated filtergraph.
1102  *
1103  * This functions is currently equivalent to calling the following in sequence:
1104  * - avfilter_graph_segment_create_filters();
1105  * - avfilter_graph_segment_apply_opts();
1106  * - avfilter_graph_segment_init();
1107  * - avfilter_graph_segment_link();
1108  * failing if any of them fails. This list may be extended in the future.
1109  *
1110  * Since the above functions are idempotent, the caller may call some of them
1111  * manually, then do some custom processing on the filtergraph, then call this
1112  * function to do the rest.
1113  *
1114  * @param seg the filtergraph segment to process
1115  * @param flags reserved for future use, caller must set to 0 for now
1116  * @param[out] inputs passed to avfilter_graph_segment_link()
1117  * @param[out] outputs passed to avfilter_graph_segment_link()
1118  *
1119  * @retval "non-negative number" success
1120  * @retval "negative error code" failure
1121  *
1122  * @note Calling this function multiple times is safe, as it is idempotent.
1123  */
1127 
1128 /**
1129  * Free the provided AVFilterGraphSegment and everything associated with it.
1130  *
1131  * @param seg double pointer to the AVFilterGraphSegment to be freed. NULL will
1132  * be written to this pointer on exit from this function.
1133  *
1134  * @note
1135  * The filter contexts (AVFilterParams.filter) are owned by AVFilterGraph rather
1136  * than AVFilterGraphSegment, so they are not freed.
1137  */
1139 
1140 /**
1141  * Send a command to one or more filter instances.
1142  *
1143  * @param graph the filter graph
1144  * @param target the filter(s) to which the command should be sent
1145  * "all" sends to all filters
1146  * otherwise it can be a filter or filter instance name
1147  * which will send the command to all matching filters.
1148  * @param cmd the command to send, for handling simplicity all commands must be alphanumeric only
1149  * @param arg the argument for the command
1150  * @param res a buffer with size res_size where the filter(s) can return a response.
1151  *
1152  * @returns >=0 on success otherwise an error code.
1153  * AVERROR(ENOSYS) on unsupported commands
1154  */
1155 int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags);
1156 
1157 /**
1158  * Queue a command for one or more filter instances.
1159  *
1160  * @param graph the filter graph
1161  * @param target the filter(s) to which the command should be sent
1162  * "all" sends to all filters
1163  * otherwise it can be a filter or filter instance name
1164  * which will send the command to all matching filters.
1165  * @param cmd the command to sent, for handling simplicity all commands must be alphanumeric only
1166  * @param arg the argument for the command
1167  * @param ts time at which the command should be sent to the filter
1168  *
1169  * @note As this executes commands after this function returns, no return code
1170  * from the filter is provided, also AVFILTER_CMD_FLAG_ONE is not supported.
1171  */
1172 int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts);
1173 
1174 
1175 /**
1176  * Dump a graph into a human-readable string representation.
1177  *
1178  * @param graph the graph to dump
1179  * @param options formatting options; currently ignored
1180  * @return a string, or NULL in case of memory allocation failure;
1181  * the string must be freed using av_free
1182  */
1183 char *avfilter_graph_dump(AVFilterGraph *graph, const char *options);
1184 
1185 /**
1186  * Request a frame on the oldest sink link.
1187  *
1188  * If the request returns AVERROR_EOF, try the next.
1189  *
1190  * Note that this function is not meant to be the sole scheduling mechanism
1191  * of a filtergraph, only a convenience function to help drain a filtergraph
1192  * in a balanced way under normal circumstances.
1193  *
1194  * Also note that AVERROR_EOF does not mean that frames did not arrive on
1195  * some of the sinks during the process.
1196  * When there are multiple sink links, in case the requested link
1197  * returns an EOF, this may cause a filter to flush pending frames
1198  * which are sent to another sink link, although unrequested.
1199  *
1200  * @return the return value of ff_request_frame(),
1201  * or AVERROR_EOF if all links returned AVERROR_EOF
1202  */
1204 
1205 /**
1206  * @}
1207  */
1208 
1209 #endif /* AVFILTER_AVFILTER_H */
func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:68
AVFilterGraph::execute
avfilter_execute_func * execute
This callback may be set by the caller immediately after allocating the graph and before adding any f...
Definition: avfilter.h:631
AVFilterChannelLayouts
A list of supported channel layouts.
Definition: formats.h:85
AVFilterContext::nb_threads
int nb_threads
Max number of threads allowed in this filter instance.
Definition: avfilter.h:299
AVFilterFormatsConfig::samplerates
AVFilterFormats * samplerates
Lists of supported sample rates, only for audio.
Definition: avfilter.h:119
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
avfilter_filter_pad_count
unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output)
Get the number of elements in an AVFilter's inputs or outputs array.
Definition: avfilter.c:645
AVFilterGraph::nb_threads
int nb_threads
Maximum number of threads used by filters in this graph.
Definition: avfilter.h:610
avfilter_pad_get_name
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Get the name of an AVFilterPad.
Definition: avfilter.c:999
AVFilterFormatsConfig::channel_layouts
AVFilterChannelLayouts * channel_layouts
Lists of supported channel layouts, only for audio.
Definition: avfilter.h:124
AVFilterParams::instance_name
char * instance_name
Name to be used for this filter instance.
Definition: avfilter.h:892
avfilter_graph_segment_create_filters
int avfilter_graph_segment_create_filters(AVFilterGraphSegment *seg, int flags)
Create filters specified in a graph segment.
Definition: graphparser.c:516
AVFilter::priv_class
const AVClass * priv_class
A class for the private data, used to declare filter private AVOptions.
Definition: avfilter.h:238
avfilter_action_func
int() avfilter_action_func(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
A function pointer passed to the AVFilterGraph::execute callback to be executed multiple times,...
Definition: avfilter.h:567
rational.h
AVFilterContext::is_disabled
int is_disabled
MUST NOT be accessed from outside avfilter.
Definition: avfilter.h:326
AVFilterInOut::next
struct AVFilterInOut * next
next input/input in the list, NULL if this is the last
Definition: avfilter.h:744
AVFilterContext::nb_outputs
unsigned nb_outputs
number of output pads
Definition: avfilter.h:270
AVFilterContext::av_class
const AVClass * av_class
needed for av_log() and filters common options
Definition: avfilter.h:258
filter
void(* filter)(uint8_t *src, int stride, int qscale)
Definition: h263dsp.c:29
AVFilterContext::hw_device_ctx
AVBufferRef * hw_device_ctx
For filters which will create hardware frames, sets the device the filter should create them in.
Definition: avfilter.h:339
AVDictionary
Definition: dict.c:34
AVFilterContext::output_pads
AVFilterPad * output_pads
array of output pads
Definition: avfilter.h:268
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:203
AVFilterParams::inputs
AVFilterPadParams ** inputs
Definition: avfilter.h:906
avfilter_graph_free
void avfilter_graph_free(AVFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
Definition: avfiltergraph.c:117
AVFilterFormats
A list of supported formats for one end of a filter link.
Definition: formats.h:64
AVFilterParams::outputs
AVFilterPadParams ** outputs
Definition: avfilter.h:909
avfilter_graph_create_filter
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
A convenience wrapper that allocates and initializes a filter in a single step.
Definition: avfiltergraph.c:138
avfilter_graph_alloc_filter
AVFilterContext * avfilter_graph_alloc_filter(AVFilterGraph *graph, const AVFilter *filter, const char *name)
Create a new filter instance in a filter graph.
Definition: avfiltergraph.c:165
avfilter_graph_segment_link
int avfilter_graph_segment_link(AVFilterGraphSegment *seg, int flags, AVFilterInOut **inputs, AVFilterInOut **outputs)
Link filters in a graph segment.
Definition: graphparser.c:814
AVFilterContext::priv
void * priv
private data for use by the filter
Definition: avfilter.h:272
AVFilterContext::graph
struct AVFilterGraph * graph
filtergraph this filter belongs to
Definition: avfilter.h:274
AVFilterContext::enable_str
char * enable_str
enable expression string
Definition: avfilter.h:309
avfilter_graph_alloc
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
Definition: avfiltergraph.c:83
avfilter_insert_filter
int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, unsigned filt_srcpad_idx, unsigned filt_dstpad_idx)
Insert a filter in the middle of an existing link.
Definition: avfilter.c:293
av_filter_iterate
const AVFilter * av_filter_iterate(void **opaque)
Iterate over all registered filters.
Definition: allfilters.c:624
AVFilterContext::extra_hw_frames
int extra_hw_frames
Sets the number of extra hardware frames which the filter will allocate on its output links for use i...
Definition: avfilter.h:363
avfilter_graph_segment_free
void avfilter_graph_segment_free(AVFilterGraphSegment **seg)
Free the provided AVFilterGraphSegment and everything associated with it.
Definition: graphparser.c:276
AVFilterGraph::opaque
void * opaque
Opaque user data.
Definition: avfilter.h:617
avfilter_graph_segment_parse
int avfilter_graph_segment_parse(AVFilterGraph *graph, const char *graph_str, int flags, AVFilterGraphSegment **seg)
Parse a textual filtergraph description into an intermediate form.
Definition: graphparser.c:460
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:38
avfilter_license
const char * avfilter_license(void)
Return the libavfilter license.
Definition: version.c:41
AVFilterContext::input_pads
AVFilterPad * input_pads
array of input pads
Definition: avfilter.h:264
avfilter_inout_free
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
Definition: graphparser.c:76
AVFilterChain::filters
AVFilterParams ** filters
Definition: avfilter.h:920
avfilter_process_command
int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
Make the filter instance process a command.
Definition: avfilter.c:624
filters
#define filters(fmt, type, inverse, clp, inverset, clip, one, clip_fn, packed)
Definition: af_crystalizer.c:55
avfilter_graph_segment_init
int avfilter_graph_segment_init(AVFilterGraphSegment *seg, int flags)
Initialize all filter instances in a graph segment.
Definition: graphparser.c:616
AVFilter::flags
int flags
A combination of AVFILTER_FLAG_*.
Definition: avfilter.h:243
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AVFilterGraph::aresample_swr_opts
char * aresample_swr_opts
swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions
Definition: avfilter.h:633
AVFilterFormatsConfig::color_spaces
AVFilterFormats * color_spaces
Lists of supported YUV color metadata, only for YUV video.
Definition: avfilter.h:129
AVFilterPadParams::label
char * label
An av_malloc()'ed string containing the pad label.
Definition: avfilter.h:843
link
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
Definition: filter_design.txt:23
arg
const char * arg
Definition: jacosubdec.c:67
avfilter_get_by_name
const AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
Definition: allfilters.c:637
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
AVFilterContext::thread_type
int thread_type
Type of multithreading being allowed/used.
Definition: avfilter.h:292
avfilter_graph_config
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
Definition: avfiltergraph.c:1295
avfilter_graph_segment_apply
int avfilter_graph_segment_apply(AVFilterGraphSegment *seg, int flags, AVFilterInOut **inputs, AVFilterInOut **outputs)
Apply all filter/link descriptions from a graph segment to the associated filtergraph.
Definition: graphparser.c:882
AVFilterParams
Parameters describing a filter to be created in a filtergraph.
Definition: avfilter.h:852
AVFilter::outputs
const AVFilterPad * outputs
List of static outputs.
Definition: avfilter.h:228
avfilter_graph_set_auto_convert
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags)
Enable or disable automatic format conversion inside the graph.
Definition: avfiltergraph.c:160
AVFilterParams::filter
AVFilterContext * filter
The filter context.
Definition: avfilter.h:863
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVFilterChain::nb_filters
size_t nb_filters
Definition: avfilter.h:921
AVFilterParams::filter_name
char * filter_name
Name of the AVFilter to be used.
Definition: avfilter.h:880
AVFilterGraph::filters
AVFilterContext ** filters
Definition: avfilter.h:586
AVFilterContext::inputs
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:265
AVFilterContext::name
char * name
name of this filter instance
Definition: avfilter.h:262
options
Definition: swscale.c:42
avfilter_inout_alloc
AVFilterInOut * avfilter_inout_alloc(void)
Allocate a single AVFilterInOut entry.
Definition: graphparser.c:71
avfilter_graph_get_filter
AVFilterContext * avfilter_graph_get_filter(AVFilterGraph *graph, const char *name)
Get a filter instance identified by instance name from graph.
Definition: avfiltergraph.c:284
avfilter_graph_request_oldest
int avfilter_graph_request_oldest(AVFilterGraph *graph)
Request a frame on the oldest sink link.
Definition: avfiltergraph.c:1426
AVFilterGraphSegment::chains
AVFilterChain ** chains
A list of filter chain contained in this segment.
Definition: avfilter.h:944
AVFilterGraph
Definition: avfilter.h:584
inputs
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
Definition: filter_design.txt:243
avfilter_graph_parse2
int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs)
Add a graph described by a string to a graph.
Definition: graphparser.c:138
AVFilterParams::nb_outputs
unsigned nb_outputs
Definition: avfilter.h:910
AVFilterFormatsConfig
Lists of formats / etc.
Definition: avfilter.h:109
AVFilterGraphSegment
A parsed representation of a filtergraph segment.
Definition: avfilter.h:933
AVFilterInOut::pad_idx
int pad_idx
index of the filt_ctx pad to use for linking
Definition: avfilter.h:741
AVFilterGraph::scale_sws_opts
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
Definition: avfilter.h:589
AVFilterContext::nb_inputs
unsigned nb_inputs
number of input pads
Definition: avfilter.h:266
AVFilterGraph::av_class
const AVClass * av_class
Definition: avfilter.h:585
AVMediaType
AVMediaType
Definition: avutil.h:199
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:319
AVFilterInOut::filter_ctx
AVFilterContext * filter_ctx
filter context associated to this input/output
Definition: avfilter.h:738
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
avfilter_execute_func
int() avfilter_execute_func(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
A function executing multiple jobs, possibly in parallel.
Definition: avfilter.h:581
avfilter_link
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
Definition: avfilter.c:149
avfilter_graph_queue_command
int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts)
Queue a command for one or more filter instances.
Definition: avfiltergraph.c:1343
AVFilterGraphSegment::scale_sws_opts
char * scale_sws_opts
A string containing a colon-separated list of key=value options applied to all scale filters in this ...
Definition: avfilter.h:955
frame.h
AVFilter::description
const char * description
A description of the filter.
Definition: avfilter.h:210
buffer.h
attribute_deprecated
#define attribute_deprecated
Definition: attributes.h:104
attributes.h
AVFilterFormatsConfig::color_ranges
AVFilterFormats * color_ranges
AVColorRange.
Definition: avfilter.h:130
avfilter_init_str
int avfilter_init_str(AVFilterContext *ctx, const char *args)
Initialize a filter with the supplied parameters.
Definition: avfilter.c:971
AVFilterParams::nb_inputs
unsigned nb_inputs
Definition: avfilter.h:907
AVFILTER_AUTO_CONVERT_NONE
@ AVFILTER_AUTO_CONVERT_NONE
all automatic conversions disabled
Definition: avfilter.h:706
log.h
AVFilterGraphSegment::graph
AVFilterGraph * graph
The filtergraph this segment is associated with.
Definition: avfilter.h:938
avfilter_graph_parse_ptr
int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx)
Add a graph described by a string to a graph.
Definition: graphparser.c:920
AVFilterCommand
Definition: avfilter_internal.h:126
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:651
version_major.h
AVFilterGraph::thread_type
int thread_type
Type of multithreading allowed for filters in this graph.
Definition: avfilter.h:603
filt
static const int8_t filt[NUMTAPS *2]
Definition: af_earwax.c:40
outputs
static const AVFilterPad outputs[]
Definition: af_aap.c:310
AVFilter
Filter definition.
Definition: avfilter.h:199
ret
ret
Definition: filter_design.txt:187
pixfmt.h
avfilter_configuration
const char * avfilter_configuration(void)
Return the libavfilter build-time configuration.
Definition: version.c:36
AVFilterParams::opts
AVDictionary * opts
Options to be apllied to the filter.
Definition: avfilter.h:904
avfilter_graph_dump
char * avfilter_graph_dump(AVFilterGraph *graph, const char *options)
Dump a graph into a human-readable string representation.
Definition: graphdump.c:156
dict.h
avfilter_pad_get_type
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
Definition: avfilter.c:1004
AVFILTER_AUTO_CONVERT_ALL
@ AVFILTER_AUTO_CONVERT_ALL
all automatic conversions enabled
Definition: avfilter.h:705
avfilter_init_dict
int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
Definition: avfilter.c:930
AVFilterChain
A filterchain is a list of filter specifications.
Definition: avfilter.h:919
version.h
AVFilterGraphSegment::nb_chains
size_t nb_chains
Definition: avfilter.h:945
AVFilterContext
An instance of a filter.
Definition: avfilter.h:257
avfilter_graph_parse
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut *inputs, AVFilterInOut *outputs, void *log_ctx)
Add a graph described by a string to a graph.
Definition: graphparser.c:164
avutil.h
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
AVFilterFormatsConfig::formats
AVFilterFormats * formats
List of supported formats (pixel or sample).
Definition: avfilter.h:114
AVFilter::inputs
const AVFilterPad * inputs
List of static inputs.
Definition: avfilter.h:219
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:265
avfilter_free
void avfilter_free(AVFilterContext *filter)
Free a filter context.
Definition: avfilter.c:811
ready
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 the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already ready
Definition: filter_design.txt:258
AVFilterInOut::name
char * name
unique name for this input/output in the list
Definition: avfilter.h:735
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
avfilter_graph_send_command
int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags)
Send a command to one or more filter instances.
Definition: avfiltergraph.c:1313
avfilter_graph_segment_apply_opts
int avfilter_graph_segment_apply_opts(AVFilterGraphSegment *seg, int flags)
Apply parsed options to filter instances in a graph segment.
Definition: graphparser.c:586
AVFilterGraph::nb_filters
unsigned nb_filters
Definition: avfilter.h:587
AVFilterContext::filter
const AVFilter * filter
the AVFilter of which this is an instance
Definition: avfilter.h:260
AVColorRange
AVColorRange
Visual content value range.
Definition: pixfmt.h:693
avfilter_version
unsigned avfilter_version(void)
Return the LIBAVFILTER_VERSION_INT constant.
Definition: version.c:30
avfilter_get_class
const AVClass * avfilter_get_class(void)
Definition: avfilter.c:1650
AVFilterInOut
A linked-list of the inputs/outputs of the filter chain.
Definition: avfilter.h:733
src
#define src
Definition: vp8dsp.c:248
AVFilterPadParams
Parameters of a filter's input or output pad.
Definition: avfilter.h:835
AVFilterContext::outputs
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:269