[FFmpeg-devel] [PATCH 4/5] avutil/channel_layout: add av_channel_layout_retype()
Anton Khirnov
anton at khirnov.net
Sat Feb 3 12:38:43 EET 2024
Quoting James Almer (2024-02-02 13:56:31)
> I wrote a function like this some time ago, but i lost the patch by
> accident during a migration.
>
> The way i approached it was making the return codes reflect if the
> conversion was lossless or not, as in, custom -> native is lossless only
> if channels have no custom names (and possible only if the ids are
> within UINT64_MAX and in order).
> Anything to Unspec is always lossy, etc.
Unless the source is custom with every channel unknown.
> Custom -> Ambi: Possible only if it contains ambi channels. Lossless.
> Custom -> Native: Possible only if has no ambi channels and all ids < 64
> and in order. Lossy if it has custom names, otherwise lossless.
> Ambi -> Custom: Lossless.
> Ambi -> Native: Not possible.
> Native -> Custom: Lossless.
> Native -> Ambi: Not possible.
> Any -> Unspec: Possible but lossy.
>
> So 0 for lossless, 1 for lossy, ENOSYS for not possible.
That sounds good to me.
Might also have a flags argument that forces lossless, and for future
extensions.
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list