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