From 4481f4b62a356aee64364101e8f254fdaf7ad028 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Fri, 26 May 2017 20:08:50 +0200 Subject: vidfilt: make the API re-entrant --- src/baresip.c | 8 ++++++++ src/conf.c | 2 +- src/video.c | 4 ++-- src/vidfilt.c | 21 ++++----------------- 4 files changed, 15 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/baresip.c b/src/baresip.c index 5484f77..2d63287 100644 --- a/src/baresip.c +++ b/src/baresip.c @@ -27,6 +27,7 @@ static struct baresip { struct list vidcodecl; struct list vidsrcl; struct list vidispl; + struct list vidfiltl; } baresip; @@ -47,6 +48,7 @@ int baresip_init(struct config *cfg, bool prefer_ipv6) list_init(&baresip.vidcodecl); list_init(&baresip.vidsrcl); list_init(&baresip.vidispl); + list_init(&baresip.vidfiltl); /* Initialise Network */ err = net_alloc(&baresip.net, &cfg->net, @@ -176,3 +178,9 @@ struct list *baresip_vidispl(void) { return &baresip.vidispl; } + + +struct list *baresip_vidfiltl(void) +{ + return &baresip.vidfiltl; +} diff --git a/src/conf.c b/src/conf.c index 7f7441b..e2e89f4 100644 --- a/src/conf.c +++ b/src/conf.c @@ -356,7 +356,7 @@ int conf_modules(void) print_populated("audio filter", list_count(baresip_aufiltl())); #ifdef USE_VIDEO print_populated("video codec", list_count(baresip_vidcodecl())); - print_populated("video filter", list_count(vidfilt_list())); + print_populated("video filter", list_count(baresip_vidfiltl())); #endif out: diff --git a/src/video.c b/src/video.c index 9e767d0..9077a0c 100644 --- a/src/video.c +++ b/src/video.c @@ -825,7 +825,7 @@ int video_alloc(struct video **vp, const struct config *cfg, } /* Video filters */ - for (le = list_head(vidfilt_list()); le; le = le->next) { + for (le = list_head(baresip_vidfiltl()); le; le = le->next) { struct vidfilt *vf = le->data; void *ctx = NULL; @@ -1290,7 +1290,7 @@ int video_debug(struct re_printf *pf, const struct video *v) err |= re_hprintf(pf, " n_intra=%u, n_picup=%u\n", vrx->n_intra, vrx->n_picup); - if (!list_isempty(vidfilt_list())) { + if (!list_isempty(baresip_vidfiltl())) { err |= vtx_print_pipeline(pf, vtx); err |= vrx_print_pipeline(pf, vrx); } diff --git a/src/vidfilt.c b/src/vidfilt.c index a8d8426..c55a1e5 100644 --- a/src/vidfilt.c +++ b/src/vidfilt.c @@ -8,20 +8,18 @@ #include "core.h" -static struct list vfl; - - /** * Register a new Video Filter * - * @param vf Video Filter to register + * @param vidfiltl List of Video-Filters + * @param vf Video Filter to register */ -void vidfilt_register(struct vidfilt *vf) +void vidfilt_register(struct list *vidfiltl, struct vidfilt *vf) { if (!vf) return; - list_append(&vfl, &vf->le, vf); + list_append(vidfiltl, &vf->le, vf); info("vidfilt: %s\n", vf->name); } @@ -41,17 +39,6 @@ void vidfilt_unregister(struct vidfilt *vf) } -/** - * Get the list of registered Video Filters - * - * @return List of Video Filters - */ -struct list *vidfilt_list(void) -{ - return &vfl; -} - - static void vidfilt_enc_destructor(void *arg) { struct vidfilt_enc_st *st = arg; -- cgit v1.2.3