[FFmpeg-devel] [PATCH] Add a new channel layout API
Michael Niedermayer
michael at niedermayer.cc
Mon Oct 28 23:54:54 EET 2019
On Mon, Oct 28, 2019 at 02:48:21PM +0100, Paul B Mahol wrote:
> The new API is more extensible and allows for custom layouts.
> More accurate information is exported, eg for decoders that do not
> set a channel layout, lavc will not make one up for them.
>
> Deprecate the old API working with just uint64_t bitmasks.
>
> Original commit by Anton Khirnov <anton at khirnov.net>.
> Expanded and completed by Vittorio Giovara <vittorio.giovara at gmail.com>.
> Adapted for FFmpeg by Paul B Mahol <onemda at gmail.com>.
>
> Signed-off-by: Anton Khirnov <anton at khirnov.net>
> Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> libavutil/channel_layout.c | 385 ++++++++++++++++++++++++++++------
> libavutil/channel_layout.h | 411 ++++++++++++++++++++++++++++++++++---
> libavutil/version.h | 3 +
> 3 files changed, 709 insertions(+), 90 deletions(-)
>
> diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
> index 3bd5ee29b7..9112af32a6 100644
> --- a/libavutil/channel_layout.c
> +++ b/libavutil/channel_layout.c
[...]
./ffmpeg -v 0 -layouts
looses the channel names
[...]
> +void av_channel_layout_from_mask(AVChannelLayout *channel_layout,
> + uint64_t mask)
> +{
> + channel_layout->order = AV_CHANNEL_ORDER_NATIVE;
> + channel_layout->nb_channels = av_popcount64(mask);
is this correct in relation to AV_CH_LAYOUT_NATIVE ?
> + channel_layout->u.mask = mask;
> +}
[...]
> +/**
> + * Initialize a native channel layout from a bitmask indicating which channels
> + * are present.
> + *
> + * @note channel_layout should be properly allocated as described above.
> + *
> + * @param channel_layout the layout structure to be initialized
> + * @param mask bitmask describing the channel layout
> + */
> +void av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask);
This possibly should return a error code
for example a mask of 0 would not be valid
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191028/b1816a5a/attachment.sig>
More information about the ffmpeg-devel
mailing list