char *arg, *arg0, *tokenizer, *args = av_strdup(pan->args);
int out_ch_id, in_ch_id, len, named, ret, sign = 1;
int nb_in_channels[2] = { 0, 0 }; // number of unnamed and named input channels
+ int used_out_ch[MAX_CHANNELS] = {0};
double gain;
if (!pan->args) {
/* parse channel specifications */
while ((arg = arg0 = av_strtok(NULL, "|", &tokenizer))) {
+ int used_in_ch[MAX_CHANNELS] = {0};
/* channel name */
if (parse_channel_name(&arg, &out_ch_id, &named)) {
av_log(ctx, AV_LOG_ERROR,
ret = AVERROR(EINVAL);
goto fail;
}
+ if (used_out_ch[out_ch_id]) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Can not reference out channel %d twice\n", out_ch_id);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ used_out_ch[out_ch_id] = 1;
skip_spaces(&arg);
if (*arg == '=') {
arg++;
ret = AVERROR(EINVAL);
goto fail;
}
+ if (used_in_ch[in_ch_id]) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Can not reference in channel %d twice\n", in_ch_id);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ used_in_ch[in_ch_id] = 1;
pan->gain[out_ch_id][in_ch_id] = sign * gain;
skip_spaces(&arg);
if (!*arg)