History

avfilter/af_speechnorm: fix regression in channels option processing

Paul B Mahol committed 4 years ago

Commit 07c16cd1 parent bd5da8a1 file · +9 −15Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/af_speechnorm.c+9−15
@@ -104,8 +104,8 @@ static const AVOption speechnorm_options[] = { · 103 unmodified lines
104 { "r", "set the expansion raising amount", OFFSET(raise_amount), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0.0, 1.0, FLAGS },104 { "r", "set the expansion raising amount", OFFSET(raise_amount), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0.0, 1.0, FLAGS },
105 { "fall", "set the compression raising amount", OFFSET(fall_amount), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0.0, 1.0, FLAGS },105 { "fall", "set the compression raising amount", OFFSET(fall_amount), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0.0, 1.0, FLAGS },
106 { "f", "set the compression raising amount", OFFSET(fall_amount), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0.0, 1.0, FLAGS },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 },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"}, INT64_MIN, INT64_MAX, FLAGS },108 { "h", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS },
109 { "invert", "set inverted filtering", OFFSET(invert), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },109 { "invert", "set inverted filtering", OFFSET(invert), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
110 { "i", "set inverted filtering", OFFSET(invert), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },110 { "i", "set inverted filtering", OFFSET(invert), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
111 { "link", "set linked channels filtering", OFFSET(link), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },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 int ret, status;462 int ret, status;
463 int64_t pts;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 FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);472 FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
466 473
467 ret = filter_frame(ctx);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 return 0;554 return 0;
548}555}
549 556
550static 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
562static av_cold void uninit(AVFilterContext *ctx)557static av_cold void uninit(AVFilterContext *ctx)
563{558{
564 SpeechNormalizerContext *s = ctx->priv;559 SpeechNormalizerContext *s = ctx->priv;
@@ -589,7 +584,6 @@ const AVFilter ff_af_speechnorm = { · 24 unmodified lines
589 .priv_size = sizeof(SpeechNormalizerContext),584 .priv_size = sizeof(SpeechNormalizerContext),
590 .priv_class = &speechnorm_class,585 .priv_class = &speechnorm_class,
591 .activate = activate,586 .activate = activate,
592 .init = init,
593 .uninit = uninit,587 .uninit = uninit,
594 FILTER_INPUTS(inputs),588 FILTER_INPUTS(inputs),
595 FILTER_OUTPUTS(outputs),589 FILTER_OUTPUTS(outputs),

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