Showing the changes to libavfilter (1 of 2 files). Show all
Unified · Split
| @@ -57,7 +57,7 @@ typedef struct StereoToolsContext { · 56 unmodified lines | ||
| 57 | 57 | } StereoToolsContext; |
| 58 | 58 | |
| 59 | 59 | #define OFFSET(x) offsetof(StereoToolsContext, x) |
| 60 | −#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM | |
| 60 | +#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM | |
| 61 | 61 | |
| 62 | 62 | static const AVOption stereotools_options[] = { |
| 63 | 63 | { "level_in", "set level in", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A }, |
| @@ -120,12 +120,9 @@ static int config_input(AVFilterLink *inlink) · 56 unmodified lines | ||
| 120 | 120 | AVFilterContext *ctx = inlink->dst; |
| 121 | 121 | StereoToolsContext *s = ctx->priv; |
| 122 | 122 | |
| 123 | − s->length = 2 * inlink->sample_rate * 0.05; | |
| 124 | − if (s->length <= 1 || s->length & 1) { | |
| 125 | − av_log(ctx, AV_LOG_ERROR, "sample rate is too small\n"); | |
| 126 | − return AVERROR(EINVAL); | |
| 127 | − } | |
| 128 | − s->buffer = av_calloc(s->length, sizeof(*s->buffer)); | |
| 123 | + s->length = FFALIGN(inlink->sample_rate / 10, 2); | |
| 124 | + if (!s->buffer) | |
| 125 | + s->buffer = av_calloc(s->length, sizeof(*s->buffer)); | |
| 129 | 126 | if (!s->buffer) |
| 130 | 127 | return AVERROR(ENOMEM); |
| 131 | 128 | |
| @@ -341,6 +338,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 209 unmodified lines | ||
| 341 | 338 | return ff_filter_frame(outlink, out); |
| 342 | 339 | } |
| 343 | 340 | |
| 341 | +static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, | |
| 342 | + char *res, int res_len, int flags) | |
| 343 | +{ | |
| 344 | + int ret; | |
| 345 | + | |
| 346 | + ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags); | |
| 347 | + if (ret < 0) | |
| 348 | + return ret; | |
| 349 | + | |
| 350 | + return config_input(ctx->inputs[0]); | |
| 351 | +} | |
| 352 | + | |
| 344 | 353 | static av_cold void uninit(AVFilterContext *ctx) |
| 345 | 354 | { |
| 346 | 355 | StereoToolsContext *s = ctx->priv; |
| @@ -375,5 +384,6 @@ AVFilter ff_af_stereotools = { · 28 unmodified lines | ||
| 375 | 384 | .uninit = uninit, |
| 376 | 385 | .inputs = inputs, |
| 377 | 386 | .outputs = outputs, |
| 387 | + .process_command = process_command, | |
| 378 | 388 | .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, |
| 379 | 389 | }; |