lavfi: regroup formats lists in a single structure.

It will allow to refernce it as a whole without clunky macros.

Most of the changes have been automatically made with sed:

sed -i '
  s/-> *in_formats/->incfg.formats/g;
  s/-> *out_formats/->outcfg.formats/g;
  s/-> *in_channel_layouts/->incfg.channel_layouts/g;
  s/-> *out_channel_layouts/->outcfg.channel_layouts/g;
  s/-> *in_samplerates/->incfg.samplerates/g;
  s/-> *out_samplerates/->outcfg.samplerates/g;
  ' src/libavfilter/*(.)
This commit is contained in:
Nicolas George
2020-08-24 12:16:34 +02:00
parent 6a2df7ca26
commit 2f76476549
70 changed files with 388 additions and 366 deletions

View File

@@ -68,6 +68,7 @@ typedef struct AVFilterContext AVFilterContext;
typedef struct AVFilterLink AVFilterLink;
typedef struct AVFilterPad AVFilterPad;
typedef struct AVFilterFormats AVFilterFormats;
typedef struct AVFilterChannelLayouts AVFilterChannelLayouts;
/**
* Get the number of elements in a NULL-terminated array of AVFilterPads (e.g.
@@ -264,13 +265,13 @@ typedef struct AVFilter {
* and outputs are fixed), shortly before the format negotiation. This
* callback may be called more than once.
*
* This callback must set AVFilterLink.out_formats on every input link and
* AVFilterLink.in_formats on every output link to a list of pixel/sample
* This callback must set AVFilterLink.outcfg.formats on every input link and
* AVFilterLink.incfg.formats on every output link to a list of pixel/sample
* formats that the filter supports on that link. For audio links, this
* filter must also set @ref AVFilterLink.in_samplerates "in_samplerates" /
* @ref AVFilterLink.out_samplerates "out_samplerates" and
* @ref AVFilterLink.in_channel_layouts "in_channel_layouts" /
* @ref AVFilterLink.out_channel_layouts "out_channel_layouts" analogously.
* filter must also set @ref AVFilterLink.incfg.samplerates "in_samplerates" /
* @ref AVFilterLink.outcfg.samplerates "out_samplerates" and
* @ref AVFilterLink.incfg.channel_layouts "in_channel_layouts" /
* @ref AVFilterLink.outcfg.channel_layouts "out_channel_layouts" analogously.
*
* This callback may be NULL for filters with one input, in which case
* libavfilter assumes that it supports all input formats and preserves
@@ -424,6 +425,35 @@ struct AVFilterContext {
int extra_hw_frames;
};
/**
* Lists of formats / etc. supported by an end of a link.
*
* This structure is directly part of AVFilterLink, in two copies:
* one for the source filter, one for the destination filter.
* These lists are used for negotiating the format to actually be used,
* which will be loaded into the format and channel_layout members of
* AVFilterLink, when chosen.
*/
typedef struct AVFilterFormatsConfig {
/**
* List of supported formats (pixel or sample).
*/
AVFilterFormats *formats;
/**
* Lists of supported sample rates, only for audio.
*/
AVFilterFormats *samplerates;
/**
* Lists of supported channel layouts, only for audio.
*/
AVFilterChannelLayouts *channel_layouts;
} AVFilterFormatsConfig;
/**
* A link between two filters. This contains pointers to the source and
* destination filters between which this link exists, and the indexes of
@@ -471,24 +501,16 @@ struct AVFilterLink {
* New public fields should be added right above.
*****************************************************************
*/
/**
* Lists of formats and channel layouts supported by the input and output
* filters respectively. These lists are used for negotiating the format
* to actually be used, which will be loaded into the format and
* channel_layout members, above, when chosen.
*
*/
AVFilterFormats *in_formats;
AVFilterFormats *out_formats;
/**
* Lists of channel layouts and sample rates used for automatic
* negotiation.
* Lists of supported formats / etc. supported by the input filter.
*/
AVFilterFormats *in_samplerates;
AVFilterFormats *out_samplerates;
struct AVFilterChannelLayouts *in_channel_layouts;
struct AVFilterChannelLayouts *out_channel_layouts;
AVFilterFormatsConfig incfg;
/**
* Lists of supported formats / etc. supported by the output filter.
*/
AVFilterFormatsConfig outcfg;
/** stage of the initialization of the link properties (dimensions, etc) */
enum {