diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-21 09:50:46 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-21 09:50:46 -0300 |
commit | 115a30ce7f2508c764a3fb13cf67b1f0fb5946d0 (patch) | |
tree | e64c13a63340f6eabe71cd8484d5cb09e077e005 /src/v4l.c | |
parent | c17f7baf89a3ef65c4eb866adc1df65729ac548b (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.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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; |