diff options
author | Prashant Laddha <prladdha@cisco.com> | 2015-09-22 11:27:31 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-11-17 15:06:22 -0200 |
commit | a41f9b419c917867b7d93378266d65272f5682eb (patch) | |
tree | a80ecf37076ba3d33047b22a49b3bd69fb30b199 /drivers/media/platform/vivid | |
parent | c79aa6aeadb0f4a13e0404c7ccf4eb3796660f12 (diff) |
[media] vivid: add support for reduced frame rate in video capture
With this patch, vivid capture thread can now generate a video with
frame rate reduced by a factor of 1000 / 1001. This option can be
selected using a control Reduced Framerate from gui.
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/vivid')
-rw-r--r-- | drivers/media/platform/vivid/vivid-vid-cap.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c index ef5412311b2f..45a2ed85ad83 100644 --- a/drivers/media/platform/vivid/vivid-vid-cap.c +++ b/drivers/media/platform/vivid/vivid-vid-cap.c @@ -405,6 +405,7 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls) { struct v4l2_bt_timings *bt = &dev->dv_timings_cap.bt; unsigned size; + u64 pixelclock; switch (dev->input_type[dev->input]) { case WEBCAM: @@ -434,8 +435,15 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls) dev->src_rect.width = bt->width; dev->src_rect.height = bt->height; size = V4L2_DV_BT_FRAME_WIDTH(bt) * V4L2_DV_BT_FRAME_HEIGHT(bt); + if (dev->reduced_fps && can_reduce_fps(bt)) { + pixelclock = div_u64(bt->pixelclock * 1000, 1001); + bt->flags |= V4L2_DV_FL_REDUCED_FPS; + } else { + pixelclock = bt->pixelclock; + bt->flags &= ~V4L2_DV_FL_REDUCED_FPS; + } dev->timeperframe_vid_cap = (struct v4l2_fract) { - size / 100, (u32)bt->pixelclock / 100 + size / 100, (u32)pixelclock / 100 }; if (bt->interlaced) dev->field_cap = V4L2_FIELD_ALTERNATE; |