summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/stream.c6
-rw-r--r--lib/uvc.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/stream.c b/lib/stream.c
index 19f0d78..168dc71 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -156,6 +156,12 @@ int uvc_stream_set_format(struct uvc_stream *stream,
return video_source_set_format(stream->src, &fmt);
}
+int uvc_stream_set_frame_rate(struct uvc_stream *stream, unsigned int fps)
+{
+ printf("=== Setting frame rate to %u fps\n", fps);
+ return video_source_set_frame_rate(stream->src, fps);
+}
+
/* ---------------------------------------------------------------------------
* Stream handling
*/
diff --git a/lib/uvc.c b/lib/uvc.c
index 695db5b..ab03f0e 100644
--- a/lib/uvc.c
+++ b/lib/uvc.c
@@ -269,6 +269,7 @@ uvc_events_process_data(struct uvc_device *dev,
const struct uvc_function_config_format *format;
const struct uvc_function_config_frame *frame;
struct v4l2_pix_format pixfmt;
+ unsigned int fps;
format = &dev->fc->streaming.formats[target->bFormatIndex-1];
frame = &format->frames[target->bFrameIndex-1];
@@ -286,6 +287,10 @@ uvc_events_process_data(struct uvc_device *dev,
pixfmt.sizeimage = dev->maxsize * 1.5;
uvc_stream_set_format(dev->stream, &pixfmt);
+
+ /* fps is guaranteed to be non-zero and thus valid. */
+ fps = 1.0 / (target->dwFrameInterval / 10000000.0);
+ uvc_stream_set_frame_rate(dev->stream, fps);
}
}