diff options
author | Nicolas George <george@nsup.org> | 2021-07-24 17:06:53 +0200 |
---|---|---|
committer | Nicolas George <george@nsup.org> | 2021-08-14 09:17:45 +0200 |
commit | 86d3dd5627b5c8c179aa48c7e4834a69371a14e6 (patch) | |
tree | 5287b075f7c97a7a9296a3d6898491a5d8768fa9 /libavfilter/formats.h | |
parent | 1d8e1afc009f2a916f672fc57f4971504bb13fb3 (diff) | |
download | ffmpeg-86d3dd5627b5c8c179aa48c7e4834a69371a14e6.tar.gz |
lavfi/formats: put merge functions in structures.
It makes the code clearer and will allow adding new stages
of negotiation easier.
Diffstat (limited to 'libavfilter/formats.h')
-rw-r--r-- | libavfilter/formats.h | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/libavfilter/formats.h b/libavfilter/formats.h index ecbbf1ff8f..6c1eec05ea 100644 --- a/libavfilter/formats.h +++ b/libavfilter/formats.h @@ -69,6 +69,19 @@ struct AVFilterFormats { struct AVFilterFormats ***refs; ///< references to this list }; +typedef struct AVFilterFormatMerger { + unsigned offset; + int (*merge)(void *a, void *b); + int (*can_merge)(const void *a, const void *b); +} AVFilterFormatsMerger; + +typedef struct AVFilterNegotiation { + unsigned nb; + const AVFilterFormatsMerger *mergers; +} AVFilterNegotiation; + +const AVFilterNegotiation *ff_filter_get_negotiation(AVFilterLink *link); + /** * A list of supported channel layouts. * @@ -109,34 +122,6 @@ struct AVFilterChannelLayouts { (int)((l) & 0x7FFFFFFF) : 0) /** - * Check the formats/samplerates lists for compatibility for merging - * without actually merging. - * - * @return 1 if they are compatible, 0 if not. - */ -int ff_can_merge_formats(const AVFilterFormats *a, const AVFilterFormats *b, - enum AVMediaType type); -int ff_can_merge_samplerates(const AVFilterFormats *a, const AVFilterFormats *b); - -/** - * Merge the formats/channel layouts/samplerates lists if they are compatible - * and update all the references of a and b to point to the combined list and - * free the old lists as needed. The combined list usually contains the - * intersection of the lists of a and b. - * - * Both a and b must have owners (i.e. refcount > 0) for these functions. - * - * @return 1 if merging succeeded, 0 if a and b are incompatible - * and negative AVERROR code on failure. - * a and b are unmodified if 0 is returned. - */ -int ff_merge_channel_layouts(AVFilterChannelLayouts *a, - AVFilterChannelLayouts *b); -int ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b, - enum AVMediaType type); -int ff_merge_samplerates(AVFilterFormats *a, AVFilterFormats *b); - -/** * Construct an empty AVFilterChannelLayouts/AVFilterFormats struct -- * representing any channel layout (with known disposition)/sample rate. */ |