summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2015-06-20 10:01:35 +0200
committerAlfred E. Heggestad <aeh@db.org>2015-06-20 10:01:35 +0200
commiteb6b9567bbcd400773e7801f60dd34b92edace31 (patch)
treeeb3f419966f7bc25e506f823b90680cd52425125 /modules
parent92f52bf6180f03d0d148cd4db15e07dfb97a5d53 (diff)
vidsrc: use const pointer to base-class
Diffstat (limited to 'modules')
-rw-r--r--modules/avcapture/avcapture.m8
-rw-r--r--modules/avformat/avf.c8
-rw-r--r--modules/cairo/cairo.c8
-rw-r--r--modules/dshow/dshow.cpp8
-rw-r--r--modules/fakevideo/fakevideo.c7
-rw-r--r--modules/qtcapture/qtcapture.m8
-rw-r--r--modules/quicktime/quicktime.c7
-rw-r--r--modules/rst/video.c7
-rw-r--r--modules/v4l/v4l.c7
-rw-r--r--modules/v4l2/v4l2.c8
-rw-r--r--modules/vidbridge/src.c5
-rw-r--r--modules/vidbridge/vidbridge.h4
-rw-r--r--modules/x11grab/x11grab.c8
13 files changed, 37 insertions, 56 deletions
diff --git a/modules/avcapture/avcapture.m b/modules/avcapture/avcapture.m
index 8f07e7d..e037246 100644
--- a/modules/avcapture/avcapture.m
+++ b/modules/avcapture/avcapture.m
@@ -31,7 +31,7 @@ static struct vidsrc *vidsrc;
struct vidsrc_st {
- struct vidsrc *vs;
+ const struct vidsrc *vs;
avcap *cap;
vidsrc_frame_h *frameh;
void *arg;
@@ -289,12 +289,10 @@ static void destructor(void *arg)
waitUntilDone:YES];
[st->cap release];
-
- mem_deref(st->vs);
}
-static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+static int alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx, struct vidsrc_prm *prm,
const struct vidsz *size, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
@@ -319,7 +317,7 @@ static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
pool = [NSAutoreleasePool new];
- st->vs = mem_ref(vs);
+ st->vs = vs;
st->frameh = frameh;
st->arg = arg;
diff --git a/modules/avformat/avf.c b/modules/avformat/avf.c
index 449587a..9336a4f 100644
--- a/modules/avformat/avf.c
+++ b/modules/avformat/avf.c
@@ -56,7 +56,7 @@
struct vidsrc_st {
- struct vidsrc *vs; /* inheritance */
+ const struct vidsrc *vs; /* inheritance */
pthread_t thread;
bool run;
AVFormatContext *ic;
@@ -97,8 +97,6 @@ static void destructor(void *arg)
av_close_input_file(st->ic);
#endif
}
-
- mem_deref(st->vs);
}
@@ -229,7 +227,7 @@ static void *read_thread(void *data)
}
-static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+static int alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **mctx, struct vidsrc_prm *prm,
const struct vidsz *size, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
@@ -253,7 +251,7 @@ static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
if (!st)
return ENOMEM;
- st->vs = mem_ref(vs);
+ st->vs = vs;
st->app_sz = *size;
st->frameh = frameh;
st->arg = arg;
diff --git a/modules/cairo/cairo.c b/modules/cairo/cairo.c
index a4956ad..7ca83b1 100644
--- a/modules/cairo/cairo.c
+++ b/modules/cairo/cairo.c
@@ -25,7 +25,7 @@
*/
struct vidsrc_st {
- struct vidsrc *vs; /* inheritance */
+ const struct vidsrc *vs; /* inheritance */
struct vidsrc_prm prm;
struct vidsz size;
@@ -55,8 +55,6 @@ static void destructor(void *arg)
cairo_destroy(st->cr);
if (st->surface)
cairo_surface_destroy(st->surface);
-
- mem_deref(st->vs);
}
@@ -154,7 +152,7 @@ static void *read_thread(void *arg)
}
-static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+static int alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx, struct vidsrc_prm *prm,
const struct vidsz *size, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
@@ -175,7 +173,7 @@ static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
if (!st)
return ENOMEM;
- st->vs = mem_ref(vs);
+ st->vs = vs;
st->frameh = frameh;
st->arg = arg;
st->prm = *prm;
diff --git a/modules/dshow/dshow.cpp b/modules/dshow/dshow.cpp
index 6dc56c1..c687f83 100644
--- a/modules/dshow/dshow.cpp
+++ b/modules/dshow/dshow.cpp
@@ -23,7 +23,7 @@ const CLSID CLSID_SampleGrabber = { 0xc1f400a0, 0x3f08, 0x11d3,
class Grabber;
struct vidsrc_st {
- struct vidsrc *vs; /* inheritance */
+ const struct vidsrc *vs; /* inheritance */
ICaptureGraphBuilder2 *capture;
IBaseFilter *grabber_filter;
@@ -351,12 +351,10 @@ static void destructor(void *arg)
st->graph->Release();
delete st->grab;
-
- mem_deref(st->vs);
}
-static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+static int alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx, struct vidsrc_prm *prm,
const struct vidsz *size,
const char *fmt, const char *dev,
@@ -382,7 +380,7 @@ static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
if (err)
goto out;
- st->vs = (struct vidsrc *)mem_ref(vs);
+ st->vs = vs;
st->size = *size;
st->frameh = frameh;
diff --git a/modules/fakevideo/fakevideo.c b/modules/fakevideo/fakevideo.c
index edbec4a..b9d1763 100644
--- a/modules/fakevideo/fakevideo.c
+++ b/modules/fakevideo/fakevideo.c
@@ -28,7 +28,7 @@
struct vidsrc_st {
- struct vidsrc *vs; /* inheritance */
+ const struct vidsrc *vs; /* inheritance */
struct vidframe *frame;
pthread_t thread;
bool run;
@@ -77,7 +77,6 @@ static void src_destructor(void *arg)
}
mem_deref(st->frame);
- mem_deref(st->vs);
}
@@ -89,7 +88,7 @@ static void disp_destructor(void *arg)
}
-static int src_alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+static int src_alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx, struct vidsrc_prm *prm,
const struct vidsz *size, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
@@ -110,7 +109,7 @@ static int src_alloc(struct vidsrc_st **stp, struct vidsrc *vs,
if (!st)
return ENOMEM;
- st->vs = mem_ref(vs);
+ st->vs = vs;
st->fps = prm->fps;
st->frameh = frameh;
st->arg = arg;
diff --git a/modules/qtcapture/qtcapture.m b/modules/qtcapture/qtcapture.m
index b5fce0e..08f66ab 100644
--- a/modules/qtcapture/qtcapture.m
+++ b/modules/qtcapture/qtcapture.m
@@ -25,7 +25,7 @@ static struct vidsrc *vidsrc;
struct vidsrc_st {
- struct vidsrc *vs; /* inheritance */
+ const struct vidsrc *vs; /* inheritance */
qtcap *cap;
struct lock *lock;
@@ -277,8 +277,6 @@ static void destructor(void *arg)
mem_deref(st->buf);
mem_deref(st->lock);
-
- mem_deref(st->vs);
}
@@ -299,7 +297,7 @@ static void tmr_handler(void *arg)
#endif
-static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+static int alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx, struct vidsrc_prm *prm,
const struct vidsz *size, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
@@ -320,7 +318,7 @@ static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
if (!st)
return ENOMEM;
- st->vs = mem_ref(vs);
+ st->vs = vs;
st->frameh = frameh;
st->arg = arg;
diff --git a/modules/quicktime/quicktime.c b/modules/quicktime/quicktime.c
index 84fab4b..504338c 100644
--- a/modules/quicktime/quicktime.c
+++ b/modules/quicktime/quicktime.c
@@ -15,7 +15,7 @@
struct vidsrc_st {
- struct vidsrc *vs; /* inheritance */
+ const struct vidsrc *vs; /* inheritance */
pthread_t thread;
pthread_mutex_t mutex;
struct vidsz sz;
@@ -62,7 +62,6 @@ static void destructor(void *arg)
sws_freeContext(st->sws);
mem_deref(st->buf);
- mem_deref(st->vs);
}
@@ -176,7 +175,7 @@ static void *read_thread(void *arg)
}
-static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+static int alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx,
struct vidsrc_prm *prm, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
@@ -196,7 +195,7 @@ static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
if (!st)
return ENOMEM;
- st->vs = mem_ref(vs);
+ st->vs = vs;
st->frameh = frameh;
st->arg = arg;
diff --git a/modules/rst/video.c b/modules/rst/video.c
index db6bfc9..adf2495 100644
--- a/modules/rst/video.c
+++ b/modules/rst/video.c
@@ -15,7 +15,7 @@
struct vidsrc_st {
- struct vidsrc *vs;
+ const struct vidsrc *vs; /* pointer to base-class (inheritance) */
pthread_mutex_t mutex;
pthread_t thread;
struct vidsrc_prm prm;
@@ -52,7 +52,6 @@ static void destructor(void *arg)
cairo_surface_destroy(st->surface);
mem_deref(st->frame);
- mem_deref(st->vs);
}
@@ -188,7 +187,7 @@ void rst_video_update(struct vidsrc_st *st, const char *name, const char *meta)
}
-static int alloc_handler(struct vidsrc_st **stp, struct vidsrc *vs,
+static int alloc_handler(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx, struct vidsrc_prm *prm,
const struct vidsz *size, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
@@ -211,7 +210,7 @@ static int alloc_handler(struct vidsrc_st **stp, struct vidsrc *vs,
if (err)
goto out;
- st->vs = mem_ref(vs);
+ st->vs = vs;
st->prm = *prm;
st->size = *size;
st->frameh = frameh;
diff --git a/modules/v4l/v4l.c b/modules/v4l/v4l.c
index 1f3e760..93b84fa 100644
--- a/modules/v4l/v4l.c
+++ b/modules/v4l/v4l.c
@@ -20,7 +20,7 @@
struct vidsrc_st {
- struct vidsrc *vs; /* inheritance */
+ const struct vidsrc *vs; /* inheritance */
int fd;
pthread_t thread;
@@ -156,7 +156,6 @@ static void destructor(void *arg)
close(st->fd);
mem_deref(st->mb);
- mem_deref(st->vs);
}
@@ -166,7 +165,7 @@ static uint32_t rgb24_size(const struct vidsz *sz)
}
-static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+static int alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx, struct vidsrc_prm *prm,
const struct vidsz *size, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
@@ -190,7 +189,7 @@ static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
if (!st)
return ENOMEM;
- st->vs = mem_ref(vs);
+ st->vs = vs;
st->fd = -1;
st->size = *size;
st->frameh = frameh;
diff --git a/modules/v4l2/v4l2.c b/modules/v4l2/v4l2.c
index c02cbb4..856e07d 100644
--- a/modules/v4l2/v4l2.c
+++ b/modules/v4l2/v4l2.c
@@ -42,7 +42,7 @@ struct buffer {
};
struct vidsrc_st {
- struct vidsrc *vs; /* inheritance */
+ const struct vidsrc *vs; /* inheritance */
int fd;
pthread_t thread;
@@ -402,8 +402,6 @@ static void destructor(void *arg)
if (st->fd >= 0)
v4l2_close(st->fd);
-
- mem_deref(st->vs);
}
@@ -423,7 +421,7 @@ static void *read_thread(void *arg)
}
-static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+static int alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx, struct vidsrc_prm *prm,
const struct vidsz *size, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
@@ -447,7 +445,7 @@ static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
if (!st)
return ENOMEM;
- st->vs = mem_ref(vs);
+ st->vs = vs;
st->fd = -1;
st->sz = *size;
st->frameh = frameh;
diff --git a/modules/vidbridge/src.c b/modules/vidbridge/src.c
index ff9bf70..5e7d08a 100644
--- a/modules/vidbridge/src.c
+++ b/modules/vidbridge/src.c
@@ -18,11 +18,10 @@ static void destructor(void *arg)
list_unlink(&st->le);
mem_deref(st->device);
- mem_deref(st->vs);
}
-int vidbridge_src_alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+int vidbridge_src_alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx, struct vidsrc_prm *prm,
const struct vidsz *size, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
@@ -42,7 +41,7 @@ int vidbridge_src_alloc(struct vidsrc_st **stp, struct vidsrc *vs,
if (!st)
return ENOMEM;
- st->vs = mem_ref(vs);
+ st->vs = vs;
st->frameh = frameh;
st->arg = arg;
diff --git a/modules/vidbridge/vidbridge.h b/modules/vidbridge/vidbridge.h
index 15fcdfc..470e917 100644
--- a/modules/vidbridge/vidbridge.h
+++ b/modules/vidbridge/vidbridge.h
@@ -6,7 +6,7 @@
struct vidsrc_st {
- struct vidsrc *vs; /* inheritance (1st) */
+ const struct vidsrc *vs; /* inheritance (1st) */
struct le le;
struct vidisp_st *vidisp;
@@ -37,7 +37,7 @@ int vidbridge_disp_display(struct vidisp_st *st, const char *title,
struct vidisp_st *vidbridge_disp_find(const char *device);
-int vidbridge_src_alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+int vidbridge_src_alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx, struct vidsrc_prm *prm,
const struct vidsz *size, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
diff --git a/modules/x11grab/x11grab.c b/modules/x11grab/x11grab.c
index 93477a5..d1e0fd9 100644
--- a/modules/x11grab/x11grab.c
+++ b/modules/x11grab/x11grab.c
@@ -22,7 +22,7 @@
struct vidsrc_st {
- struct vidsrc *vs; /* inheritance */
+ const struct vidsrc *vs; /* inheritance */
Display *disp;
XImage *image;
pthread_t thread;
@@ -144,12 +144,10 @@ static void destructor(void *arg)
if (st->disp)
XCloseDisplay(st->disp);
-
- mem_deref(st->vs);
}
-static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
+static int alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
struct media_ctx **ctx, struct vidsrc_prm *prm,
const struct vidsz *size, const char *fmt,
const char *dev, vidsrc_frame_h *frameh,
@@ -170,7 +168,7 @@ static int alloc(struct vidsrc_st **stp, struct vidsrc *vs,
if (!st)
return ENOMEM;
- st->vs = mem_ref(vs);
+ st->vs = vs;
st->size = *size;
st->fps = prm->fps;
st->frameh = frameh;