You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-11-23 21:54:53 +02:00
lavfi/formats: put merge functions in structures.
It makes the code clearer and will allow adding new stages of negotiation easier.
This commit is contained in:
@@ -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.
|
||||
*
|
||||
@@ -108,34 +121,6 @@ struct AVFilterChannelLayouts {
|
||||
#define FF_LAYOUT2COUNT(l) (((l) & 0x8000000000000000ULL) ? \
|
||||
(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.
|
||||
|
||||
Reference in New Issue
Block a user