aboutsummaryrefslogtreecommitdiffstats
path: root/src/v4l.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-21 12:50:46 (GMT)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-21 12:50:46 (GMT)
commit115a30ce7f2508c764a3fb13cf67b1f0fb5946d0 (patch)
treee64c13a63340f6eabe71cd8484d5cb09e077e005 /src/v4l.c
parentc17f7baf89a3ef65c4eb866adc1df65729ac548b (diff)
Add an item to allow switching cameras in realtime
When camorama detects multiple cameras, it should now be possible to swich between them in real time without stopping it. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'src/v4l.c')
-rw-r--r--src/v4l.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/v4l.c b/src/v4l.c
index d8732c6..d54bbfb 100644
--- a/src/v4l.c
+++ b/src/v4l.c
@@ -71,7 +71,7 @@ static int sort_func(const void *__b, const void *__a)
static float get_max_fps_discrete(cam_t *cam,
struct v4l2_frmsizeenum *frmsize)
{
- struct v4l2_frmivalenum frmival;
+ struct v4l2_frmivalenum frmival = { 0 };
float fps, max_fps = -1;
frmival.width = frmsize->discrete.width;
@@ -91,11 +91,16 @@ static float get_max_fps_discrete(cam_t *cam,
void get_supported_resolutions(cam_t *cam)
{
- struct v4l2_fmtdesc fmt;
- struct v4l2_frmsizeenum frmsize;
+ struct v4l2_fmtdesc fmt = { 0 };
+ struct v4l2_frmsizeenum frmsize = { 0 };
int i;
unsigned int x, y;
+ if (cam->n_res) {
+ free(cam->res);
+ cam->res = NULL;
+ cam->n_res = 0;
+ }
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
for (fmt.index = 0;

Privacy Policy