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