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