History

avfilter/af_anlms: switch to ff_filter_process_command()

Paul B Mahol committed 7 years ago

Commit 9f7ab361 parent 8fec9fc1 file · +10 −25Browse files

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

Unified · Split

libavfilter/af_anlms.c+10−25
@@ -60,17 +60,18 @@ typedef struct AudioNLMSContext { · 59 unmodified lines
60 60
61#define OFFSET(x) offsetof(AudioNLMSContext, x)61#define OFFSET(x) offsetof(AudioNLMSContext, x)
62#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM62#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
63#define AT AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
63 64
64static const AVOption anlms_options[] = {65static const AVOption anlms_options[] = {
65 { "order", "set the filter order", OFFSET(order), AV_OPT_TYPE_INT, {.i64=256}, 1, INT16_MAX, A },66 { "order", "set the filter order", OFFSET(order), AV_OPT_TYPE_INT, {.i64=256}, 1, INT16_MAX, A },
66 { "mu", "set the filter mu", OFFSET(mu), AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 2, A },67 { "mu", "set the filter mu", OFFSET(mu), AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 2, AT },
67 { "eps", "set the filter eps", OFFSET(eps), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, A },68 { "eps", "set the filter eps", OFFSET(eps), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, AT },
68 { "leakage", "set the filter leakage", OFFSET(leakage), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 1, A },69 { "leakage", "set the filter leakage", OFFSET(leakage), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 1, AT },
69 { "out_mode", "set output mode", OFFSET(output_mode), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_OMODES-1, A, "mode" },70 { "out_mode", "set output mode", OFFSET(output_mode), AV_OPT_TYPE_INT, {.i64=OUT_MODE}, 0, NB_OMODES-1, AT, "mode" },
70 { "i", "input", 0, AV_OPT_TYPE_CONST, {.i64=IN_MODE}, 0, 0, A, "mode" },71 { "i", "input", 0, AV_OPT_TYPE_CONST, {.i64=IN_MODE}, 0, 0, AT, "mode" },
71 { "d", "desired", 0, AV_OPT_TYPE_CONST, {.i64=DESIRED_MODE}, 0, 0, A, "mode" },72 { "d", "desired", 0, AV_OPT_TYPE_CONST, {.i64=DESIRED_MODE}, 0, 0, AT, "mode" },
72 { "o", "output", 0, AV_OPT_TYPE_CONST, {.i64=OUT_MODE}, 0, 0, A, "mode" },73 { "o", "output", 0, AV_OPT_TYPE_CONST, {.i64=OUT_MODE}, 0, 0, AT, "mode" },
73 { "n", "noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_MODE}, 0, 0, A, "mode" },74 { "n", "noise", 0, AV_OPT_TYPE_CONST, {.i64=NOISE_MODE}, 0, 0, AT, "mode" },
74 { NULL }75 { NULL }
75};76};
76 77
@@ -281,22 +282,6 @@ static av_cold int init(AVFilterContext *ctx) · 204 unmodified lines
281 return 0;282 return 0;
282}283}
283 284
284static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
285 char *res, int res_len, int flags)
286{
287 AudioNLMSContext *s = ctx->priv;
288 int ret;
289
290 if ( !strcmp(cmd, "mu") || !strcmp(cmd, "eps")
291 || !strcmp(cmd, "leakage") || !strcmp(cmd, "out_mode")) {
292 ret = av_opt_set(s, cmd, args, 0);
293 } else {
294 ret = AVERROR(ENOSYS);
295 }
296
297 return ret;
298}
299
300static av_cold void uninit(AVFilterContext *ctx)285static av_cold void uninit(AVFilterContext *ctx)
301{286{
302 AudioNLMSContext *s = ctx->priv;287 AudioNLMSContext *s = ctx->priv;
@@ -341,5 +326,5 @@ AVFilter ff_af_anlms = { · 38 unmodified lines
341 .inputs = inputs,326 .inputs = inputs,
342 .outputs = outputs,327 .outputs = outputs,
343 .flags = AVFILTER_FLAG_SLICE_THREADS,328 .flags = AVFILTER_FLAG_SLICE_THREADS,
344 .process_command = process_command,329 .process_command = ff_filter_process_command,
345};330};

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