summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-05-26 20:08:50 +0200
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-05-26 20:08:50 +0200
commit4481f4b62a356aee64364101e8f254fdaf7ad028 (patch)
treefc71bc3d0fbf461c1b96b30376d6702c59e0c24b
parent8096fa45a71f0f1cbc93881e3e5733a4e697d75b (diff)
vidfilt: make the API re-entrant
-rw-r--r--include/baresip.h4
-rw-r--r--modules/selfview/selfview.c4
-rw-r--r--modules/snapshot/snapshot.c2
-rw-r--r--modules/swscale/swscale.c2
-rw-r--r--modules/vidinfo/vidinfo.c2
-rw-r--r--modules/vidloop/vidloop.c2
-rw-r--r--src/baresip.c8
-rw-r--r--src/conf.c2
-rw-r--r--src/video.c4
-rw-r--r--src/vidfilt.c21
10 files changed, 23 insertions, 28 deletions
diff --git a/include/baresip.h b/include/baresip.h
index 7048a01..ec7dafa 100644
--- a/include/baresip.h
+++ b/include/baresip.h
@@ -930,9 +930,8 @@ struct vidfilt {
vidfilt_decode_h *dech;
};
-void vidfilt_register(struct vidfilt *vf);
+void vidfilt_register(struct list *vidfiltl, struct vidfilt *vf);
void vidfilt_unregister(struct vidfilt *vf);
-struct list *vidfilt_list(void);
int vidfilt_enc_append(struct list *filtl, void **ctx,
const struct vidfilt *vf);
int vidfilt_dec_append(struct list *filtl, void **ctx,
@@ -1145,6 +1144,7 @@ struct list *baresip_aufiltl(void);
struct list *baresip_vidcodecl(void);
struct list *baresip_vidsrcl(void);
struct list *baresip_vidispl(void);
+struct list *baresip_vidfiltl(void);
#ifdef __cplusplus
diff --git a/modules/selfview/selfview.c b/modules/selfview/selfview.c
index af27b1a..5cc1bed 100644
--- a/modules/selfview/selfview.c
+++ b/modules/selfview/selfview.c
@@ -254,9 +254,9 @@ static int module_init(void)
(void)conf_get(conf_cur(), "video_selfview", &pl);
if (0 == pl_strcasecmp(&pl, "window"))
- vidfilt_register(&selfview_win);
+ vidfilt_register(baresip_vidfiltl(), &selfview_win);
else if (0 == pl_strcasecmp(&pl, "pip"))
- vidfilt_register(&selfview_pip);
+ vidfilt_register(baresip_vidfiltl(), &selfview_pip);
(void)conf_get_vidsz(conf_cur(), "selfview_size", &selfview_size);
diff --git a/modules/snapshot/snapshot.c b/modules/snapshot/snapshot.c
index 6878792..4dd5735 100644
--- a/modules/snapshot/snapshot.c
+++ b/modules/snapshot/snapshot.c
@@ -83,7 +83,7 @@ static const struct cmd cmdv[] = {
static int module_init(void)
{
- vidfilt_register(&snapshot);
+ vidfilt_register(baresip_vidfiltl(), &snapshot);
return cmd_register(baresip_commands(), cmdv, ARRAY_SIZE(cmdv));
}
diff --git a/modules/swscale/swscale.c b/modules/swscale/swscale.c
index 7c26c63..5cd8905 100644
--- a/modules/swscale/swscale.c
+++ b/modules/swscale/swscale.c
@@ -177,7 +177,7 @@ static struct vidfilt vf_swscale = {
static int module_init(void)
{
- vidfilt_register(&vf_swscale);
+ vidfilt_register(baresip_vidfiltl(), &vf_swscale);
return 0;
}
diff --git a/modules/vidinfo/vidinfo.c b/modules/vidinfo/vidinfo.c
index 601d387..f460a2d 100644
--- a/modules/vidinfo/vidinfo.c
+++ b/modules/vidinfo/vidinfo.c
@@ -155,7 +155,7 @@ static struct vidfilt vidinfo = {
static int module_init(void)
{
- vidfilt_register(&vidinfo);
+ vidfilt_register(baresip_vidfiltl(), &vidinfo);
return 0;
}
diff --git a/modules/vidloop/vidloop.c b/modules/vidloop/vidloop.c
index 21f4ea1..3150b90 100644
--- a/modules/vidloop/vidloop.c
+++ b/modules/vidloop/vidloop.c
@@ -374,7 +374,7 @@ static int video_loop_alloc(struct video_loop **vlp, const struct vidsz *size)
tmr_init(&vl->tmr_bw);
/* 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;
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;