[vlc-commits] v4l2: avoid a pair of nested loops if frame rate is constant

Rémi Denis-Courmont git at videolan.org
Mon Apr 9 18:36:45 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Apr  7 22:54:10 2012 +0300| [1bb938e4d9c600cf5caabf6a93cefec333e33cdc] | committer: Rémi Denis-Courmont

v4l2: avoid a pair of nested loops if frame rate is constant

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1bb938e4d9c600cf5caabf6a93cefec333e33cdc
---

 modules/access/v4l2/video.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/modules/access/v4l2/video.c b/modules/access/v4l2/video.c
index c75bc2f..7afa68a 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;



More information about the vlc-commits mailing list