History

avfilter/af_acrusher: add commands support

Paul B Mahol committed 5 years ago

Commit 54de7dc1 parent 633e3442 files · +21 −2Browse files

Unified · Split

2 files
  1. doc/filters.texi +4 −0
  2. libavfilter/af_acrusher.c +17 −2
doc/filters.texi+4−0
@@ -640,6 +640,10 @@ Set LFO range. · 639 unmodified lines
640640 Set LFO rate.
641641 @end table
642642
643+@subsection Commands
644+
645+This filter supports the all above options as @ref{commands}.
646+
643647 @section acue
644648
645649 Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
libavfilter/af_acrusher.c+17−2
@@ -68,7 +68,7 @@ typedef struct ACrusherContext { · 67 unmodified lines
6868 } ACrusherContext;
6969
7070 #define OFFSET(x) offsetof(ACrusherContext, x)
71−#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
71+#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
7272
7373 static const AVOption acrusher_options[] = {
7474 { "level_in", "set level in", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
@@ -325,13 +325,27 @@ static int config_input(AVFilterLink *inlink) · 250 unmodified lines
325325 s->lfo.srate = inlink->sample_rate;
326326 s->lfo.amount = .5;
327327
328− s->sr = av_calloc(inlink->channels, sizeof(*s->sr));
328+ if (!s->sr)
329+ s->sr = av_calloc(inlink->channels, sizeof(*s->sr));
329330 if (!s->sr)
330331 return AVERROR(ENOMEM);
331332
332333 return 0;
333334 }
334335
336+static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
337+ char *res, int res_len, int flags)
338+{
339+ AVFilterLink *inlink = ctx->inputs[0];
340+ int ret;
341+
342+ ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
343+ if (ret < 0)
344+ return ret;
345+
346+ return config_input(inlink);
347+}
348+
335349 static const AVFilterPad avfilter_af_acrusher_inputs[] = {
336350 {
337351 .name = "default",
@@ -359,4 +373,5 @@ AVFilter ff_af_acrusher = { · 21 unmodified lines
359373 .query_formats = query_formats,
360374 .inputs = avfilter_af_acrusher_inputs,
361375 .outputs = avfilter_af_acrusher_outputs,
376+ .process_command = process_command,
362377 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t