diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-07-24 09:18:39 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-07-24 09:45:56 -0300 |
commit | 3bbc07f94c3bf49e2828902dfeb3f6f2e6953336 (patch) | |
tree | eabf27fc04fd80cb27275e5573b339b78ff89cf8 /src/v4l.c | |
parent | 00dca626855904e955ec4c164505a0bc34db671d (diff) |
Prevent activating an already active size
Changing resolution is costly, as we need first to wait
for pending buffers and stop streaming.
So, optimize resolution switch by not trying to
activate the already activated resolution.
Diffstat (limited to 'src/v4l.c')
-rw-r--r-- | src/v4l.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -258,6 +258,22 @@ void get_win_info(cam * cam) } } +void try_set_win_info(cam * cam, int *x, int *y) +{ + gchar *msg; + struct v4l2_format fmt; + + memset(&fmt, 0, sizeof(fmt)); + fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + fmt.fmt.pix.pixelformat = cam->pixformat; + fmt.fmt.pix.width = *x; + fmt.fmt.pix.height = *y; + if (!v4l2_ioctl(cam->dev, VIDIOC_TRY_FMT, &fmt)) { + *x = fmt.fmt.pix.width; + *y = fmt.fmt.pix.height; + } +} + void set_win_info(cam * cam) { gchar *msg; |