40 #define MAX_CHANNELS 63
62 sscanf(*arg,
" %n", &len);
69 int len, i, channel_id = 0;
74 if (sscanf(*arg,
"%7[A-Z]%n", buf, &len)) {
77 for (i = 32; i > 0; i >>= 1) {
78 if (layout >= (int64_t)1 << i) {
84 if (channel_id >=
MAX_CHANNELS || layout0 != (int64_t)1 << channel_id)
86 *rchannel = channel_id;
92 if (sscanf(*arg,
"c%d%n", &channel_id, &len) &&
94 *rchannel = channel_id;
106 int out_ch_id, in_ch_id,
len, named,
ret;
107 int nb_in_channels[2] = { 0, 0 };
112 "pan filter needs a channel layout and a set "
113 "of channels definitions as parameter\n");
125 while ((arg = arg0 =
av_strtok(NULL,
"|", &tokenizer))) {
129 "Expected out channel name, got \"%.8s\"\n", arg);
136 "Channel \"%.8s\" does not exist in the chosen layout\n", arg0);
148 "Invalid out channel name \"%.8s\"\n", arg0);
155 }
else if (*arg ==
'<') {
160 "Syntax error after channel name in \"%.8s\"\n", arg0);
167 if (sscanf(arg,
"%lf%n *%n", &gain, &len, &len))
171 "Expected in channel name, got \"%.8s\"\n", arg);
175 nb_in_channels[named]++;
176 if (nb_in_channels[!named]) {
178 "Can not mix named and numbered channels\n");
182 pan->
gain[out_ch_id][in_ch_id] = gain;
210 double gain = pan->
gain[i][j];
214 if (gain != 0. && gain != 1.)
217 if (gain && nb_gain++)
256 char buf[1024], *cur;
277 "libswresample support a maximum of %d channels. "
278 "Feel free to ask for a higher limit.\n",
SWR_CH_MAX);
297 if (pan->
gain[i][j]) {
315 t += pan->
gain[i][j];
316 if (t > -1
E-5 && t < 1
E-5) {
320 "Degenerate coefficients while renormalizing\n");
324 pan->
gain[i][j] /= t;
339 r =
snprintf(cur, buf +
sizeof(buf) - cur,
"%s%.3g i%d",
340 j ?
" + " :
"", pan->
gain[i][j], j);
341 cur +=
FFMIN(buf +
sizeof(buf) - cur, r);
385 #define OFFSET(x) offsetof(PanContext, x)
417 .priv_class = &pan_class,