From fa3208e3a1e09131885ba42cef537f1e4a17bbaa Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Wed, 22 Mar 2017 15:56:48 +0100 Subject: aufilt: make the API re-entrant --- src/audio.c | 4 ++-- src/aufilt.c | 15 +++------------ src/baresip.c | 7 +++++++ src/conf.c | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/audio.c b/src/audio.c index ddd83ef..1a89fec 100644 --- a/src/audio.c +++ b/src/audio.c @@ -907,7 +907,7 @@ static int aufilt_setup(struct audio *a) aufilt_param_set(&decprm, rx->ac, rx->ptime); /* Audio filters */ - for (le = list_head(aufilt_list()); le; le = le->next) { + for (le = list_head(baresip_aufiltl()); le; le = le->next) { struct aufilt *af = le->data; struct aufilt_enc_st *encst = NULL; struct aufilt_dec_st *decst = NULL; @@ -1138,7 +1138,7 @@ int audio_start(struct audio *a) return EINVAL; /* Audio filter */ - if (!list_isempty(aufilt_list())) { + if (!list_isempty(baresip_aufiltl())) { err = aufilt_setup(a); if (err) return err; diff --git a/src/aufilt.c b/src/aufilt.c index c749aaf..240edee 100644 --- a/src/aufilt.c +++ b/src/aufilt.c @@ -8,15 +8,12 @@ #include "core.h" -static struct list afl; - - -void aufilt_register(struct aufilt *af) +void aufilt_register(struct list *aufiltl, struct aufilt *af) { - if (!af) + if (!aufiltl || !af) return; - list_append(&afl, &af->le, af); + list_append(aufiltl, &af->le, af); info("aufilt: %s\n", af->name); } @@ -29,9 +26,3 @@ void aufilt_unregister(struct aufilt *af) list_unlink(&af->le); } - - -struct list *aufilt_list(void) -{ - return &afl; -} diff --git a/src/baresip.c b/src/baresip.c index 501fbe1..dbed532 100644 --- a/src/baresip.c +++ b/src/baresip.c @@ -23,6 +23,7 @@ static struct baresip { struct list aucodecl; struct list ausrcl; struct list auplayl; + struct list aufiltl; } baresip; @@ -145,3 +146,9 @@ struct list *baresip_auplayl(void) { return &baresip.auplayl; } + + +struct list *baresip_aufiltl(void) +{ + return &baresip.aufiltl; +} diff --git a/src/conf.c b/src/conf.c index 27d4be3..9a85c5d 100644 --- a/src/conf.c +++ b/src/conf.c @@ -353,7 +353,7 @@ int conf_modules(void) } print_populated("audio codec", list_count(baresip_aucodecl())); - print_populated("audio filter", list_count(aufilt_list())); + print_populated("audio filter", list_count(baresip_aufiltl())); #ifdef USE_VIDEO print_populated("video codec", list_count(vidcodec_list())); print_populated("video filter", list_count(vidfilt_list())); -- cgit v1.2.3