diff options
-rw-r--r-- | include/baresip.h | 8 | ||||
-rw-r--r-- | modules/directfb/directfb.c | 3 | ||||
-rw-r--r-- | modules/directfb/module.mk | 3 | ||||
-rw-r--r-- | modules/fakevideo/fakevideo.c | 3 | ||||
-rw-r--r-- | modules/omx/module.c | 2 | ||||
-rw-r--r-- | modules/opengl/opengl.m | 3 | ||||
-rw-r--r-- | modules/opengles/opengles.c | 3 | ||||
-rw-r--r-- | modules/sdl/sdl.c | 3 | ||||
-rw-r--r-- | modules/sdl2/sdl.c | 3 | ||||
-rw-r--r-- | modules/selfview/selfview.c | 3 | ||||
-rw-r--r-- | modules/vidbridge/vidbridge.c | 3 | ||||
-rw-r--r-- | modules/vidloop/vidloop.c | 3 | ||||
-rw-r--r-- | modules/x11/x11.c | 3 | ||||
-rw-r--r-- | src/baresip.c | 8 | ||||
-rw-r--r-- | src/call.c | 2 | ||||
-rw-r--r-- | src/video.c | 5 | ||||
-rw-r--r-- | src/vidisp.c | 20 | ||||
-rw-r--r-- | test/mock/mock_vidisp.c | 2 |
18 files changed, 51 insertions, 29 deletions
diff --git a/include/baresip.h b/include/baresip.h index 8f10cb6..7048a01 100644 --- a/include/baresip.h +++ b/include/baresip.h @@ -776,15 +776,16 @@ typedef int (vidisp_disp_h)(struct vidisp_st *st, const char *title, const struct vidframe *frame); typedef void (vidisp_hide_h)(struct vidisp_st *st); -int vidisp_register(struct vidisp **vp, const char *name, +int vidisp_register(struct vidisp **vp, struct list *vidispl, const char *name, vidisp_alloc_h *alloch, vidisp_update_h *updateh, vidisp_disp_h *disph, vidisp_hide_h *hideh); -int vidisp_alloc(struct vidisp_st **stp, const char *name, +int vidisp_alloc(struct vidisp_st **stp, struct list *vidispl, + const char *name, struct vidisp_prm *prm, const char *dev, vidisp_resize_h *resizeh, void *arg); int vidisp_display(struct vidisp_st *st, const char *title, const struct vidframe *frame); -const struct vidisp *vidisp_find(const char *name); +const struct vidisp *vidisp_find(const struct list *vidispl, const char *name); /* @@ -1143,6 +1144,7 @@ struct list *baresip_auplayl(void); struct list *baresip_aufiltl(void); struct list *baresip_vidcodecl(void); struct list *baresip_vidsrcl(void); +struct list *baresip_vidispl(void); #ifdef __cplusplus diff --git a/modules/directfb/directfb.c b/modules/directfb/directfb.c index 4d3b83f..0dfb122 100644 --- a/modules/directfb/directfb.c +++ b/modules/directfb/directfb.c @@ -160,7 +160,8 @@ static int module_init(void) return (int) ret; } - err = vidisp_register(&vid, "directfb", alloc, NULL, display, hide); + err = vidisp_register(&vid, baresip_vidispl(), + "directfb", alloc, NULL, display, hide); if (err) return err; diff --git a/modules/directfb/module.mk b/modules/directfb/module.mk index daafe15..57fa045 100644 --- a/modules/directfb/module.mk +++ b/modules/directfb/module.mk @@ -8,6 +8,7 @@ MOD := directfb $(MOD)_SRCS += directfb.c $(MOD)_LFLAGS += $(shell pkg-config --libs directfb) -$(MOD)_CFLAGS += $(shell pkg-config --cflags directfb) +$(MOD)_CFLAGS += $(shell pkg-config --cflags directfb \ + | sed -e 's/-I/-isystem/g') include mk/mod.mk diff --git a/modules/fakevideo/fakevideo.c b/modules/fakevideo/fakevideo.c index 4fbc9ea..e0552d6 100644 --- a/modules/fakevideo/fakevideo.c +++ b/modules/fakevideo/fakevideo.c @@ -176,7 +176,8 @@ static int module_init(void) int err = 0; err |= vidsrc_register(&vidsrc, baresip_vidsrcl(), "fakevideo", src_alloc, NULL); - err |= vidisp_register(&vidisp, "fakevideo", disp_alloc, NULL, + err |= vidisp_register(&vidisp, baresip_vidispl(), + "fakevideo", disp_alloc, NULL, display, NULL); return err; } diff --git a/modules/omx/module.c b/modules/omx/module.c index eaf2340..e9bd590 100644 --- a/modules/omx/module.c +++ b/modules/omx/module.c @@ -115,7 +115,7 @@ static int module_init(void) return ENODEV; } - return vidisp_register(&vid, "omx", + return vidisp_register(&vid, baresip_vidispl(), "omx", omx_vidisp_alloc, NULL, omx_vidisp_display, NULL); } diff --git a/modules/opengl/opengl.m b/modules/opengl/opengl.m index 21c8aaf..a95649c 100644 --- a/modules/opengl/opengl.m +++ b/modules/opengl/opengl.m @@ -509,7 +509,8 @@ static int module_init(void) if (!app) return ENOSYS; - err = vidisp_register(&vid, "opengl", alloc, NULL, display, hide); + err = vidisp_register(&vid, baresip_vidispl(), + "opengl", alloc, NULL, display, hide); if (err) return err; diff --git a/modules/opengles/opengles.c b/modules/opengles/opengles.c index 712f868..1284de8 100644 --- a/modules/opengles/opengles.c +++ b/modules/opengles/opengles.c @@ -275,7 +275,8 @@ static int opengles_display(struct vidisp_st *st, const char *title, static int module_init(void) { - return vidisp_register(&vid, "opengles", opengles_alloc, NULL, + return vidisp_register(&vid, baresip_vidispl(), + "opengles", opengles_alloc, NULL, opengles_display, NULL); } diff --git a/modules/sdl/sdl.c b/modules/sdl/sdl.c index 3ef4cf6..c9f6b76 100644 --- a/modules/sdl/sdl.c +++ b/modules/sdl/sdl.c @@ -306,7 +306,8 @@ static int display(struct vidisp_st *st, const char *title, static int module_init(void) { - return vidisp_register(&vid, "sdl", alloc, NULL, display, NULL); + return vidisp_register(&vid, baresip_vidispl(), + "sdl", alloc, NULL, display, NULL); } diff --git a/modules/sdl2/sdl.c b/modules/sdl2/sdl.c index 498f1fa..aefe0ca 100644 --- a/modules/sdl2/sdl.c +++ b/modules/sdl2/sdl.c @@ -269,7 +269,8 @@ static int module_init(void) return ENODEV; } - err = vidisp_register(&vid, "sdl2", alloc, NULL, display, hide); + err = vidisp_register(&vid, baresip_vidispl(), + "sdl2", alloc, NULL, display, hide); if (err) return err; diff --git a/modules/selfview/selfview.c b/modules/selfview/selfview.c index 77f0b81..af27b1a 100644 --- a/modules/selfview/selfview.c +++ b/modules/selfview/selfview.c @@ -162,7 +162,8 @@ static int encode_win(struct vidfilt_enc_st *st, struct vidframe *frame) if (!enc->disp) { - err = vidisp_alloc(&enc->disp, NULL, NULL, NULL, NULL, NULL); + err = vidisp_alloc(&enc->disp, baresip_vidispl(), + NULL, NULL, NULL, NULL, NULL); if (err) return err; } diff --git a/modules/vidbridge/vidbridge.c b/modules/vidbridge/vidbridge.c index 95d0a4e..557e175 100644 --- a/modules/vidbridge/vidbridge.c +++ b/modules/vidbridge/vidbridge.c @@ -43,7 +43,8 @@ static int module_init(void) if (err) return err; - err = vidisp_register(&vidisp, "vidbridge", vidbridge_disp_alloc, + err = vidisp_register(&vidisp, baresip_vidispl(), + "vidbridge", vidbridge_disp_alloc, NULL, vidbridge_disp_display, 0); if (err) return err; diff --git a/modules/vidloop/vidloop.c b/modules/vidloop/vidloop.c index 090c440..21f4ea1 100644 --- a/modules/vidloop/vidloop.c +++ b/modules/vidloop/vidloop.c @@ -394,7 +394,8 @@ static int video_loop_alloc(struct video_loop **vlp, const struct vidsz *size) info("vidloop: open video display (%s.%s)\n", vl->cfg.disp_mod, vl->cfg.disp_dev); - err = vidisp_alloc(&vl->vidisp, vl->cfg.disp_mod, NULL, + err = vidisp_alloc(&vl->vidisp, baresip_vidispl(), + vl->cfg.disp_mod, NULL, vl->cfg.disp_dev, NULL, vl); if (err) { warning("vidloop: video display failed: %m\n", err); diff --git a/modules/x11/x11.c b/modules/x11/x11.c index c2d2346..eafb0d6 100644 --- a/modules/x11/x11.c +++ b/modules/x11/x11.c @@ -431,7 +431,8 @@ static void hide(struct vidisp_st *st) static int module_init(void) { - return vidisp_register(&vid, "x11", alloc, NULL, display, hide); + return vidisp_register(&vid, baresip_vidispl(), + "x11", alloc, NULL, display, hide); } diff --git a/src/baresip.c b/src/baresip.c index d1ebc1d..5484f77 100644 --- a/src/baresip.c +++ b/src/baresip.c @@ -26,6 +26,7 @@ static struct baresip { struct list aufiltl; struct list vidcodecl; struct list vidsrcl; + struct list vidispl; } baresip; @@ -45,6 +46,7 @@ int baresip_init(struct config *cfg, bool prefer_ipv6) list_init(&baresip.auplayl); list_init(&baresip.vidcodecl); list_init(&baresip.vidsrcl); + list_init(&baresip.vidispl); /* Initialise Network */ err = net_alloc(&baresip.net, &cfg->net, @@ -168,3 +170,9 @@ struct list *baresip_vidsrcl(void) { return &baresip.vidsrcl; } + + +struct list *baresip_vidispl(void) +{ + return &baresip.vidispl; +} @@ -600,7 +600,7 @@ int call_alloc(struct call **callp, const struct config *cfg, struct list *lst, use_video = (vidmode != VIDMODE_OFF) && (list_head(account_vidcodecl(call->acc)) != NULL) && (NULL != vidsrc_find(baresip_vidsrcl(), NULL) - || NULL != vidisp_find(NULL)); + || NULL != vidisp_find(baresip_vidispl(), NULL)); debug("call: use_video=%d\n", use_video); diff --git a/src/video.c b/src/video.c index 6ccfb88..9e767d0 100644 --- a/src/video.c +++ b/src/video.c @@ -867,7 +867,8 @@ static int set_vidisp(struct vrx *vrx) vrx->vidisp = mem_deref(vrx->vidisp); vrx->vidisp_prm.view = NULL; - vd = (struct vidisp *)vidisp_find(vrx->video->cfg.disp_mod); + vd = (struct vidisp *)vidisp_find(baresip_vidispl(), + vrx->video->cfg.disp_mod); if (!vd) return ENOENT; @@ -945,7 +946,7 @@ int video_start(struct video *v, const char *peer) stream_set_srate(v->strm, SRATE, SRATE); - if (vidisp_find(NULL)) { + if (vidisp_find(baresip_vidispl(), NULL)) { err = set_vidisp(&v->vrx); if (err) { warning("video: could not set vidisp '%s': %m\n", diff --git a/src/vidisp.c b/src/vidisp.c index 94ceee5..d267f58 100644 --- a/src/vidisp.c +++ b/src/vidisp.c @@ -14,9 +14,6 @@ struct vidisp_st { }; -static struct list vidispl = LIST_INIT; - - static void destructor(void *arg) { struct vidisp *vd = arg; @@ -29,6 +26,7 @@ static void destructor(void *arg) * Register a Video output display * * @param vp Pointer to allocated Video Display + * @param vidispl List of Video-displays * @param name Name of Video Display * @param alloch Allocation handler * @param updateh Update handler @@ -37,20 +35,20 @@ static void destructor(void *arg) * * @return 0 if success, otherwise errorcode */ -int vidisp_register(struct vidisp **vp, const char *name, +int vidisp_register(struct vidisp **vp, struct list *vidispl, const char *name, vidisp_alloc_h *alloch, vidisp_update_h *updateh, vidisp_disp_h *disph, vidisp_hide_h *hideh) { struct vidisp *vd; - if (!vp) + if (!vp || !vidispl) return EINVAL; vd = mem_zalloc(sizeof(*vd), destructor); if (!vd) return ENOMEM; - list_append(&vidispl, &vd->le, vd); + list_append(vidispl, &vd->le, vd); vd->name = name; vd->alloch = alloch; @@ -65,11 +63,11 @@ int vidisp_register(struct vidisp **vp, const char *name, } -const struct vidisp *vidisp_find(const char *name) +const struct vidisp *vidisp_find(const struct list *vidispl, const char *name) { struct le *le; - for (le = vidispl.head; le; le = le->next) { + for (le = list_head(vidispl); le; le = le->next) { struct vidisp *vd = le->data; if (str_isset(name) && 0 != str_casecmp(name, vd->name)) @@ -87,6 +85,7 @@ const struct vidisp *vidisp_find(const char *name) * Allocate a video display state * * @param stp Pointer to allocated display state + * @param vidispl List of Video-displays * @param name Name of video display * @param prm Video display parameters (optional) * @param dev Display device @@ -95,11 +94,12 @@ const struct vidisp *vidisp_find(const char *name) * * @return 0 if success, otherwise errorcode */ -int vidisp_alloc(struct vidisp_st **stp, const char *name, +int vidisp_alloc(struct vidisp_st **stp, struct list *vidispl, + const char *name, struct vidisp_prm *prm, const char *dev, vidisp_resize_h *resizeh, void *arg) { - struct vidisp *vd = (struct vidisp *)vidisp_find(name); + struct vidisp *vd = (struct vidisp *)vidisp_find(vidispl, name); if (!vd) return ENOENT; diff --git a/test/mock/mock_vidisp.c b/test/mock/mock_vidisp.c index cf9cba0..322dd1c 100644 --- a/test/mock/mock_vidisp.c +++ b/test/mock/mock_vidisp.c @@ -92,6 +92,6 @@ static int mock_display(struct vidisp_st *st, const char *title, int mock_vidisp_register(struct vidisp **vidispp) { - return vidisp_register(vidispp, "mock-vidisp", + return vidisp_register(vidispp, baresip_vidispl(), "mock-vidisp", mock_disp_alloc, NULL, mock_display, NULL); } |