From 014dad23a3b71c040a9b3a3e93aea102c56d8cba Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Tue, 28 Aug 2018 02:12:49 -0400 Subject: video-source: add video_source_set_frame_rate We would like to be able to set the frame rate for video sources. This patch adds a set_frame_rate op for video sources, along with a wrapper to call video sources' set_frame_rate functions. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- include/uvcgadget/video-source.h | 2 ++ lib/video-source.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/uvcgadget/video-source.h b/include/uvcgadget/video-source.h index fffcba3..60f7ddd 100644 --- a/include/uvcgadget/video-source.h +++ b/include/uvcgadget/video-source.h @@ -18,6 +18,7 @@ struct video_source; struct video_source_ops { void(*destroy)(struct video_source *src); int(*set_format)(struct video_source *src, struct v4l2_pix_format *fmt); + int(*set_frame_rate)(struct video_source *src, unsigned int fps); int(*alloc_buffers)(struct video_source *src, unsigned int nbufs); int(*export_buffers)(struct video_source *src, struct video_buffer_set **buffers); @@ -43,6 +44,7 @@ void video_source_set_buffer_handler(struct video_source *src, void video_source_destroy(struct video_source *src); int video_source_set_format(struct video_source *src, struct v4l2_pix_format *fmt); +int video_source_set_frame_rate(struct video_source *src, unsigned int fps); int video_source_alloc_buffers(struct video_source *src, unsigned int nbufs); int video_source_export_buffers(struct video_source *src, struct video_buffer_set **buffers); diff --git a/lib/video-source.c b/lib/video-source.c index 06092f5..5520b95 100644 --- a/lib/video-source.c +++ b/lib/video-source.c @@ -29,6 +29,11 @@ int video_source_set_format(struct video_source *src, return src->ops->set_format(src, fmt); } +int video_source_set_frame_rate(struct video_source *src, unsigned int fps) +{ + return src->ops->set_frame_rate(src, fps); +} + int video_source_alloc_buffers(struct video_source *src, unsigned int nbufs) { return src->ops->alloc_buffers(src, nbufs); -- cgit v1.2.3