diff options
author | James Almer <jamrial@gmail.com> | 2021-08-31 11:03:14 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:46 -0300 |
commit | 1f96db959c1235bb7079d354e09914a0a2608f62 (patch) | |
tree | 21ac480d5b148c0524761853e6badb3a90a7ca3f /libavfilter/formats.h | |
parent | 8a5896ec1f635ccf0d726f7ba7a06649ebeebf25 (diff) |
avfilter: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/formats.h')
-rw-r--r-- | libavfilter/formats.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libavfilter/formats.h b/libavfilter/formats.h index a884d15213..caf23d0792 100644 --- a/libavfilter/formats.h +++ b/libavfilter/formats.h @@ -83,7 +83,7 @@ struct AVFilterFormats { * (e.g. AV_CH_LAYOUT_STEREO and FF_COUNT2LAYOUT(2). */ struct AVFilterChannelLayouts { - uint64_t *channel_layouts; ///< list of channel layouts + AVChannelLayout *channel_layouts; ///< list of channel layouts int nb_channel_layouts; ///< number of channel layouts char all_layouts; ///< accept any known channel layout char all_counts; ///< accept any channel layout or count @@ -99,14 +99,16 @@ struct AVFilterChannelLayouts { * The result is only valid inside AVFilterChannelLayouts and immediately * related functions. */ -#define FF_COUNT2LAYOUT(c) (0x8000000000000000ULL | (c)) +#define FF_COUNT2LAYOUT(c) ((AVChannelLayout) { .order = AV_CHANNEL_ORDER_UNSPEC, .nb_channels = c }) /** * Decode a channel count encoded as a channel layout. * Return 0 if the channel layout was a real one. */ -#define FF_LAYOUT2COUNT(l) (((l) & 0x8000000000000000ULL) ? \ - (int)((l) & 0x7FFFFFFF) : 0) +#define FF_LAYOUT2COUNT(l) (((l)->order == AV_CHANNEL_ORDER_UNSPEC) ? \ + (l)->nb_channels : 0) + +#define KNOWN(l) (!FF_LAYOUT2COUNT(l)) /* for readability */ /** * Construct an empty AVFilterChannelLayouts/AVFilterFormats struct -- @@ -126,7 +128,7 @@ av_warn_unused_result AVFilterChannelLayouts *ff_all_channel_counts(void); av_warn_unused_result -AVFilterChannelLayouts *ff_make_format64_list(const int64_t *fmts); +AVFilterChannelLayouts *ff_make_channel_layout_list(const AVChannelLayout *fmts); /** * Helpers for query_formats() which set all free audio links to the same list @@ -137,11 +139,11 @@ av_warn_unused_result int ff_set_common_channel_layouts(AVFilterContext *ctx, AVFilterChannelLayouts *layouts); /** - * Equivalent to ff_set_common_channel_layouts(ctx, ff_make_format64_list(fmts)) + * Equivalent to ff_set_common_channel_layouts(ctx, ff_make_channel_layout_list(fmts)) */ av_warn_unused_result int ff_set_common_channel_layouts_from_list(AVFilterContext *ctx, - const int64_t *fmts); + const AVChannelLayout *fmts); /** * Equivalent to ff_set_common_channel_layouts(ctx, ff_all_channel_counts()) */ @@ -178,7 +180,7 @@ av_warn_unused_result int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts); av_warn_unused_result -int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout); +int ff_add_channel_layout(AVFilterChannelLayouts **l, AVChannelLayout *channel_layout); /** * Add *ref as a new reference to f. |