[FFmpeg-devel] [PATCH 1/3] avcodec/aacdec_template: keep tabs on layout in sniff_channel_order

Jan Ekström jeebjp at gmail.com
Thu Aug 20 23:50:57 EEST 2020


On Tue, Aug 18, 2020 at 10:25 PM Jan Ekström <jeebjp at gmail.com> wrote:
>
> This way the layout set at various points can be checked instead
> of only having the layout at the end.
> ---
>  libavcodec/aacdec_template.c | 53 ++++++++++++++++++++++--------------
>  1 file changed, 32 insertions(+), 21 deletions(-)
>
> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
> index 8c5048cc13..9eef1c0158 100644
> --- a/libavcodec/aacdec_template.c
> +++ b/libavcodec/aacdec_template.c
> @@ -198,7 +198,7 @@ struct elem_to_channel {
>
>  static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID],
>                         uint8_t (*layout_map)[3], int offset, uint64_t left,
> -                       uint64_t right, int pos)
> +                       uint64_t right, int pos, uint64_t *layout)
>  {
>      if (layout_map[offset][0] == TYPE_CPE) {
>          e2c_vec[offset] = (struct elem_to_channel) {
> @@ -207,6 +207,9 @@ static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID],
>              .elem_id      = layout_map[offset][1],
>              .aac_position = pos
>          };
> +        if (e2c_vec[offset].av_position != UINT64_MAX)
> +            *layout |= e2c_vec[offset].av_position;
> +
>          return 1;
>      } else {
>          e2c_vec[offset] = (struct elem_to_channel) {
> @@ -221,6 +224,9 @@ static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID],
>              .elem_id      = layout_map[offset + 1][1],
>              .aac_position = pos
>          };
> +        if ((left|right) != UINT64_MAX)
> +            *layout |= (left|right);

After taking a look at this for a second time, maybe the left and
right should be handled separately here? Although the function only
seems to be utilized with UINT64_MAX when both of the values are such,
handling them together doesn't currently break anything.

Jan


More information about the ffmpeg-devel mailing list