FFmpeg
formats.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVFILTER_FORMATS_H
20 #define AVFILTER_FORMATS_H
21 
22 #include "avfilter.h"
23 
24 /**
25  * A list of supported formats for one end of a filter link. This is used
26  * during the format negotiation process to try to pick the best format to
27  * use to minimize the number of necessary conversions. Each filter gives a
28  * list of the formats supported by each input and output pad. The list
29  * given for each pad need not be distinct - they may be references to the
30  * same list of formats, as is often the case when a filter supports multiple
31  * formats, but will always output the same format as it is given in input.
32  *
33  * In this way, a list of possible input formats and a list of possible
34  * output formats are associated with each link. When a set of formats is
35  * negotiated over a link, the input and output lists are merged to form a
36  * new list containing only the common elements of each list. In the case
37  * that there were no common elements, a format conversion is necessary.
38  * Otherwise, the lists are merged, and all other links which reference
39  * either of the format lists involved in the merge are also affected.
40  *
41  * For example, consider the filter chain:
42  * filter (a) --> (b) filter (b) --> (c) filter
43  *
44  * where the letters in parenthesis indicate a list of formats supported on
45  * the input or output of the link. Suppose the lists are as follows:
46  * (a) = {A, B}
47  * (b) = {A, B, C}
48  * (c) = {B, C}
49  *
50  * First, the first link's lists are merged, yielding:
51  * filter (a) --> (a) filter (a) --> (c) filter
52  *
53  * Notice that format list (b) now refers to the same list as filter list (a).
54  * Next, the lists for the second link are merged, yielding:
55  * filter (a) --> (a) filter (a) --> (a) filter
56  *
57  * where (a) = {B}.
58  *
59  * Unfortunately, when the format lists at the two ends of a link are merged,
60  * we must ensure that all links which reference either pre-merge format list
61  * get updated as well. Therefore, we have the format list structure store a
62  * pointer to each of the pointers to itself.
63  */
65  unsigned nb_formats; ///< number of formats
66  int *formats; ///< list of media formats
67 
68  unsigned refcount; ///< number of references to this list
69  struct AVFilterFormats ***refs; ///< references to this list
70 };
71 
72 /**
73  * A list of supported channel layouts.
74  *
75  * The list works the same as AVFilterFormats, except for the following
76  * differences:
77  * - A list with all_layouts = 1 means all channel layouts with a known
78  * disposition; nb_channel_layouts must then be 0.
79  * - A list with all_counts = 1 means all channel counts, with a known or
80  * unknown disposition; nb_channel_layouts must then be 0 and all_layouts 1.
81  * - The list must not contain a layout with a known disposition and a
82  * channel count with unknown disposition with the same number of channels
83  * (e.g. AV_CH_LAYOUT_STEREO and FF_COUNT2LAYOUT(2).
84  */
86  AVChannelLayout *channel_layouts; ///< list of channel layouts
87  int nb_channel_layouts; ///< number of channel layouts
88  char all_layouts; ///< accept any known channel layout
89  char all_counts; ///< accept any channel layout or count
90 
91  unsigned refcount; ///< number of references to this list
92  struct AVFilterChannelLayouts ***refs; ///< references to this list
93 };
94 
95 /**
96  * Encode a channel count as a channel layout.
97  * FF_COUNT2LAYOUT(c) means any channel layout with c channels, with a known
98  * or unknown disposition.
99  * The result is only valid inside AVFilterChannelLayouts and immediately
100  * related functions.
101  */
102 #define FF_COUNT2LAYOUT(c) ((AVChannelLayout) { .order = AV_CHANNEL_ORDER_UNSPEC, .nb_channels = c })
103 
104 /**
105  * Decode a channel count encoded as a channel layout.
106  * Return 0 if the channel layout was a real one.
107  */
108 #define FF_LAYOUT2COUNT(l) (((l)->order == AV_CHANNEL_ORDER_UNSPEC) ? \
109  (l)->nb_channels : 0)
110 
111 #define KNOWN(l) (!FF_LAYOUT2COUNT(l)) /* for readability */
112 
113 /**
114  * Construct an empty AVFilterChannelLayouts/AVFilterFormats struct --
115  * representing any channel layout (with known disposition)/sample rate.
116  */
119 
122 
123 /**
124  * Construct an AVFilterChannelLayouts coding for any channel layout, with
125  * known or unknown disposition.
126  */
129 
132 
133 /**
134  * Construct an AVFilterFormats representing all possible color spaces.
135  *
136  * Note: This list does not include AVCOL_SPC_RESERVED.
137  */
140 
141 /**
142  * Construct an AVFilterFormats representing all possible color ranges.
143  */
146 
147 /**
148  * Construct an AVFilterFormats representing all possible alpha modes.
149  */
152 
153 /**
154  * Helpers for query_formats() which set all free audio links to the same list
155  * of channel layouts/sample rates. If there are no links hooked to this list,
156  * the list is freed.
157  */
161 /**
162  * Equivalent to ff_set_common_channel_layouts(ctx, ff_make_channel_layout_list(fmts))
163  */
166  const AVChannelLayout *fmts);
167 /**
168  * Equivalent to ff_set_common_channel_layouts(ctx, ff_all_channel_counts())
169  */
172 
175  AVFilterFormats *samplerates);
176 /**
177  * Equivalent to ff_set_common_samplerates(ctx, ff_make_format_list(samplerates))
178  */
181  const int *samplerates);
182 /**
183  * Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates())
184  */
187 
190  AVFilterFormats *color_spaces);
191 /**
192  * Equivalent to ff_set_common_color_spaces(ctx, ff_make_format_list(color_spaces))
193  */
196  const int *color_spaces);
197 
198 /**
199  * Equivalent to ff_set_common_color_spaces(ctx, ff_all_color_spaces())
200  */
203 
206  AVFilterFormats *color_ranges);
207 /**
208  * Equivalent to ff_set_common_color_ranges(ctx, ff_make_format_list(color_ranges))
209  */
212  const int *color_ranges);
213 
214 /**
215  * Equivalent to ff_set_common_color_ranges(ctx, ff_all_color_ranges())
216  */
219 
222  AVFilterFormats *alpha_modes);
223 /**
224  * Equivalent to ff_set_common_alpha_modes(ctx, ff_make_format_list(alpha_modes))
225  */
228  const int *alpha_modes);
229 
230 /**
231  * Equivalent to ff_set_common_alpha_modes(ctx, ff_all_alpha_modes())
232  */
235 
236 
237 /**
238  * A helper for query_formats() which sets all links to the same list of
239  * formats. If there are no links hooked to this filter, the list of formats is
240  * freed.
241  */
244 
245 /**
246  * Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts))
247  */
250 
251 /**
252  * Equivalent to ff_set_common_formats(ctx, ff_make_sample_format_list(fmts))
253  */
256 
257 /**
258  * Equivalent to ff_set_common_formats(ctx, ff_make_pixel_format_list(fmts))
259  */
262 
263 /**
264  * Helpers for query_formats2() which set all free audio links to the same list
265  * of channel layouts/sample rates. If there are no links hooked to this list,
266  * the list is freed.
267  */
270  AVFilterFormatsConfig **cfg_in,
271  AVFilterFormatsConfig **cfg_out,
273 
276  AVFilterFormatsConfig **cfg_in,
277  AVFilterFormatsConfig **cfg_out,
278  const AVChannelLayout *fmts);
281  AVFilterFormatsConfig **cfg_in,
282  AVFilterFormatsConfig **cfg_out);
283 
286  AVFilterFormatsConfig **cfg_in,
287  AVFilterFormatsConfig **cfg_out,
288  AVFilterFormats *samplerates);
289 
292  AVFilterFormatsConfig **cfg_in,
293  AVFilterFormatsConfig **cfg_out,
294  const int *samplerates);
295 
298  AVFilterFormatsConfig **cfg_in,
299  AVFilterFormatsConfig **cfg_out);
300 
303  AVFilterFormatsConfig **cfg_in,
304  AVFilterFormatsConfig **cfg_out,
305  AVFilterFormats *color_spaces);
306 
309  AVFilterFormatsConfig **cfg_in,
310  AVFilterFormatsConfig **cfg_out,
311  const int *color_spaces);
312 
315  AVFilterFormatsConfig **cfg_in,
316  AVFilterFormatsConfig **cfg_out);
317 
320  AVFilterFormatsConfig **cfg_in,
321  AVFilterFormatsConfig **cfg_out,
322  AVFilterFormats *color_ranges);
323 
326  AVFilterFormatsConfig **cfg_in,
327  AVFilterFormatsConfig **cfg_out,
328  const int *color_ranges);
329 
332  AVFilterFormatsConfig **cfg_in,
333  AVFilterFormatsConfig **cfg_out);
334 
337  AVFilterFormatsConfig **cfg_in,
338  AVFilterFormatsConfig **cfg_out,
339  AVFilterFormats *alpha_modes);
340 
343  AVFilterFormatsConfig **cfg_in,
344  AVFilterFormatsConfig **cfg_out,
345  const int *alpha_modes);
346 
349  AVFilterFormatsConfig **cfg_in,
350  AVFilterFormatsConfig **cfg_out);
351 
354  AVFilterFormatsConfig **cfg_in,
355  AVFilterFormatsConfig **cfg_out,
357 
360  AVFilterFormatsConfig **cfg_in,
361  AVFilterFormatsConfig **cfg_out,
362  const int *fmts);
363 
366  AVFilterFormatsConfig **cfg_in,
367  AVFilterFormatsConfig **cfg_out,
368  const enum AVSampleFormat *fmts);
369 
372  AVFilterFormatsConfig **cfg_in,
373  AVFilterFormatsConfig **cfg_out,
374  const enum AVPixelFormat *fmts);
375 
378  const AVChannelLayout *channel_layout);
379 
380 /**
381  * Add *ref as a new reference to f.
382  */
386 
387 /**
388  * Remove a reference to a channel layouts list.
389  */
391 
393  AVFilterChannelLayouts **newref);
394 
395 /**
396  * Sets all remaining unset filter lists for all inputs/outputs to their
397  * corresponding `ff_all_*()` lists.
398  */
401 
402 /**
403  * Create a list of supported formats. This is intended for use in
404  * AVFilter->query_formats().
405  *
406  * @param fmts list of media formats, terminated by -1
407  * @return the format list, with no existing references
408  */
410 AVFilterFormats *ff_make_format_list(const int *fmts);
411 
412 /**
413  * Create a list of supported sample formats. This is intended for use in
414  * AVFilter->query_formats().
415  *
416  * @param fmts list of enum AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE
417  * @return the format list, with no existing references
418  */
421 
422 /**
423  * Create a list of supported pixel formats. This is intended for use in
424  * AVFilter->query_formats().
425  *
426  * @param fmts list of enum AVPixelFormat, terminated by AV_PIX_FMT_NONE
427  * @return the format list, with no existing references
428  */
431 
432 /**
433  * Equivalent to ff_make_format_list({const int[]}{ fmt, -1 })
434  */
437 
438 /**
439  * Add fmt to the list of media formats contained in *avff.
440  * If *avff is NULL the function allocates the filter formats struct
441  * and puts its pointer in *avff.
442  *
443  * @return a non negative value in case of success, or a negative
444  * value corresponding to an AVERROR code in case of error
445  */
447 int ff_add_format(AVFilterFormats **avff, int64_t fmt);
448 
449 /**
450  * Return a list of all formats supported by FFmpeg for the given media type.
451  */
454 
455 /**
456  * Construct a formats list containing all pixel formats with certain
457  * properties
458  */
460 AVFilterFormats *ff_formats_pixdesc_filter(unsigned want, unsigned rej);
461 
462 //* format is software, non-planar with sub-sampling
463 #define FF_PIX_FMT_FLAG_SW_FLAT_SUB (1 << 24)
464 
465 /**
466  * Construct a formats list containing all planar sample formats.
467  */
470 
471 /**
472  * Add *ref as a new reference to formats.
473  * That is the pointers will point like in the ascii art below:
474  * ________
475  * |formats |<--------.
476  * | ____ | ____|___________________
477  * | |refs| | | __|_
478  * | |* * | | | | | | AVFilterLink
479  * | |* *--------->|*ref|
480  * | |____| | | |____|
481  * |________| |________________________
482  */
485 
486 /**
487  * If *ref is non-NULL, remove *ref as a reference to the format list
488  * it currently points to, deallocates that list if this was the last
489  * reference, and sets *ref to NULL.
490  *
491  * Before After
492  * ________ ________ NULL
493  * |formats |<--------. |formats | ^
494  * | ____ | ____|________________ | ____ | ____|________________
495  * | |refs| | | __|_ | |refs| | | __|_
496  * | |* * | | | | | | AVFilterLink | |* * | | | | | | AVFilterLink
497  * | |* *--------->|*ref| | |* | | | |*ref|
498  * | |____| | | |____| | |____| | | |____|
499  * |________| |_____________________ |________| |_____________________
500  */
502 
503 /**
504  * Before After
505  * ________ ________
506  * |formats |<---------. |formats |<---------.
507  * | ____ | ___|___ | ____ | ___|___
508  * | |refs| | | | | | |refs| | | | | NULL
509  * | |* *--------->|*oldref| | |* *--------->|*newref| ^
510  * | |* * | | |_______| | |* * | | |_______| ___|___
511  * | |____| | | |____| | | | |
512  * |________| |________| |*oldref|
513  * |_______|
514  */
515 void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref);
516 
517 /**
518  * Check that fmts is a valid pixel formats list.
519  *
520  * In particular, check for duplicates.
521  */
522 int ff_formats_check_pixel_formats(void *log, const AVFilterFormats *fmts);
523 
524 /**
525  * Check that fmts is a valid sample formats list.
526  *
527  * In particular, check for duplicates.
528  */
529 int ff_formats_check_sample_formats(void *log, const AVFilterFormats *fmts);
530 
531 /**
532  * Check that fmts is a valid sample rates list.
533  *
534  * In particular, check for duplicates.
535  */
536 int ff_formats_check_sample_rates(void *log, const AVFilterFormats *fmts);
537 
538 /**
539  * Check that fmts is a valid channel layouts list.
540  *
541  * In particular, check for duplicates.
542  */
544 
545 /**
546  * Check that fmts is a valid formats list for YUV colorspace metadata.
547  *
548  * In particular, check for duplicates.
549  */
550 int ff_formats_check_color_spaces(void *log, const AVFilterFormats *fmts);
551 int ff_formats_check_color_ranges(void *log, const AVFilterFormats *fmts);
552 
553 /**
554  * Check that fmts is a valid formats list for alpha modes.
555  *
556  * In particular, check for duplicates.
557  */
558 int ff_formats_check_alpha_modes(void *log, const AVFilterFormats *fmts);
559 
560 struct AVBPrint;
561 
562 typedef struct AVFilterFormatMerger {
563  const char *name;
564  unsigned offset;
565  int (*merge)(void *a, void *b);
566  int (*can_merge)(const void *a, const void *b);
567  void (*print_list)(struct AVBPrint *bp, const void *fmts);
568  const char *conversion_filter;
570 } AVFilterFormatsMerger;
571 
572 /**
573  * Callbacks and properties to describe the steps of a format negotiation.
574  *
575  * The steps are:
576  *
577  * 1. query_formats(): call the callbacks on all filter to set lists of
578  * supported formats.
579  * When links on a filter must eventually have the same
580  * format, the lists of supported formats are the same
581  * object in memory.
582  * See:
583  * http://www.normalesup.org/~george/articles/format_negotiation_in_libavfilter/#12
584  *
585  *
586  * 2. query_formats(): merge lists of supported formats or insert automatic
587  * conversion filters.
588  * Compute the intersection of the lists of supported
589  * formats on the ends of links. If it succeeds, replace
590  * both objects with the intersection everywhere they
591  * are referenced.
592  * If the intersection is empty, insert an automatic
593  * conversion filter.
594  * If several formats are negotiated at once (format,
595  * rate, layout), only merge if all three can be, since
596  * the conversion filter can convert all three at once.
597  * This process goes on as long as progress is made.
598  * See:
599  * http://www.normalesup.org/~george/articles/format_negotiation_in_libavfilter/#14
600  * http://www.normalesup.org/~george/articles/format_negotiation_in_libavfilter/#29
601  *
602  * 3. reduce_formats(): try to reduce format conversion within filters.
603  * For each link where there is only one supported
604  * formats on output, for each output of the connected
605  * filter, if the media type is the same and said
606  * format is supported, keep only this one.
607  * This process goes on as long as progress is made.
608  * Rationale: conversion filters will set a large list
609  * of supported formats on outputs but users will
610  * expect the output to be as close as possible as the
611  * input (examples: scale without changing the pixel
612  * format, resample without changint the layout).
613  * FIXME: this can probably be done by merging the
614  * input and output lists instead of re-implementing
615  * the logic.
616  *
617  * 4. swap_sample_fmts():
618  * swap_samplerates():
619  * swap_channel_layouts(): For each filter with an input with only one
620  * supported format, when outputs have several
621  * supported formats, put the best one with
622  * reference to the input at the beginning of the
623  * list, to prepare it for being picked up by
624  * pick_formats().
625  * The best format is the one that is most
626  * similar to the input while not losing too much
627  * information.
628  * This process need to run only once.
629  * FIXME: reduce_formats() operates on all inputs
630  * with a single format, swap_*() operates on the
631  * first one only: check if the difference makes
632  * sense.
633  * TODO: the swapping done for one filter can
634  * override the swapping done for another filter
635  * connected to the same list of formats, maybe
636  * it would be better to compute a total score
637  * for all connected filters and use the score to
638  * pick the format instead of just swapping.
639  * TODO: make the similarity logic available as
640  * public functions in libavutil.
641  *
642  * 5. pick_formats(): Choose one format from the lists of supported formats,
643  * use it for the link and reduce the list to a single
644  * element to force other filters connected to the same
645  * list to use it.
646  * First process all links where there is a single format
647  * and the output links of all filters with an input,
648  * trying to preserve similarity between input and
649  * outputs.
650  * Repeat as long as process is made.
651  * Then do a final run for the remaining filters.
652  * FIXME: the similarity logic (the ref argument to
653  * pick_format()) added in FFmpeg duplicates and
654  * overrides the swapping logic added in libav. Better
655  * merge them into a score system.
656  */
657 typedef struct AVFilterNegotiation {
658  unsigned nb_mergers;
659  const AVFilterFormatsMerger *mergers;
661 
663 
664 #endif /* AVFILTER_FORMATS_H */
formats
formats
Definition: signature.h:47
ff_set_common_color_ranges2
av_warn_unused_result int ff_set_common_color_ranges2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *color_ranges)
Definition: formats.c:1090
ff_formats_changeref
void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
Definition: formats.c:832
AVFilterChannelLayouts
A list of supported channel layouts.
Definition: formats.h:85
ff_formats_check_channel_layouts
int ff_formats_check_channel_layouts(void *log, const AVFilterChannelLayouts *fmts)
Check that fmts is a valid channel layouts list.
Definition: formats.c:1300
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
ff_all_channel_layouts
av_warn_unused_result AVFilterChannelLayouts * ff_all_channel_layouts(void)
Construct an empty AVFilterChannelLayouts/AVFilterFormats struct – representing any channel layout (w...
Definition: formats.c:680
ff_set_common_color_spaces_from_list2
av_warn_unused_result int ff_set_common_color_spaces_from_list2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, const int *color_spaces)
Definition: formats.c:1075
layouts
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:335
ff_all_samplerates
av_warn_unused_result AVFilterFormats * ff_all_samplerates(void)
Definition: formats.c:674
ff_set_common_alpha_modes
av_warn_unused_result int ff_set_common_alpha_modes(AVFilterContext *ctx, AVFilterFormats *alpha_modes)
Definition: formats.c:941
ff_make_formats_list_singleton
av_warn_unused_result AVFilterFormats * ff_make_formats_list_singleton(int fmt)
Equivalent to ff_make_format_list({const int[]}{ fmt, -1 })
Definition: formats.c:597
ff_formats_unref
void ff_formats_unref(AVFilterFormats **ref)
If *ref is non-NULL, remove *ref as a reference to the format list it currently points to,...
Definition: formats.c:796
int64_t
long long int64_t
Definition: coverity.c:34
normalize.log
log
Definition: normalize.py:21
ff_set_common_all_alpha_modes
av_warn_unused_result int ff_set_common_all_alpha_modes(AVFilterContext *ctx)
Equivalent to ff_set_common_alpha_modes(ctx, ff_all_alpha_modes())
Definition: formats.c:954
ff_all_color_spaces
av_warn_unused_result AVFilterFormats * ff_all_color_spaces(void)
Construct an AVFilterFormats representing all possible color spaces.
Definition: formats.c:698
ff_set_common_color_ranges
av_warn_unused_result int ff_set_common_color_ranges(AVFilterContext *ctx, AVFilterFormats *color_ranges)
Definition: formats.c:923
ff_set_pixel_formats_from_list2
av_warn_unused_result int ff_set_pixel_formats_from_list2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, const enum AVPixelFormat *fmts)
Definition: formats.c:1163
b
#define b
Definition: input.c:42
ff_make_pixel_format_list
av_warn_unused_result AVFilterFormats * ff_make_pixel_format_list(const enum AVPixelFormat *fmts)
Create a list of supported pixel formats.
ff_set_common_all_alpha_modes2
av_warn_unused_result int ff_set_common_all_alpha_modes2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: formats.c:1131
ff_channel_layouts_changeref
void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref, AVFilterChannelLayouts **newref)
Definition: formats.c:826
AVFilterFormats::formats
int * formats
list of media formats
Definition: formats.h:66
ff_add_format
av_warn_unused_result int ff_add_format(AVFilterFormats **avff, int64_t fmt)
Add fmt to the list of media formats contained in *avff.
Definition: formats.c:572
ff_set_common_color_spaces_from_list
av_warn_unused_result int ff_set_common_color_spaces_from_list(AVFilterContext *ctx, const int *color_spaces)
Equivalent to ff_set_common_color_spaces(ctx, ff_make_format_list(color_spaces))
Definition: formats.c:912
ff_add_channel_layout
av_warn_unused_result int ff_add_channel_layout(AVFilterChannelLayouts **l, const AVChannelLayout *channel_layout)
Definition: formats.c:589
ff_set_common_alpha_modes_from_list2
av_warn_unused_result int ff_set_common_alpha_modes_from_list2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, const int *alpha_modes)
Definition: formats.c:1123
ff_set_common_all_color_ranges
av_warn_unused_result int ff_set_common_all_color_ranges(AVFilterContext *ctx)
Equivalent to ff_set_common_color_ranges(ctx, ff_all_color_ranges())
Definition: formats.c:936
AVFilterFormats
A list of supported formats for one end of a filter link.
Definition: formats.h:64
ff_default_query_formats
av_warn_unused_result int ff_default_query_formats(AVFilterContext *ctx)
Sets all remaining unset filter lists for all inputs/outputs to their corresponding ff_all_*() lists.
Definition: formats.c:1171
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
ff_formats_check_sample_rates
int ff_formats_check_sample_rates(void *log, const AVFilterFormats *fmts)
Check that fmts is a valid sample rates list.
Definition: formats.c:1265
ff_all_alpha_modes
av_warn_unused_result AVFilterFormats * ff_all_alpha_modes(void)
Construct an AVFilterFormats representing all possible alpha modes.
Definition: formats.c:725
AVFilterNegotiation
Callbacks and properties to describe the steps of a format negotiation.
Definition: formats.h:657
AVFilterNegotiation::nb_mergers
unsigned nb_mergers
Definition: formats.h:658
AVFilterChannelLayouts::refs
struct AVFilterChannelLayouts *** refs
references to this list
Definition: formats.h:92
AVFilterFormats::refs
struct AVFilterFormats *** refs
references to this list
Definition: formats.h:69
ff_set_common_formats_from_list
av_warn_unused_result int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts)
Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts))
Definition: formats.c:970
ff_set_common_all_channel_counts2
av_warn_unused_result int ff_set_common_all_channel_counts2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: formats.c:1035
ff_set_sample_formats_from_list
av_warn_unused_result int ff_set_sample_formats_from_list(AVFilterContext *ctx, const enum AVSampleFormat *fmts)
Equivalent to ff_set_common_formats(ctx, ff_make_sample_format_list(fmts))
Definition: formats.c:975
ff_set_pixel_formats_from_list
av_warn_unused_result int ff_set_pixel_formats_from_list(AVFilterContext *ctx, const enum AVPixelFormat *fmts)
Equivalent to ff_set_common_formats(ctx, ff_make_pixel_format_list(fmts))
Definition: formats.c:980
ff_set_common_color_ranges_from_list2
av_warn_unused_result int ff_set_common_color_ranges_from_list2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, const int *color_ranges)
Definition: formats.c:1099
ff_planar_sample_fmts
av_warn_unused_result AVFilterFormats * ff_planar_sample_fmts(void)
Construct a formats list containing all planar sample formats.
Definition: formats.c:661
ff_make_format_list
av_warn_unused_result AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
ff_formats_ref
av_warn_unused_result int ff_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref)
Add *ref as a new reference to formats.
Definition: formats.c:757
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AVFilterNegotiation::mergers
const AVFilterFormatsMerger * mergers
Definition: formats.h:659
link
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a link
Definition: filter_design.txt:23
AVFilterFormatMerger::offset
unsigned offset
Definition: formats.h:564
ff_set_common_channel_layouts_from_list2
av_warn_unused_result int ff_set_common_channel_layouts_from_list2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, const AVChannelLayout *fmts)
Definition: formats.c:1027
ff_set_common_samplerates_from_list2
av_warn_unused_result int ff_set_common_samplerates_from_list2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, const int *samplerates)
Definition: formats.c:1051
ff_set_common_all_color_spaces2
av_warn_unused_result int ff_set_common_all_color_spaces2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: formats.c:1083
ff_all_color_ranges
av_warn_unused_result AVFilterFormats * ff_all_color_ranges(void)
Construct an AVFilterFormats representing all possible color ranges.
Definition: formats.c:714
ff_set_common_color_spaces2
av_warn_unused_result int ff_set_common_color_spaces2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *color_spaces)
Definition: formats.c:1066
AVFilterFormatMerger::can_merge
int(* can_merge)(const void *a, const void *b)
Definition: formats.h:566
AVFilterFormats::nb_formats
unsigned nb_formats
number of formats
Definition: formats.h:65
ff_formats_check_pixel_formats
int ff_formats_check_pixel_formats(void *log, const AVFilterFormats *fmts)
Check that fmts is a valid pixel formats list.
Definition: formats.c:1255
AVFilterFormats::refcount
unsigned refcount
number of references to this list
Definition: formats.h:68
AVFilterFormatsConfig
Lists of formats / etc.
Definition: avfilter.h:121
ff_set_common_channel_layouts
av_warn_unused_result int ff_set_common_channel_layouts(AVFilterContext *ctx, AVFilterChannelLayouts *layouts)
Helpers for query_formats() which set all free audio links to the same list of channel layouts/sample...
Definition: formats.c:869
f
f
Definition: af_crystalizer.c:122
AVMediaType
AVMediaType
Definition: avutil.h:198
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:319
ff_set_common_channel_layouts_from_list
av_warn_unused_result int ff_set_common_channel_layouts_from_list(AVFilterContext *ctx, const AVChannelLayout *fmts)
Equivalent to ff_set_common_channel_layouts(ctx, ff_make_channel_layout_list(fmts))
Definition: formats.c:876
AVFilterChannelLayouts::channel_layouts
AVChannelLayout * channel_layouts
list of channel layouts
Definition: formats.h:86
ff_set_common_samplerates_from_list
av_warn_unused_result int ff_set_common_samplerates_from_list(AVFilterContext *ctx, const int *samplerates)
Equivalent to ff_set_common_samplerates(ctx, ff_make_format_list(samplerates))
Definition: formats.c:894
AVFilterFormatMerger::merge
int(* merge)(void *a, void *b)
Definition: formats.h:565
AVFilterChannelLayouts::all_layouts
char all_layouts
accept any known channel layout
Definition: formats.h:88
AVFilterChannelLayouts::all_counts
char all_counts
accept any channel layout or count
Definition: formats.h:89
ff_all_formats
av_warn_unused_result AVFilterFormats * ff_all_formats(enum AVMediaType type)
Return a list of all formats supported by FFmpeg for the given media type.
Definition: formats.c:603
ff_make_channel_layout_list
av_warn_unused_result AVFilterChannelLayouts * ff_make_channel_layout_list(const AVChannelLayout *fmts)
Definition: formats.c:512
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
ff_set_common_color_ranges_from_list
av_warn_unused_result int ff_set_common_color_ranges_from_list(AVFilterContext *ctx, const int *color_ranges)
Equivalent to ff_set_common_color_ranges(ctx, ff_make_format_list(color_ranges))
Definition: formats.c:930
ff_set_sample_formats_from_list2
av_warn_unused_result int ff_set_sample_formats_from_list2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, const enum AVSampleFormat *fmts)
Definition: formats.c:1155
ff_set_common_color_spaces
av_warn_unused_result int ff_set_common_color_spaces(AVFilterContext *ctx, AVFilterFormats *color_spaces)
Definition: formats.c:905
av_warn_unused_result
#define av_warn_unused_result
Definition: attributes.h:80
AVFilterFormatMerger::conversion_filter
const char * conversion_filter
Definition: formats.h:568
ff_set_common_all_samplerates
av_warn_unused_result int ff_set_common_all_samplerates(AVFilterContext *ctx)
Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates())
Definition: formats.c:900
ff_set_common_all_channel_counts
av_warn_unused_result int ff_set_common_all_channel_counts(AVFilterContext *ctx)
Equivalent to ff_set_common_channel_layouts(ctx, ff_all_channel_counts())
Definition: formats.c:882
ff_set_common_samplerates2
av_warn_unused_result int ff_set_common_samplerates2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *samplerates)
Definition: formats.c:1042
ff_set_common_formats
av_warn_unused_result int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:964
AVFilterFormatMerger::conversion_opts_offset
unsigned conversion_opts_offset
Definition: formats.h:569
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
ff_set_common_channel_layouts2
av_warn_unused_result int ff_set_common_channel_layouts2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterChannelLayouts *channel_layouts)
Helpers for query_formats2() which set all free audio links to the same list of channel layouts/sampl...
Definition: formats.c:1018
ff_channel_layouts_unref
void ff_channel_layouts_unref(AVFilterChannelLayouts **ref)
Remove a reference to a channel layouts list.
Definition: formats.c:808
ff_set_common_all_color_spaces
av_warn_unused_result int ff_set_common_all_color_spaces(AVFilterContext *ctx)
Equivalent to ff_set_common_color_spaces(ctx, ff_all_color_spaces())
Definition: formats.c:918
ff_make_sample_format_list
av_warn_unused_result AVFilterFormats * ff_make_sample_format_list(const enum AVSampleFormat *fmts)
Create a list of supported sample formats.
ff_set_common_formats2
av_warn_unused_result int ff_set_common_formats2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *formats)
Definition: formats.c:1138
ff_set_common_formats_from_list2
av_warn_unused_result int ff_set_common_formats_from_list2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, const int *fmts)
Definition: formats.c:1147
ff_formats_check_sample_formats
int ff_formats_check_sample_formats(void *log, const AVFilterFormats *fmts)
Check that fmts is a valid sample formats list.
Definition: formats.c:1260
ff_set_common_all_samplerates2
av_warn_unused_result int ff_set_common_all_samplerates2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: formats.c:1059
avfilter.h
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
ff_channel_layouts_ref
av_warn_unused_result int ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
Add *ref as a new reference to f.
Definition: formats.c:752
AVFilterContext
An instance of a filter.
Definition: avfilter.h:274
AVFilterChannelLayouts::nb_channel_layouts
int nb_channel_layouts
number of channel layouts
Definition: formats.h:87
ff_formats_check_alpha_modes
int ff_formats_check_alpha_modes(void *log, const AVFilterFormats *fmts)
Check that fmts is a valid formats list for alpha modes.
Definition: formats.c:1288
ff_set_common_samplerates
av_warn_unused_result int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates)
Definition: formats.c:887
AVFilterFormatMerger
Definition: formats.h:562
AVFilterFormatMerger::print_list
void(* print_list)(struct AVBPrint *bp, const void *fmts)
Definition: formats.h:567
channel_layouts
static const uint16_t channel_layouts[7]
Definition: dca_lbr.c:112
ff_filter_get_negotiation
const AVFilterNegotiation * ff_filter_get_negotiation(const AVFilterLink *link)
Definition: formats.c:461
AVFilterChannelLayouts::refcount
unsigned refcount
number of references to this list
Definition: formats.h:91
ff_set_common_alpha_modes_from_list
av_warn_unused_result int ff_set_common_alpha_modes_from_list(AVFilterContext *ctx, const int *alpha_modes)
Equivalent to ff_set_common_alpha_modes(ctx, ff_make_format_list(alpha_modes))
Definition: formats.c:948
ff_all_channel_counts
av_warn_unused_result AVFilterChannelLayouts * ff_all_channel_counts(void)
Construct an AVFilterChannelLayouts coding for any channel layout, with known or unknown disposition.
Definition: formats.c:689
ff_formats_check_color_spaces
int ff_formats_check_color_spaces(void *log, const AVFilterFormats *fmts)
Check that fmts is a valid formats list for YUV colorspace metadata.
Definition: formats.c:1272
AVFilterFormatMerger::name
const char * name
Definition: formats.h:563
ff_formats_check_color_ranges
int ff_formats_check_color_ranges(void *log, const AVFilterFormats *fmts)
Definition: formats.c:1283
ff_set_common_alpha_modes2
av_warn_unused_result int ff_set_common_alpha_modes2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *alpha_modes)
Definition: formats.c:1114
ff_formats_pixdesc_filter
av_warn_unused_result AVFilterFormats * ff_formats_pixdesc_filter(unsigned want, unsigned rej)
Construct a formats list containing all pixel formats with certain properties.
Definition: formats.c:621
ff_set_common_all_color_ranges2
av_warn_unused_result int ff_set_common_all_color_ranges2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: formats.c:1107