From 1bb938e4d9c600cf5caabf6a93cefec333e33cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sat, 7 Apr 2012 22:54:10 +0300 Subject: [PATCH] v4l2: avoid a pair of nested loops if frame rate is constant --- modules/access/v4l2/video.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/access/v4l2/video.c b/modules/access/v4l2/video.c index c75bc2fdc8..7afa68a886 100644 --- a/modules/access/v4l2/video.c +++ b/modules/access/v4l2/video.c @@ -926,6 +926,12 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc, msg_Dbg (obj, " with %"PRIu32"x%"PRIu32" steps", fse.stepwise.step_width, fse.stepwise.step_height); + if (!(parm->parm.capture.capability & V4L2_CAP_TIMEPERFRAME)) + { /* Frame rate is constant, lets maximize resolution */ + fmt->fmt.pix.width = fse.stepwise.max_width; + fmt->fmt.pix.height = fse.stepwise.max_height; + } + else /* FIXME: slow and dumb */ for (uint32_t width = fse.stepwise.min_width; width <= fse.stepwise.max_width;