[FFmpeg-devel] [PATCH 1/5] avutil/channel_layout: add 22.2 layout
James Almer
jamrial at gmail.com
Sun Aug 2 17:40:37 EEST 2020
On 8/2/2020 11:22 AM, Jan Ekström wrote:
> On Sat, Aug 1, 2020 at 4:44 PM Jan Ekström <jeebjp at gmail.com> wrote:
>>
>>>> At this point I would not like to attempt to figure out how to skip
>>>> channel coding units in the AAC decoder
>>>
>>> Just throw them away?
>>>
>>
>> Very easy to say in words, but I am not sure how simple this is in the
>> code. That said, if you are interested in implementing this in the
>> decoder, I am not opposed to the idea since in this specific case the
>> spec seems to note that 5.1 can be mapped into those channels.
>>
>
> I took a quick look at output_configure in aacdec_template, and it
> isn't too clear what's the best way of getting this done.
>
> The more proper way would seem to be to see if sniff_channel_order
> returned a layout, and then proceed to applying a switch/case thing
> for request_channel_layout. But more looking into the decoder would be
> required to figure out if one can get it done with:
> A. Just zero out mappings past the needed coding units.
> B. A and resetting the tags count within output_configure (since that
> is a parameter received from an outer function)
> C. Something else?
>
> Alternatively, something similar to B could get received by having the
> switch/case just before the get_new_frame check, and just overriding
> the layout and channels variables.
>
> The problem is that I'm not sure how well the best working alternative
> of these will work:
> A. Not at all, since it will attempt to pull in data for 24 channels
> but the AVFrame only contains 6. Segfault.
> B. Kind of. 24 channels will get allocated, but layout is 5.1.
> C. ???
>
> I hope this clears up why I'm not too interested in trying to figure
> this out right now, since I have just been able to figure out the base
> decoding (which is currently everything the decoder supports!) and
> downmix through swresample.
As i said, that's fine for now. request_channel_layout implementations
are optional and not always feasible (Very few audio codecs truly define
a way to implement it, like it's the case of DTS). The decoder's job is
to output what the stream contains, and a resampler can take care of
everything afterwards should the user want something that's not defined
within the bitstream.
More information about the ffmpeg-devel
mailing list