[FFmpeg-devel] [PATCH 001/244] Add a new channel layout API

Marton Balint cus at passwd.hu
Wed Feb 19 00:54:56 EET 2020



On Tue, 18 Feb 2020, Anton Khirnov wrote:

> Quoting Marton Balint (2020-02-05 19:55:24)
>> 
>> 
>> On Tue, 7 Jan 2020, Anton Khirnov wrote:
>> 
>> > Quoting Nicolas George (2019-12-31 16:17:49)
>> >> Anton Khirnov (12019-12-29):
>> 
>> >> > I do not agree. Duplicated channels in a layout are expected to be a
>> >> > fringe thing and how you handle them highly depends on the specific use
>> >> > case. I expect a typical caller will want to disregard that possibility
>> >> > and just take the first channel of each semantics.
>> >> > So I do not believe a dedicated function for this makes sense. We could
>> >> > always add something later though, if it turns out to be necessary.
>> >> 
>> >> I think you are making a mistake. I think that as soon as it will be
>> >> technically possible, we will see cases with duplicated channels. And I
>> >> know that some filters will do exactly that as soon as they are ported
>> >> to this new API.
>> 
>> Quicktime also allows duplicated channels in a single audio track, this is 
>> unfortunately a commonly used feature. So if a new API is introduced to 
>> overcome the limitations of the existing one, supporting this should be 
>> seriously considered.
>
> Can you provide a link to more information about this? I'd like to know
> the specifics about how it's handled by quicktime. And do note that this
> API does have some ammount of support for duplicated channels (though I
> still consider streams containing them to be broken).

The 'chan' atom can hold this information:

https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-SW53

It holds an AudioChannelLayout structure as defined in CoreAudioTypes.h:

https://developer.apple.com/documentation/coreaudiotypes/audiochannellayout
https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.15.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Versions/A/Headers/CoreAudioBaseTypes.h#L1353

Which can hold an AudioChannelDescription array of channel descriptions 
for each channel:

https://developer.apple.com/documentation/coreaudiotypes/audiochannellayout
https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.15.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Versions/A/Headers/CoreAudioBaseTypes.h#L1335

Which can signal the same AudioChannelLabel for every channel in a track 
if needed.

There is some support for it in libavformat/mov_chan.c.

Regards,
Marton


More information about the ffmpeg-devel mailing list