... | ... |
@@ -513,6 +513,7 @@ Set list of delays in milliseconds for each channel separated by '|'. |
513 | 513 |
At least one delay greater than 0 should be provided. |
514 | 514 |
Unused delays will be silently ignored. If number of given delays is |
515 | 515 |
smaller than number of channels all remaining channels will not be delayed. |
516 |
+If you want to delay exact number of samples, append 'S' to number. |
|
516 | 517 |
@end table |
517 | 518 |
|
518 | 519 |
@subsection Examples |
... | ... |
@@ -524,6 +525,13 @@ the second channel (and any other channels that may be present) unchanged. |
524 | 524 |
@example |
525 | 525 |
adelay=1500|0|500 |
526 | 526 |
@end example |
527 |
+ |
|
528 |
+@item |
|
529 |
+Delay second channel by 500 samples, the third channel by 700 samples and leave |
|
530 |
+the first channel (and any other channels that may be present) unchanged. |
|
531 |
+@example |
|
532 |
+adelay=0|500S|700S |
|
533 |
+@end example |
|
527 | 534 |
@end itemize |
528 | 535 |
|
529 | 536 |
@section aecho |
... | ... |
@@ -138,14 +138,20 @@ static int config_input(AVFilterLink *inlink) |
138 | 138 |
for (i = 0; i < s->nb_delays; i++) { |
139 | 139 |
ChanDelay *d = &s->chandelay[i]; |
140 | 140 |
float delay; |
141 |
+ char type = 0; |
|
142 |
+ int ret; |
|
141 | 143 |
|
142 | 144 |
if (!(arg = av_strtok(p, "|", &saveptr))) |
143 | 145 |
break; |
144 | 146 |
|
145 | 147 |
p = NULL; |
146 |
- sscanf(arg, "%f", &delay); |
|
147 | 148 |
|
148 |
- d->delay = delay * inlink->sample_rate / 1000.0; |
|
149 |
+ ret = sscanf(arg, "%d%c", &d->delay, &type); |
|
150 |
+ if (ret != 2 || type != 'S') { |
|
151 |
+ sscanf(arg, "%f", &delay); |
|
152 |
+ d->delay = delay * inlink->sample_rate / 1000.0; |
|
153 |
+ } |
|
154 |
+ |
|
149 | 155 |
if (d->delay < 0) { |
150 | 156 |
av_log(ctx, AV_LOG_ERROR, "Delay must be non negative number.\n"); |
151 | 157 |
return AVERROR(EINVAL); |