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
104104 { "r", "set the expansion raising amount", OFFSET(raise_amount), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0.0, 1.0, FLAGS },
105105 { "fall", "set the compression raising amount", OFFSET(fall_amount), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0.0, 1.0, FLAGS },
106106 { "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 },
109109 { "invert", "set inverted filtering", OFFSET(invert), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
110110 { "i", "set inverted filtering", OFFSET(invert), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
111111 { "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
462462 int ret, status;
463463 int64_t pts;
464464
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+
465472 FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
466473
467474 ret = filter_frame(ctx);
@@ -547,18 +554,6 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar · 79 unmodified lines
547554 return 0;
548555 }
549556
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−
562557 static av_cold void uninit(AVFilterContext *ctx)
563558 {
564559 SpeechNormalizerContext *s = ctx->priv;
@@ -589,7 +584,6 @@ const AVFilter ff_af_speechnorm = { · 24 unmodified lines
589584 .priv_size = sizeof(SpeechNormalizerContext),
590585 .priv_class = &speechnorm_class,
591586 .activate = activate,
592− .init = init,
593587 .uninit = uninit,
594588 FILTER_INPUTS(inputs),
595589 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