Showing the changes to libavfilter (1 of 2 files). Show all
Unified · Split
| @@ -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_PARAM | 71 | #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM |
| 72 | 72 | ||
| 73 | static const AVOption acrusher_options[] = { | 73 | static 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 | ||
| 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 | |||
| 335 | static const AVFilterPad avfilter_af_acrusher_inputs[] = { | 349 | static 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 | }; |