40 #define MAX_CHANNELS 63
59 int len, i, channel_id = 0;
63 if (sscanf(*arg,
"%7[A-Z]%n", buf, &len)) {
66 for (i = 32; i > 0; i >>= 1) {
67 if (layout >= (int64_t)1 << i) {
73 if (channel_id >=
MAX_CHANNELS || layout0 != (int64_t)1 << channel_id)
75 *rchannel = channel_id;
81 if (sscanf(*arg,
"c%d%n", &channel_id, &len) &&
83 *rchannel = channel_id;
95 sscanf(*arg,
" %n", &len);
103 int out_ch_id, in_ch_id,
len, named, ret;
104 int nb_in_channels[2] = { 0, 0 };
109 "pan filter needs a channel layout and a set "
110 "of channels definitions as parameter\n");
126 "Expected out channel name, got \"%.8s\"\n", arg);
133 "Channel \"%.8s\" does not exist in the chosen layout\n", arg0);
145 "Invalid out channel name \"%.8s\"\n", arg0);
152 }
else if (*arg ==
'<') {
157 "Syntax error after channel name in \"%.8s\"\n", arg0);
164 if (sscanf(arg,
"%lf%n *%n", &gain, &len, &len))
168 "Expected in channel name, got \"%.8s\"\n", arg);
172 nb_in_channels[named]++;
173 if (nb_in_channels[!named]) {
175 "Can not mix named and numbered channels\n");
179 pan->
gain[out_ch_id][in_ch_id] = gain;
207 double gain = pan->
gain[i][j];
211 if (gain != 0. && gain != 1.)
214 if (gain && nb_gain++)
253 char buf[1024], *cur;
274 "libswresample support a maximum of %d channels. "
275 "Feel free to ask for a higher limit.\n",
SWR_CH_MAX);
294 if (pan->
gain[i][j]) {
312 t += pan->
gain[i][j];
313 if (t > -1
E-5 && t < 1
E-5) {
317 "Degenerate coefficients while renormalizing\n");
321 pan->
gain[i][j] /= t;
336 r =
snprintf(cur, buf +
sizeof(buf) - cur,
"%s%.3g i%d",
337 j ?
" + " :
"", pan->
gain[i][j], j);
338 cur +=
FFMIN(buf +
sizeof(buf) - cur, r);