FFmpeg 8.0.1
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
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 */
60unsigned avfilter_version(void);
61
62/**
63 * Return the libavfilter build-time configuration.
64 */
65const char *avfilter_configuration(void);
66
67/**
68 * Return the libavfilter license.
69 */
70const char *avfilter_license(void);
71
72typedef struct AVFilterLink AVFilterLink;
73typedef struct AVFilterPad AVFilterPad;
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 */
86const 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 */
97enum 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 */
121typedef 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 */
211typedef 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 */
261unsigned 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 */
269typedef 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 */
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 */
459int 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 */
469int 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 */
480const 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 */
489const 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 */
502int 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 */
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 */
565typedef 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
582typedef 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
633 /**
634 * Sets the maximum number of buffered frames in the filtergraph combined.
635 *
636 * Zero means no limit. This field must be set before calling
637 * avfilter_graph_config().
638 */
641
642/**
643 * Allocate a filter graph.
644 *
645 * @return the allocated filter graph on success or NULL.
646 */
648
649/**
650 * Create a new filter instance in a filter graph.
651 *
652 * @param graph graph in which the new filter will be used
653 * @param filter the filter to create an instance of
654 * @param name Name to give to the new instance (will be copied to
655 * AVFilterContext.name). This may be used by the caller to identify
656 * different filters, libavfilter itself assigns no semantics to
657 * this parameter. May be NULL.
658 *
659 * @return the context of the newly created filter instance (note that it is
660 * also retrievable directly through AVFilterGraph.filters or with
661 * avfilter_graph_get_filter()) on success or NULL on failure.
662 */
664 const AVFilter *filter,
665 const char *name);
666
667/**
668 * Get a filter instance identified by instance name from graph.
669 *
670 * @param graph filter graph to search through.
671 * @param name filter instance name (should be unique in the graph).
672 * @return the pointer to the found filter instance or NULL if it
673 * cannot be found.
674 */
676
677/**
678 * A convenience wrapper that allocates and initializes a filter in a single
679 * step. The filter instance is created from the filter filt and inited with the
680 * parameter args. opaque is currently ignored.
681 *
682 * In case of success put in *filt_ctx the pointer to the created
683 * filter instance, otherwise set *filt_ctx to NULL.
684 *
685 * @param name the instance name to give to the created filter instance
686 * @param graph_ctx the filter graph
687 * @return a negative AVERROR error code in case of failure, a non
688 * negative value otherwise
689 *
690 * @warning Since the filter is initialized after this function successfully
691 * returns, you MUST NOT set any further options on it. If you need to
692 * do that, call ::avfilter_graph_alloc_filter(), followed by setting
693 * the options, followed by ::avfilter_init_dict() instead of this
694 * function.
695 */
697 const char *name, const char *args, void *opaque,
698 AVFilterGraph *graph_ctx);
699
700/**
701 * Enable or disable automatic format conversion inside the graph.
702 *
703 * Note that format conversion can still happen inside explicitly inserted
704 * scale and aresample filters.
705 *
706 * @param flags any of the AVFILTER_AUTO_CONVERT_* constants
707 */
709
710enum {
711 AVFILTER_AUTO_CONVERT_ALL = 0, /**< all automatic conversions enabled */
712 AVFILTER_AUTO_CONVERT_NONE = -1, /**< all automatic conversions disabled */
713};
714
715/**
716 * Check validity and configure all the links and formats in the graph.
717 *
718 * @param graphctx the filter graph
719 * @param log_ctx context used for logging
720 * @return >= 0 in case of success, a negative AVERROR code otherwise
721 */
722int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx);
723
724/**
725 * Free a graph, destroy its links, and set *graph to NULL.
726 * If *graph is NULL, do nothing.
727 */
729
730/**
731 * A linked-list of the inputs/outputs of the filter chain.
732 *
733 * This is mainly useful for avfilter_graph_parse() / avfilter_graph_parse2(),
734 * where it is used to communicate open (unlinked) inputs and outputs from and
735 * to the caller.
736 * This struct specifies, per each not connected pad contained in the graph, the
737 * filter context and the pad index required for establishing a link.
738 */
739typedef struct AVFilterInOut {
740 /** unique name for this input/output in the list */
741 char *name;
742
743 /** filter context associated to this input/output */
745
746 /** index of the filt_ctx pad to use for linking */
748
749 /** next input/input in the list, NULL if this is the last */
752
753/**
754 * Allocate a single AVFilterInOut entry.
755 * Must be freed with avfilter_inout_free().
756 * @return allocated AVFilterInOut on success, NULL on failure.
757 */
759
760/**
761 * Free the supplied list of AVFilterInOut and set *inout to NULL.
762 * If *inout is NULL, do nothing.
763 */
765
766/**
767 * Add a graph described by a string to a graph.
768 *
769 * @note The caller must provide the lists of inputs and outputs,
770 * which therefore must be known before calling the function.
771 *
772 * @note The inputs parameter describes inputs of the already existing
773 * part of the graph; i.e. from the point of view of the newly created
774 * part, they are outputs. Similarly the outputs parameter describes
775 * outputs of the already existing filters, which are provided as
776 * inputs to the parsed filters.
777 *
778 * @param graph the filter graph where to link the parsed graph context
779 * @param filters string to be parsed
780 * @param inputs linked list to the inputs of the graph
781 * @param outputs linked list to the outputs of the graph
782 * @return zero on success, a negative AVERROR code on error
783 */
784int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
785 AVFilterInOut *inputs, AVFilterInOut *outputs,
786 void *log_ctx);
787
788/**
789 * Add a graph described by a string to a graph.
790 *
791 * In the graph filters description, if the input label of the first
792 * filter is not specified, "in" is assumed; if the output label of
793 * the last filter is not specified, "out" is assumed.
794 *
795 * @param graph the filter graph where to link the parsed graph context
796 * @param filters string to be parsed
797 * @param inputs pointer to a linked list to the inputs of the graph, may be NULL.
798 * If non-NULL, *inputs is updated to contain the list of open inputs
799 * after the parsing, should be freed with avfilter_inout_free().
800 * @param outputs pointer to a linked list to the outputs of the graph, may be NULL.
801 * If non-NULL, *outputs is updated to contain the list of open outputs
802 * after the parsing, should be freed with avfilter_inout_free().
803 * @return non negative on success, a negative AVERROR code on error
804 */
805int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters,
806 AVFilterInOut **inputs, AVFilterInOut **outputs,
807 void *log_ctx);
808
809/**
810 * Add a graph described by a string to a graph.
811 *
812 * @param[in] graph the filter graph where to link the parsed graph context
813 * @param[in] filters string to be parsed
814 * @param[out] inputs a linked list of all free (unlinked) inputs of the
815 * parsed graph will be returned here. It is to be freed
816 * by the caller using avfilter_inout_free().
817 * @param[out] outputs a linked list of all free (unlinked) outputs of the
818 * parsed graph will be returned here. It is to be freed by the
819 * caller using avfilter_inout_free().
820 * @return zero on success, a negative AVERROR code on error
821 *
822 * @note This function returns the inputs and outputs that are left
823 * unlinked after parsing the graph and the caller then deals with
824 * them.
825 * @note This function makes no reference whatsoever to already
826 * existing parts of the graph and the inputs parameter will on return
827 * contain inputs of the newly parsed part of the graph. Analogously
828 * the outputs parameter will contain outputs of the newly created
829 * filters.
830 */
831int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
832 AVFilterInOut **inputs,
833 AVFilterInOut **outputs);
834
835/**
836 * Parameters of a filter's input or output pad.
837 *
838 * Created as a child of AVFilterParams by avfilter_graph_segment_parse().
839 * Freed in avfilter_graph_segment_free().
840 */
841typedef struct AVFilterPadParams {
842 /**
843 * An av_malloc()'ed string containing the pad label.
844 *
845 * May be av_free()'d and set to NULL by the caller, in which case this pad
846 * will be treated as unlabeled for linking.
847 * May also be replaced by another av_malloc()'ed string.
848 */
849 char *label;
851
852/**
853 * Parameters describing a filter to be created in a filtergraph.
854 *
855 * Created as a child of AVFilterGraphSegment by avfilter_graph_segment_parse().
856 * Freed in avfilter_graph_segment_free().
857 */
858typedef struct AVFilterParams {
859 /**
860 * The filter context.
861 *
862 * Created by avfilter_graph_segment_create_filters() based on
863 * AVFilterParams.filter_name and instance_name.
864 *
865 * Callers may also create the filter context manually, then they should
866 * av_free() filter_name and set it to NULL. Such AVFilterParams instances
867 * are then skipped by avfilter_graph_segment_create_filters().
868 */
870
871 /**
872 * Name of the AVFilter to be used.
873 *
874 * An av_malloc()'ed string, set by avfilter_graph_segment_parse(). Will be
875 * passed to avfilter_get_by_name() by
876 * avfilter_graph_segment_create_filters().
877 *
878 * Callers may av_free() this string and replace it with another one or
879 * NULL. If the caller creates the filter instance manually, this string
880 * MUST be set to NULL.
881 *
882 * When both AVFilterParams.filter an AVFilterParams.filter_name are NULL,
883 * this AVFilterParams instance is skipped by avfilter_graph_segment_*()
884 * functions.
885 */
887 /**
888 * Name to be used for this filter instance.
889 *
890 * An av_malloc()'ed string, may be set by avfilter_graph_segment_parse() or
891 * left NULL. The caller may av_free() this string and replace with another
892 * one or NULL.
893 *
894 * Will be used by avfilter_graph_segment_create_filters() - passed as the
895 * third argument to avfilter_graph_alloc_filter(), then freed and set to
896 * NULL.
897 */
899
900 /**
901 * Options to be applied to the filter.
902 *
903 * Filled by avfilter_graph_segment_parse(). Afterwards may be freely
904 * modified by the caller.
905 *
906 * Will be applied to the filter by avfilter_graph_segment_apply_opts()
907 * with an equivalent of av_opt_set_dict2(filter, &opts, AV_OPT_SEARCH_CHILDREN),
908 * i.e. any unapplied options will be left in this dictionary.
909 */
911
913 unsigned nb_inputs;
914
916 unsigned nb_outputs;
918
919/**
920 * A filterchain is a list of filter specifications.
921 *
922 * Created as a child of AVFilterGraphSegment by avfilter_graph_segment_parse().
923 * Freed in avfilter_graph_segment_free().
924 */
929
930/**
931 * A parsed representation of a filtergraph segment.
932 *
933 * A filtergraph segment is conceptually a list of filterchains, with some
934 * supplementary information (e.g. format conversion flags).
935 *
936 * Created by avfilter_graph_segment_parse(). Must be freed with
937 * avfilter_graph_segment_free().
938 */
939typedef struct AVFilterGraphSegment {
940 /**
941 * The filtergraph this segment is associated with.
942 * Set by avfilter_graph_segment_parse().
943 */
945
946 /**
947 * A list of filter chain contained in this segment.
948 * Set in avfilter_graph_segment_parse().
949 */
951 size_t nb_chains;
952
953 /**
954 * A string containing a colon-separated list of key=value options applied
955 * to all scale filters in this segment.
956 *
957 * May be set by avfilter_graph_segment_parse().
958 * The caller may free this string with av_free() and replace it with a
959 * different av_malloc()'ed string.
960 */
963
964/**
965 * Parse a textual filtergraph description into an intermediate form.
966 *
967 * This intermediate representation is intended to be modified by the caller as
968 * described in the documentation of AVFilterGraphSegment and its children, and
969 * then applied to the graph either manually or with other
970 * avfilter_graph_segment_*() functions. See the documentation for
971 * avfilter_graph_segment_apply() for the canonical way to apply
972 * AVFilterGraphSegment.
973 *
974 * @param graph Filter graph the parsed segment is associated with. Will only be
975 * used for logging and similar auxiliary purposes. The graph will
976 * not be actually modified by this function - the parsing results
977 * are instead stored in seg for further processing.
978 * @param graph_str a string describing the filtergraph segment
979 * @param flags reserved for future use, caller must set to 0 for now
980 * @param seg A pointer to the newly-created AVFilterGraphSegment is written
981 * here on success. The graph segment is owned by the caller and must
982 * be freed with avfilter_graph_segment_free() before graph itself is
983 * freed.
984 *
985 * @retval "non-negative number" success
986 * @retval "negative error code" failure
987 */
988int avfilter_graph_segment_parse(AVFilterGraph *graph, const char *graph_str,
989 int flags, AVFilterGraphSegment **seg);
990
991/**
992 * Create filters specified in a graph segment.
993 *
994 * Walk through the creation-pending AVFilterParams in the segment and create
995 * new filter instances for them.
996 * Creation-pending params are those where AVFilterParams.filter_name is
997 * non-NULL (and hence AVFilterParams.filter is NULL). All other AVFilterParams
998 * instances are ignored.
999 *
1000 * For any filter created by this function, the corresponding
1001 * AVFilterParams.filter is set to the newly-created filter context,
1002 * AVFilterParams.filter_name and AVFilterParams.instance_name are freed and set
1003 * to NULL.
1004 *
1005 * @param seg the filtergraph segment to process
1006 * @param flags reserved for future use, caller must set to 0 for now
1007 *
1008 * @retval "non-negative number" Success, all creation-pending filters were
1009 * successfully created
1010 * @retval AVERROR_FILTER_NOT_FOUND some filter's name did not correspond to a
1011 * known filter
1012 * @retval "another negative error code" other failures
1013 *
1014 * @note Calling this function multiple times is safe, as it is idempotent.
1015 */
1017
1018/**
1019 * Apply parsed options to filter instances in a graph segment.
1020 *
1021 * Walk through all filter instances in the graph segment that have option
1022 * dictionaries associated with them and apply those options with
1023 * av_opt_set_dict2(..., AV_OPT_SEARCH_CHILDREN). AVFilterParams.opts is
1024 * replaced by the dictionary output by av_opt_set_dict2(), which should be
1025 * empty (NULL) if all options were successfully applied.
1026 *
1027 * If any options could not be found, this function will continue processing all
1028 * other filters and finally return AVERROR_OPTION_NOT_FOUND (unless another
1029 * error happens). The calling program may then deal with unapplied options as
1030 * it wishes.
1031 *
1032 * Any creation-pending filters (see avfilter_graph_segment_create_filters())
1033 * present in the segment will cause this function to fail. AVFilterParams with
1034 * no associated filter context are simply skipped.
1035 *
1036 * @param seg the filtergraph segment to process
1037 * @param flags reserved for future use, caller must set to 0 for now
1038 *
1039 * @retval "non-negative number" Success, all options were successfully applied.
1040 * @retval AVERROR_OPTION_NOT_FOUND some options were not found in a filter
1041 * @retval "another negative error code" other failures
1042 *
1043 * @note Calling this function multiple times is safe, as it is idempotent.
1044 */
1046
1047/**
1048 * Initialize all filter instances in a graph segment.
1049 *
1050 * Walk through all filter instances in the graph segment and call
1051 * avfilter_init_dict(..., NULL) on those that have not been initialized yet.
1052 *
1053 * Any creation-pending filters (see avfilter_graph_segment_create_filters())
1054 * present in the segment will cause this function to fail. AVFilterParams with
1055 * no associated filter context or whose filter context is already initialized,
1056 * are simply skipped.
1057 *
1058 * @param seg the filtergraph segment to process
1059 * @param flags reserved for future use, caller must set to 0 for now
1060 *
1061 * @retval "non-negative number" Success, all filter instances were successfully
1062 * initialized
1063 * @retval "negative error code" failure
1064 *
1065 * @note Calling this function multiple times is safe, as it is idempotent.
1066 */
1068
1069/**
1070 * Link filters in a graph segment.
1071 *
1072 * Walk through all filter instances in the graph segment and try to link all
1073 * unlinked input and output pads. Any creation-pending filters (see
1074 * avfilter_graph_segment_create_filters()) present in the segment will cause
1075 * this function to fail. Disabled filters and already linked pads are skipped.
1076 *
1077 * Every filter output pad that has a corresponding AVFilterPadParams with a
1078 * non-NULL label is
1079 * - linked to the input with the matching label, if one exists;
1080 * - exported in the outputs linked list otherwise, with the label preserved.
1081 * Unlabeled outputs are
1082 * - linked to the first unlinked unlabeled input in the next non-disabled
1083 * filter in the chain, if one exists
1084 * - exported in the outputs linked list otherwise, with NULL label
1085 *
1086 * Similarly, unlinked input pads are exported in the inputs linked list.
1087 *
1088 * @param seg the filtergraph segment to process
1089 * @param flags reserved for future use, caller must set to 0 for now
1090 * @param[out] inputs a linked list of all free (unlinked) inputs of the
1091 * filters in this graph segment will be returned here. It
1092 * is to be freed by the caller using avfilter_inout_free().
1093 * @param[out] outputs a linked list of all free (unlinked) outputs of the
1094 * filters in this graph segment will be returned here. It
1095 * is to be freed by the caller using avfilter_inout_free().
1096 *
1097 * @retval "non-negative number" success
1098 * @retval "negative error code" failure
1099 *
1100 * @note Calling this function multiple times is safe, as it is idempotent.
1101 */
1103 AVFilterInOut **inputs,
1104 AVFilterInOut **outputs);
1105
1106/**
1107 * Apply all filter/link descriptions from a graph segment to the associated filtergraph.
1108 *
1109 * This functions is currently equivalent to calling the following in sequence:
1110 * - avfilter_graph_segment_create_filters();
1111 * - avfilter_graph_segment_apply_opts();
1112 * - avfilter_graph_segment_init();
1113 * - avfilter_graph_segment_link();
1114 * failing if any of them fails. This list may be extended in the future.
1115 *
1116 * Since the above functions are idempotent, the caller may call some of them
1117 * manually, then do some custom processing on the filtergraph, then call this
1118 * function to do the rest.
1119 *
1120 * @param seg the filtergraph segment to process
1121 * @param flags reserved for future use, caller must set to 0 for now
1122 * @param[out] inputs passed to avfilter_graph_segment_link()
1123 * @param[out] outputs passed to avfilter_graph_segment_link()
1124 *
1125 * @retval "non-negative number" success
1126 * @retval "negative error code" failure
1127 *
1128 * @note Calling this function multiple times is safe, as it is idempotent.
1129 */
1131 AVFilterInOut **inputs,
1132 AVFilterInOut **outputs);
1133
1134/**
1135 * Free the provided AVFilterGraphSegment and everything associated with it.
1136 *
1137 * @param seg double pointer to the AVFilterGraphSegment to be freed. NULL will
1138 * be written to this pointer on exit from this function.
1139 *
1140 * @note
1141 * The filter contexts (AVFilterParams.filter) are owned by AVFilterGraph rather
1142 * than AVFilterGraphSegment, so they are not freed.
1143 */
1145
1146/**
1147 * Send a command to one or more filter instances.
1148 *
1149 * @param graph the filter graph
1150 * @param target the filter(s) to which the command should be sent
1151 * "all" sends to all filters
1152 * otherwise it can be a filter or filter instance name
1153 * which will send the command to all matching filters.
1154 * @param cmd the command to send, for handling simplicity all commands must be alphanumeric only
1155 * @param arg the argument for the command
1156 * @param res a buffer with size res_size where the filter(s) can return a response.
1157 *
1158 * @returns >=0 on success otherwise an error code.
1159 * AVERROR(ENOSYS) on unsupported commands
1160 */
1161int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags);
1162
1163/**
1164 * Queue a command for one or more filter instances.
1165 *
1166 * @param graph the filter graph
1167 * @param target the filter(s) to which the command should be sent
1168 * "all" sends to all filters
1169 * otherwise it can be a filter or filter instance name
1170 * which will send the command to all matching filters.
1171 * @param cmd the command to sent, for handling simplicity all commands must be alphanumeric only
1172 * @param arg the argument for the command
1173 * @param ts time at which the command should be sent to the filter
1174 *
1175 * @note As this executes commands after this function returns, no return code
1176 * from the filter is provided, also AVFILTER_CMD_FLAG_ONE is not supported.
1177 */
1178int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts);
1179
1180
1181/**
1182 * Dump a graph into a human-readable string representation.
1183 *
1184 * @param graph the graph to dump
1185 * @param options formatting options; currently ignored
1186 * @return a string, or NULL in case of memory allocation failure;
1187 * the string must be freed using av_free
1188 */
1189char *avfilter_graph_dump(AVFilterGraph *graph, const char *options);
1190
1191/**
1192 * Request a frame on the oldest sink link.
1193 *
1194 * If the request returns AVERROR_EOF, try the next.
1195 *
1196 * Note that this function is not meant to be the sole scheduling mechanism
1197 * of a filtergraph, only a convenience function to help drain a filtergraph
1198 * in a balanced way under normal circumstances.
1199 *
1200 * Also note that AVERROR_EOF does not mean that frames did not arrive on
1201 * some of the sinks during the process.
1202 * When there are multiple sink links, in case the requested link
1203 * returns an EOF, this may cause a filter to flush pending frames
1204 * which are sent to another sink link, although unrequested.
1205 *
1206 * @return the return value of ff_request_frame(),
1207 * or AVERROR_EOF if all links returned AVERROR_EOF
1208 */
1210
1211/**
1212 * @}
1213 */
1214
1215#endif /* AVFILTER_AVFILTER_H */
Macro definitions for various function/variable attributes.
#define attribute_deprecated
Definition attributes.h:100
Convenience header that includes libavutil's core.
refcounted data buffer API
Public dictionary API.
reference-counted frame API
struct AVFilterPad AVFilterPad
Definition avfilter.h:73
int avfilter_init_str(AVFilterContext *ctx, const char *args)
Initialize a filter with the supplied parameters.
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.
void avfilter_free(AVFilterContext *filter)
Free a filter context.
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.
char * avfilter_graph_dump(AVFilterGraph *graph, const char *options)
Dump a graph into a human-readable string representation.
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
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.
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.
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:565
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Get the name of an AVFilterPad.
const AVFilter * av_filter_iterate(void **opaque)
Iterate over all registered filters.
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.
AVBufferRef * avfilter_link_get_hw_frames_ctx(AVFilterLink *link)
Get the hardware frames context of a filter link.
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.
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.
struct AVFilterChannelLayouts AVFilterChannelLayouts
Definition avfilter.h:75
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.
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.
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)
struct AVFilterFormats AVFilterFormats
Definition avfilter.h:74
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:579
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.
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
@ AVFILTER_AUTO_CONVERT_NONE
all automatic conversions disabled
Definition avfilter.h:712
@ AVFILTER_AUTO_CONVERT_ALL
all automatic conversions enabled
Definition avfilter.h:711
struct AVDictionary AVDictionary
Definition dict.h:95
AVMediaType
Definition avutil.h:198
Libavfilter version macros.
Libavfilter version macros.
pixel format definitions
AVColorRange
Visual content value range.
Definition pixfmt.h:732
AVColorSpace
YUV colorspace type.
Definition pixfmt.h:690
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:925
size_t nb_filters
Definition avfilter.h:927
AVFilterParams ** filters
Definition avfilter.h:926
An instance of a filter.
Definition avfilter.h:269
const AVClass * av_class
needed for av_log() and filters common options
Definition avfilter.h:270
int nb_threads
Max number of threads allowed in this filter instance.
Definition avfilter.h:311
int thread_type
Type of multithreading being allowed/used.
Definition avfilter.h:304
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
char * name
name of this filter instance
Definition avfilter.h:274
unsigned nb_inputs
number of input pads
Definition avfilter.h:278
AVFilterLink ** inputs
array of pointers to input links
Definition avfilter.h:277
char * enable_str
enable expression string
Definition avfilter.h:321
const AVFilter * filter
the AVFilter of which this is an instance
Definition avfilter.h:272
struct AVFilterGraph * graph
filtergraph this filter belongs to
Definition avfilter.h:286
AVFilterPad * input_pads
array of input pads
Definition avfilter.h:276
void * priv
private data for use by the filter
Definition avfilter.h:284
unsigned nb_outputs
number of output pads
Definition avfilter.h:282
AVFilterPad * output_pads
array of output pads
Definition avfilter.h:280
int is_disabled
MUST NOT be accessed from outside avfilter.
Definition avfilter.h:338
AVBufferRef * hw_device_ctx
For filters which will create hardware frames, sets the device the filter should create them in.
Definition avfilter.h:351
AVFilterLink ** outputs
array of pointers to output links
Definition avfilter.h:281
Lists of formats / etc.
Definition avfilter.h:121
AVFilterFormats * color_spaces
Lists of supported YUV color metadata, only for YUV video.
Definition avfilter.h:141
AVFilterFormats * formats
List of supported formats (pixel or sample).
Definition avfilter.h:126
AVFilterChannelLayouts * channel_layouts
Lists of supported channel layouts, only for audio.
Definition avfilter.h:136
AVFilterFormats * color_ranges
AVColorRange.
Definition avfilter.h:142
AVFilterFormats * samplerates
Lists of supported sample rates, only for audio.
Definition avfilter.h:131
A parsed representation of a filtergraph segment.
Definition avfilter.h:939
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:961
AVFilterGraph * graph
The filtergraph this segment is associated with.
Definition avfilter.h:944
AVFilterChain ** chains
A list of filter chain contained in this segment.
Definition avfilter.h:950
unsigned nb_filters
Definition avfilter.h:585
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
Definition avfilter.h:587
AVFilterContext ** filters
Definition avfilter.h:584
unsigned max_buffered_frames
Sets the maximum number of buffered frames in the filtergraph combined.
Definition avfilter.h:639
void * opaque
Opaque user data.
Definition avfilter.h:615
char * aresample_swr_opts
swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions
Definition avfilter.h:631
int thread_type
Type of multithreading allowed for filters in this graph.
Definition avfilter.h:601
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
int nb_threads
Maximum number of threads used by filters in this graph.
Definition avfilter.h:608
const AVClass * av_class
Definition avfilter.h:583
A linked-list of the inputs/outputs of the filter chain.
Definition avfilter.h:739
AVFilterContext * filter_ctx
filter context associated to this input/output
Definition avfilter.h:744
int pad_idx
index of the filt_ctx pad to use for linking
Definition avfilter.h:747
char * name
unique name for this input/output in the list
Definition avfilter.h:741
struct AVFilterInOut * next
next input/input in the list, NULL if this is the last
Definition avfilter.h:750
Parameters of a filter's input or output pad.
Definition avfilter.h:841
char * label
An av_malloc()'ed string containing the pad label.
Definition avfilter.h:849
Parameters describing a filter to be created in a filtergraph.
Definition avfilter.h:858
char * instance_name
Name to be used for this filter instance.
Definition avfilter.h:898
unsigned nb_inputs
Definition avfilter.h:913
AVFilterPadParams ** inputs
Definition avfilter.h:912
AVFilterPadParams ** outputs
Definition avfilter.h:915
unsigned nb_outputs
Definition avfilter.h:916
AVDictionary * opts
Options to be applied to the filter.
Definition avfilter.h:910
AVFilterContext * filter
The filter context.
Definition avfilter.h:869
char * filter_name
Name of the AVFilter to be used.
Definition avfilter.h:886
Filter definition.
Definition avfilter.h:211
const char * name
Filter name.
Definition avfilter.h:215
int flags
A combination of AVFILTER_FLAG_*.
Definition avfilter.h:255
const AVClass * priv_class
A class for the private data, used to declare filter private AVOptions.
Definition avfilter.h:250
const AVFilterPad * outputs
List of static outputs.
Definition avfilter.h:240
const AVFilterPad * inputs
List of static inputs.
Definition avfilter.h:231
const char * description
A description of the filter.
Definition avfilter.h:222
Structure to hold side data for an AVFrame.
Definition frame.h:276
Rational number (pair of numerator and denominator).
Definition rational.h:58