[FFmpeg-devel] [PATCH 275/281] avfilter: convert to new channel layout API

James Almer jamrial at gmail.com
Tue Feb 15 14:27:37 EET 2022


On 2/15/2022 8:50 AM, Anton Khirnov wrote:
> Quoting James Almer (2022-01-13 03:09:07)
>> @@ -212,31 +212,31 @@ static int config_input(AVFilterLink *inlink)
>>           return AVERROR(ENOMEM);
>>       for (ch = 0;  ch < s->nb_in_channels; ch++)
>>           s->input_levels[ch] = s->level_in;
>> -    ch = av_get_channel_layout_channel_index(inlink->channel_layout, AV_CH_FRONT_CENTER);
>> +    ch = av_channel_layout_index_from_channel(&inlink->ch_layout, AV_CHAN_FRONT_CENTER);
>>       if (ch >= 0)
>>           s->input_levels[ch] *= s->fc_in;
>> -    ch = av_get_channel_layout_channel_index(inlink->channel_layout, AV_CH_FRONT_LEFT);
>> +    ch = av_channel_layout_index_from_channel(&inlink->ch_layout, AV_CHAN_FRONT_LEFT);
>>       if (ch >= 0)
>>           s->input_levels[ch] *= s->fl_in;
>> -    ch = av_get_channel_layout_channel_index(inlink->channel_layout, AV_CH_FRONT_RIGHT);
>> +    ch = av_channel_layout_index_from_channel(&inlink->ch_layout, AV_CHAN_FRONT_RIGHT);
>>       if (ch >= 0)
>>           s->input_levels[ch] *= s->fr_in;
>> -    ch = av_get_channel_layout_channel_index(inlink->channel_layout, AV_CH_SIDE_LEFT);
>> +    ch = av_channel_layout_index_from_channel(&inlink->ch_layout, AV_CHAN_SIDE_LEFT);
>>       if (ch >= 0)
>>           s->input_levels[ch] *= s->sl_in;
>> -    ch = av_get_channel_layout_channel_index(inlink->channel_layout, AV_CH_SIDE_RIGHT);
>> +    ch = av_channel_layout_index_from_channel(&inlink->ch_layout, AV_CHAN_SIDE_RIGHT);
>>       if (ch >= 0)
>>           s->input_levels[ch] *= s->sr_in;
>> -    ch = av_get_channel_layout_channel_index(inlink->channel_layout, AV_CH_BACK_LEFT);
>> +    ch = av_channel_layout_index_from_channel(&inlink->ch_layout, AV_CHAN_BACK_LEFT);
>>       if (ch >= 0)
>>           s->input_levels[ch] *= s->bl_in;
>> -    ch = av_get_channel_layout_channel_index(inlink->channel_layout, AV_CH_BACK_RIGHT);
>> +    ch = av_channel_layout_index_from_channel(&inlink->ch_layout, AV_CHAN_BACK_RIGHT);
>>       if (ch >= 0)
>>           s->input_levels[ch] *= s->br_in;
>> -    ch = av_get_channel_layout_channel_index(inlink->channel_layout, AV_CH_BACK_CENTER);
>> +    ch = av_channel_layout_index_from_channel(&inlink->ch_layout, AV_CHAN_BACK_CENTER);
>>       if (ch >= 0)
>>           s->input_levels[ch] *= s->bc_in;
>> -    ch = av_get_channel_layout_channel_index(inlink->channel_layout, AV_CH_LOW_FREQUENCY);
>> +    ch = av_channel_layout_index_from_channel(&inlink->ch_layout, AV_CHAN_LOW_FREQUENCY);
>>       if (ch >= 0)
> 
> Make all those compare to AV_CHAN_NONE

ch is an index, so either >= 0, or EINVAL.


More information about the ffmpeg-devel mailing list