summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2015-06-20 10:30:54 +0200
committerAlfred E. Heggestad <aeh@db.org>2015-06-20 10:30:54 +0200
commitd2609092150272f3e3a6a4d9859d3c851e1fa270 (patch)
treeda65ce08d7997e9e67b78d96cb5ceccf8b839b44
parentf369fc474a4f629fb08ad8ae4c188e43f68806fc (diff)
vidisp: use const pointer to base-class
-rw-r--r--include/baresip.h2
-rw-r--r--modules/directfb/directfb.c8
-rw-r--r--modules/fakevideo/fakevideo.c9
-rw-r--r--modules/opengl/opengl.m8
-rw-r--r--modules/opengles/opengles.c5
-rw-r--r--modules/opengles/opengles.h2
-rw-r--r--modules/sdl/sdl.c7
-rw-r--r--modules/sdl2/sdl.c8
-rw-r--r--modules/vidbridge/disp.c5
-rw-r--r--modules/vidbridge/vidbridge.h4
-rw-r--r--modules/x11/x11.c8
11 files changed, 27 insertions, 39 deletions
diff --git a/include/baresip.h b/include/baresip.h
index facde9a..f61200a 100644
--- a/include/baresip.h
+++ b/include/baresip.h
@@ -645,7 +645,7 @@ struct vidisp_prm {
typedef void (vidisp_resize_h)(const struct vidsz *size, void *arg);
typedef int (vidisp_alloc_h)(struct vidisp_st **vp,
- struct vidisp *vd, struct vidisp_prm *prm,
+ const struct vidisp *vd, struct vidisp_prm *prm,
const char *dev,
vidisp_resize_h *resizeh, void *arg);
typedef int (vidisp_update_h)(struct vidisp_st *st, bool fullscreen,
diff --git a/modules/directfb/directfb.c b/modules/directfb/directfb.c
index ad98e2b..4d3b83f 100644
--- a/modules/directfb/directfb.c
+++ b/modules/directfb/directfb.c
@@ -11,7 +11,7 @@
struct vidisp_st {
- struct vidisp *vd; /**< Inheritance (1st) */
+ const struct vidisp *vd; /**< Inheritance (1st) */
struct vidsz size; /**< Current size */
IDirectFBWindow *window; /**< DirectFB Window */
IDirectFBSurface *surface; /**< Surface for pixels */
@@ -33,12 +33,10 @@ static void destructor(void *arg)
st->window->Release(st->window);
if (st->layer)
st->layer->Release(st->layer);
-
- mem_deref(st->vd);
}
-static int alloc(struct vidisp_st **stp, struct vidisp *vd,
+static int alloc(struct vidisp_st **stp, const struct vidisp *vd,
struct vidisp_prm *prm, const char *dev,
vidisp_resize_h *resizeh, void *arg)
{
@@ -55,7 +53,7 @@ static int alloc(struct vidisp_st **stp, struct vidisp *vd,
if (!st)
return ENOMEM;
- st->vd = mem_ref(vd);
+ st->vd = vd;
dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &st->layer);
diff --git a/modules/fakevideo/fakevideo.c b/modules/fakevideo/fakevideo.c
index b9d1763..2c85372 100644
--- a/modules/fakevideo/fakevideo.c
+++ b/modules/fakevideo/fakevideo.c
@@ -38,7 +38,7 @@ struct vidsrc_st {
};
struct vidisp_st {
- struct vidisp *vd; /* inheritance */
+ const struct vidisp *vd; /* inheritance */
};
@@ -83,8 +83,7 @@ static void src_destructor(void *arg)
static void disp_destructor(void *arg)
{
struct vidisp_st *st = arg;
-
- mem_deref(st->vd);
+ (void)st;
}
@@ -135,7 +134,7 @@ static int src_alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
}
-static int disp_alloc(struct vidisp_st **stp, struct vidisp *vd,
+static int disp_alloc(struct vidisp_st **stp, const struct vidisp *vd,
struct vidisp_prm *prm, const char *dev,
vidisp_resize_h *resizeh, void *arg)
{
@@ -152,7 +151,7 @@ static int disp_alloc(struct vidisp_st **stp, struct vidisp *vd,
if (!st)
return ENOMEM;
- st->vd = mem_ref(vd);
+ st->vd = vd;
*stp = st;
diff --git a/modules/opengl/opengl.m b/modules/opengl/opengl.m
index d3ca972..2ffa925 100644
--- a/modules/opengl/opengl.m
+++ b/modules/opengl/opengl.m
@@ -12,7 +12,7 @@
struct vidisp_st {
- struct vidisp *vd; /**< Inheritance (1st) */
+ const struct vidisp *vd; /**< Inheritance (1st) */
struct vidsz size; /**< Current size */
NSOpenGLContext *ctx;
NSWindow *win;
@@ -68,8 +68,6 @@ static void destructor(void *arg)
mem_deref(st->prog);
[pool release];
-
- mem_deref(st->vd);
}
@@ -170,7 +168,7 @@ static int setup_shader(struct vidisp_st *st, int width, int height)
}
-static int alloc(struct vidisp_st **stp, struct vidisp *vd,
+static int alloc(struct vidisp_st **stp, const struct vidisp *vd,
struct vidisp_prm *prm, const char *dev,
vidisp_resize_h *resizeh, void *arg)
{
@@ -198,7 +196,7 @@ static int alloc(struct vidisp_st **stp, struct vidisp *vd,
if (!st)
return ENOMEM;
- st->vd = mem_ref(vd);
+ st->vd = vd;
fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
if (!fmt) {
diff --git a/modules/opengles/opengles.c b/modules/opengles/opengles.c
index 4561577..e435b1d 100644
--- a/modules/opengles/opengles.c
+++ b/modules/opengles/opengles.c
@@ -204,11 +204,10 @@ static void destructor(void *arg)
context_destroy(st);
mem_deref(st->vf);
- mem_deref(st->vd);
}
-static int opengles_alloc(struct vidisp_st **stp, struct vidisp *vd,
+static int opengles_alloc(struct vidisp_st **stp, const struct vidisp *vd,
struct vidisp_prm *prm, const char *dev,
vidisp_resize_h *resizeh,
void *arg)
@@ -225,7 +224,7 @@ static int opengles_alloc(struct vidisp_st **stp, struct vidisp *vd,
if (!st)
return ENOMEM;
- st->vd = mem_ref(vd);
+ st->vd = vd;
err = context_init(st);
if (err)
diff --git a/modules/opengles/opengles.h b/modules/opengles/opengles.h
index 9eac3fb..6c61a1e 100644
--- a/modules/opengles/opengles.h
+++ b/modules/opengles/opengles.h
@@ -6,7 +6,7 @@
struct vidisp_st {
- struct vidisp *vd;
+ const struct vidisp *vd; /* pointer to base-class (inheritance) */
struct vidframe *vf;
/* GLES: */
diff --git a/modules/sdl/sdl.c b/modules/sdl/sdl.c
index eb902b3..ea60a38 100644
--- a/modules/sdl/sdl.c
+++ b/modules/sdl/sdl.c
@@ -17,7 +17,7 @@ enum {
};
struct vidisp_st {
- struct vidisp *vd; /* inheritance */
+ const struct vidisp *vd; /* inheritance */
};
/** Global SDL data */
@@ -174,12 +174,11 @@ static void destructor(void *arg)
{
struct vidisp_st *st = arg;
- mem_deref(st->vd);
sdl_close();
}
-static int alloc(struct vidisp_st **stp, struct vidisp *vd,
+static int alloc(struct vidisp_st **stp, const struct vidisp *vd,
struct vidisp_prm *prm, const char *dev,
vidisp_resize_h *resizeh, void *arg)
{
@@ -197,7 +196,7 @@ static int alloc(struct vidisp_st **stp, struct vidisp *vd,
if (!st)
return ENOMEM;
- st->vd = mem_ref(vd);
+ st->vd = vd;
sdl.resizeh = resizeh;
sdl.arg = arg;
diff --git a/modules/sdl2/sdl.c b/modules/sdl2/sdl.c
index e688689..c79392d 100644
--- a/modules/sdl2/sdl.c
+++ b/modules/sdl2/sdl.c
@@ -11,7 +11,7 @@
struct vidisp_st {
- struct vidisp *vd; /**< Inheritance (1st) */
+ const struct vidisp *vd; /**< Inheritance (1st) */
SDL_Window *window; /**< SDL Window */
SDL_Renderer *renderer; /**< SDL Renderer */
SDL_Texture *texture; /**< Texture for pixels */
@@ -47,12 +47,10 @@ static void destructor(void *arg)
struct vidisp_st *st = arg;
sdl_reset(st);
-
- mem_deref(st->vd);
}
-static int alloc(struct vidisp_st **stp, struct vidisp *vd,
+static int alloc(struct vidisp_st **stp, const struct vidisp *vd,
struct vidisp_prm *prm, const char *dev,
vidisp_resize_h *resizeh, void *arg)
{
@@ -69,7 +67,7 @@ static int alloc(struct vidisp_st **stp, struct vidisp *vd,
if (!st)
return ENOMEM;
- st->vd = mem_ref(vd);
+ st->vd = vd;
if (err)
mem_deref(st);
diff --git a/modules/vidbridge/disp.c b/modules/vidbridge/disp.c
index bce9cff..be1e8e5 100644
--- a/modules/vidbridge/disp.c
+++ b/modules/vidbridge/disp.c
@@ -18,11 +18,10 @@ static void destructor(void *arg)
list_unlink(&st->le);
mem_deref(st->device);
- mem_deref(st->vd);
}
-int vidbridge_disp_alloc(struct vidisp_st **stp, struct vidisp *vd,
+int vidbridge_disp_alloc(struct vidisp_st **stp, const struct vidisp *vd,
struct vidisp_prm *prm, const char *dev,
vidisp_resize_h *resizeh, void *arg)
{
@@ -39,7 +38,7 @@ int vidbridge_disp_alloc(struct vidisp_st **stp, struct vidisp *vd,
if (!st)
return ENOMEM;
- st->vd = mem_ref(vd);
+ st->vd = vd;
err = str_dup(&st->device, dev);
if (err)
diff --git a/modules/vidbridge/vidbridge.h b/modules/vidbridge/vidbridge.h
index 470e917..0fbf68e 100644
--- a/modules/vidbridge/vidbridge.h
+++ b/modules/vidbridge/vidbridge.h
@@ -17,7 +17,7 @@ struct vidsrc_st {
struct vidisp_st {
- struct vidisp *vd; /* inheritance (1st) */
+ const struct vidisp *vd; /* inheritance (1st) */
struct le le;
struct vidsrc_st *vidsrc;
@@ -29,7 +29,7 @@ extern struct hash *ht_src;
extern struct hash *ht_disp;
-int vidbridge_disp_alloc(struct vidisp_st **stp, struct vidisp *vd,
+int vidbridge_disp_alloc(struct vidisp_st **stp, const struct vidisp *vd,
struct vidisp_prm *prm, const char *dev,
vidisp_resize_h *resizeh, void *arg);
int vidbridge_disp_display(struct vidisp_st *st, const char *title,
diff --git a/modules/x11/x11.c b/modules/x11/x11.c
index 5710dca..e77f25c 100644
--- a/modules/x11/x11.c
+++ b/modules/x11/x11.c
@@ -18,7 +18,7 @@
struct vidisp_st {
- struct vidisp *vd; /**< Inheritance (1st) */
+ const struct vidisp *vd; /**< Inheritance (1st) */
struct vidsz size; /**< Current size */
Display *disp;
@@ -94,8 +94,6 @@ static void destructor(void *arg)
}
close_window(st);
-
- mem_deref(st->vd);
}
@@ -236,7 +234,7 @@ static int x11_reset(struct vidisp_st *st, const struct vidsz *sz)
/* prm->view points to the XWINDOW ID */
-static int alloc(struct vidisp_st **stp, struct vidisp *vd,
+static int alloc(struct vidisp_st **stp, const struct vidisp *vd,
struct vidisp_prm *prm, const char *dev,
vidisp_resize_h *resizeh, void *arg)
{
@@ -250,7 +248,7 @@ static int alloc(struct vidisp_st **stp, struct vidisp *vd,
if (!st)
return ENOMEM;
- st->vd = mem_ref(vd);
+ st->vd = vd;
st->shm.shmaddr = (char *)-1;
st->disp = XOpenDisplay(NULL);