[FFmpeg-devel] Correct libvorbis.c behaviour with >2 channels

David Conrad lessen42
Sun Jun 27 06:38:12 CEST 2010


On Jun 23, 2010, at 4:35 PM, James Darnley wrote:

> On 17 June 2010 10:21, Rob <robert.swain at gmail.com> wrote:
>> On 3 June 2010 11:35, James Darnley <james.darnley at gmail.com> wrote:
>>> On 3 June 2010 00:08, Justin Ruggles <justin.ruggles at gmail.com> wrote:
>>>> There are some patches on the issue tracker that might be useful.
>>>> 
>>>> https://roundup.ffmpeg.org/issue1325
>>>> 
>>>> This was only for 5.1 channels though.  The vorbis spec has been
>>>> modified since then to support up to 7.1 I think... or more?
>>> 
>>> Yes, it now has mappings for 1-8 channels.
>>> 
>>> Any comments about putting the following in vorbis_data.c?
>>> 
>>>> const uint8_t ff_vorbis_encoding_channel_layout_offsets[8][8] = {
>>>>    { 0, },
>>>>    { 0, 1, },
>>>>    { 0, 2, 1, },
>>>>    { 0, 1, 2, 3, },
>>>>    { 0, 2, 1, 3, 4, },
>>>>    { 0, 2, 1, 4, 5, 3, },
>>>>    { 0, 2, 1, 5, 6, 4, 3, },
>>>>    { 0, 2, 1, 6, 7, 4, 5, 3},
>>>> };
>> 
>> These look correct and vorbis_data.c is the correct location I guess.
>> Unless it is only used for decoding, then I'm not sure.
>> 
>>> Also, what should I do if someone tries to use more that 8 channels.
>>> Libvorbis appears to support it.  Should this wrapper support it too
>>> or return an error?
>> 
>> No. More channels are valid, but their order is defined by the
>> application as I recall. So >8 channels should just be pushed through
>> in the order they are in. Or maybe some might prefer that the first 8
>> channels of the output match the order for 8 channels and then the
>> rest are in the order as the come.
>> 
> 
> Okay...
> Table added to vorbis_data.c
> Channel order not changed with more than 8 channels


> +const uint8_t ff_vorbis_encoding_channel_layout_offsets[8][8] = {
> +    { 0, },
> +    { 0, 1, },
> +    { 0, 2, 1, },
> +    { 0, 1, 2, 3, },
> +    { 0, 2, 1, 3, 4, },
> +    { 0, 2, 1, 4, 5, 3, },
> +    { 0, 2, 1, 5, 6, 4, 3, },
> +    { 0, 2, 1, 6, 7, 4, 5, 3},
> +};
> +

Leave out the trailing comma and add a space before the } for 8 channels.

Patch OK with that fixed



More information about the ffmpeg-devel mailing list