[FFmpeg-cvslog] avfilter/af_adelay: add option which changes how unset channels are delayed
Paul B Mahol
git at videolan.org
Mon Oct 7 19:11:28 EEST 2019
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Oct 7 18:02:50 2019 +0200| [0633d87ae6e6a63669d0877aac5a12c22778b0e8] | committer: Paul B Mahol
avfilter/af_adelay: add option which changes how unset channels are delayed
Fixes #8032.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0633d87ae6e6a63669d0877aac5a12c22778b0e8
---
doc/filters.texi | 10 ++++++++++
libavfilter/af_adelay.c | 7 +++++++
2 files changed, 17 insertions(+)
diff --git a/doc/filters.texi b/doc/filters.texi
index accea99182..0e72cce829 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -688,6 +688,10 @@ Unused delays will be silently ignored. If number of given delays is
smaller than number of channels all remaining channels will not be delayed.
If you want to delay exact number of samples, append 'S' to number.
If you want instead to delay in seconds, append 's' to number.
+
+ at item all
+Use last set delay for all remaining channels. By default is disabled.
+This option if enabled changes how option @code{delays} is interpreted.
@end table
@subsection Examples
@@ -706,6 +710,12 @@ the first channel (and any other channels that may be present) unchanged.
@example
adelay=0|500S|700S
@end example
+
+ at item
+Delay all channels by same number of samples:
+ at example
+adelay=delays=64S:all=1
+ at end example
@end itemize
@section aderivative, aintegral
diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c
index eb97039566..06e39fa6a4 100644
--- a/libavfilter/af_adelay.c
+++ b/libavfilter/af_adelay.c
@@ -36,6 +36,7 @@ typedef struct ChanDelay {
typedef struct AudioDelayContext {
const AVClass *class;
+ int all;
char *delays;
ChanDelay *chandelay;
int nb_delays;
@@ -54,6 +55,7 @@ typedef struct AudioDelayContext {
static const AVOption adelay_options[] = {
{ "delays", "set list of delays for each channel", OFFSET(delays), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, A },
+ { "all", "use last available delay for remained channels", OFFSET(all), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, A },
{ NULL }
};
@@ -163,6 +165,11 @@ static int config_input(AVFilterLink *inlink)
}
}
+ if (s->all) {
+ for (int j = i + 1; j < s->nb_delays; j++)
+ s->chandelay[j].delay = s->chandelay[i].delay;
+ }
+
s->padding = s->chandelay[0].delay;
for (i = 1; i < s->nb_delays; i++) {
ChanDelay *d = &s->chandelay[i];
More information about the ffmpeg-cvslog
mailing list