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
640Set LFO rate.640Set LFO rate.
641@end table641@end table
642 642
643@subsection Commands
644
645This filter supports the all above options as @ref{commands}.
646
643@section acue647@section acue
644 648
645Delay audio filtering until a given wallclock timestamp. See the @ref{cue}649Delay 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
68} ACrusherContext;68} ACrusherContext;
69 69
70#define OFFSET(x) offsetof(ACrusherContext, x)70#define OFFSET(x) offsetof(ACrusherContext, x)
71#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM71#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
72 72
73static const AVOption acrusher_options[] = {73static const AVOption acrusher_options[] = {
74 { "level_in", "set level in", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },74 { "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
325 s->lfo.srate = inlink->sample_rate;325 s->lfo.srate = inlink->sample_rate;
326 s->lfo.amount = .5;326 s->lfo.amount = .5;
327 327
328 s->sr = av_calloc(inlink->channels, sizeof(*s->sr));328 if (!s->sr)
329 s->sr = av_calloc(inlink->channels, sizeof(*s->sr));
329 if (!s->sr)330 if (!s->sr)
330 return AVERROR(ENOMEM);331 return AVERROR(ENOMEM);
331 332
332 return 0;333 return 0;
333}334}
334 335
336static 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
335static const AVFilterPad avfilter_af_acrusher_inputs[] = {349static const AVFilterPad avfilter_af_acrusher_inputs[] = {
336 {350 {
337 .name = "default",351 .name = "default",
@@ -359,4 +373,5 @@ AVFilter ff_af_acrusher = { · 21 unmodified lines
359 .query_formats = query_formats,373 .query_formats = query_formats,
360 .inputs = avfilter_af_acrusher_inputs,374 .inputs = avfilter_af_acrusher_inputs,
361 .outputs = avfilter_af_acrusher_outputs,375 .outputs = avfilter_af_acrusher_outputs,
376 .process_command = process_command,
362};377};

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