Unified · Split
| @@ -104,8 +104,8 @@ static const AVOption speechnorm_options[] = { · 103 unmodified lines | ||
| 104 | 104 | { "r", "set the expansion raising amount", OFFSET(raise_amount), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0.0, 1.0, FLAGS }, |
| 105 | 105 | { "fall", "set the compression raising amount", OFFSET(fall_amount), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0.0, 1.0, FLAGS }, |
| 106 | 106 | { "f", "set the compression raising amount", OFFSET(fall_amount), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0.0, 1.0, FLAGS }, |
| 107 | − { "channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, INT64_MIN, INT64_MAX, FLAGS }, | |
| 108 | − { "h", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, INT64_MIN, INT64_MAX, FLAGS }, | |
| 107 | + { "channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS }, | |
| 108 | + { "h", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS }, | |
| 109 | 109 | { "invert", "set inverted filtering", OFFSET(invert), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, |
| 110 | 110 | { "i", "set inverted filtering", OFFSET(invert), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, |
| 111 | 111 | { "link", "set linked channels filtering", OFFSET(link), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, |
| @@ -462,6 +462,13 @@ static int activate(AVFilterContext *ctx) · 350 unmodified lines | ||
| 462 | 462 | int ret, status; |
| 463 | 463 | int64_t pts; |
| 464 | 464 | |
| 465 | + ret = av_channel_layout_copy(&s->ch_layout, &inlink->ch_layout); | |
| 466 | + if (ret < 0) | |
| 467 | + return ret; | |
| 468 | + if (strcmp(s->ch_layout_str, "all")) | |
| 469 | + av_channel_layout_from_string(&s->ch_layout, | |
| 470 | + s->ch_layout_str); | |
| 471 | + | |
| 465 | 472 | FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); |
| 466 | 473 | |
| 467 | 474 | ret = filter_frame(ctx); |
| @@ -547,18 +554,6 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar · 79 unmodified lines | ||
| 547 | 554 | return 0; |
| 548 | 555 | } |
| 549 | 556 | |
| 550 | −static av_cold int init(AVFilterContext *ctx) | |
| 551 | −{ | |
| 552 | − SpeechNormalizerContext *s = ctx->priv; | |
| 553 | − int ret; | |
| 554 | − | |
| 555 | − if (strcmp(s->ch_layout_str, "all")) | |
| 556 | − ret = av_channel_layout_from_string(&s->ch_layout, | |
| 557 | − s->ch_layout_str); | |
| 558 | − | |
| 559 | − return ret; | |
| 560 | −} | |
| 561 | − | |
| 562 | 557 | static av_cold void uninit(AVFilterContext *ctx) |
| 563 | 558 | { |
| 564 | 559 | SpeechNormalizerContext *s = ctx->priv; |
| @@ -589,7 +584,6 @@ const AVFilter ff_af_speechnorm = { · 24 unmodified lines | ||
| 589 | 584 | .priv_size = sizeof(SpeechNormalizerContext), |
| 590 | 585 | .priv_class = &speechnorm_class, |
| 591 | 586 | .activate = activate, |
| 592 | − .init = init, | |
| 593 | 587 | .uninit = uninit, |
| 594 | 588 | FILTER_INPUTS(inputs), |
| 595 | 589 | FILTER_OUTPUTS(outputs), |