Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Support get_framerate and provide a stub for set...
details: https://anonhg.NetBSD.org/src/rev/aea85d1d493d
branches: trunk
changeset: 933209:aea85d1d493d
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri May 22 11:25:06 2020 +0000
description:
Support get_framerate and provide a stub for set_framerate
diffstat:
sys/dev/usb/uvideo.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 51 insertions(+), 2 deletions(-)
diffs (95 lines):
diff -r dacec2510df5 -r aea85d1d493d sys/dev/usb/uvideo.c
--- a/sys/dev/usb/uvideo.c Fri May 22 11:24:31 2020 +0000
+++ b/sys/dev/usb/uvideo.c Fri May 22 11:25:06 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvideo.c,v 1.56 2020/03/14 02:35:34 christos Exp $ */
+/* $NetBSD: uvideo.c,v 1.57 2020/05/22 11:25:06 jmcneill Exp $ */
/*
* Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.56 2020/03/14 02:35:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.57 2020/05/22 11:25:06 jmcneill Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -275,6 +275,8 @@
static int uvideo_get_format(void *, struct video_format *);
static int uvideo_set_format(void *, struct video_format *);
static int uvideo_try_format(void *, struct video_format *);
+static int uvideo_get_framerate(void *, struct video_fract *);
+static int uvideo_set_framerate(void *, struct video_fract *);
static int uvideo_start_transfer(void *);
static int uvideo_stop_transfer(void *);
@@ -380,6 +382,8 @@
.get_format = uvideo_get_format,
.set_format = uvideo_set_format,
.try_format = uvideo_try_format,
+ .get_framerate = uvideo_get_framerate,
+ .set_framerate = uvideo_set_framerate,
.start_transfer = uvideo_start_transfer,
.stop_transfer = uvideo_stop_transfer,
.control_iter_init = NULL,
@@ -1877,6 +1881,8 @@
sc = addr;
+ uvideo_stop_transfer(addr);
+
if (sc->sc_state != UVIDEO_STATE_CLOSED) {
sc->sc_state = UVIDEO_STATE_CLOSED;
}
@@ -2072,6 +2078,49 @@
}
static int
+uvideo_get_framerate(void *addr, struct video_fract *fract)
+{
+ struct uvideo_softc *sc = addr;
+ struct uvideo_stream *vs = sc->sc_stream_in;
+
+ switch (vs->vs_frame_interval) {
+ case 41666: /* 240 */
+ case 83333: /* 120 */
+ case 166666: /* 60 */
+ case 200000: /* 50 */
+ case 333333: /* 30 */
+ case 400000: /* 25 */
+ case 500000: /* 20 */
+ case 666666: /* 15 */
+ case 1000000: /* 10 */
+ fract->numerator = 1;
+ fract->denominator = 10000000 / vs->vs_frame_interval;
+ break;
+ case 166833: /* 59.94 */
+ fract->numerator = 60;
+ fract->denominator = 1001;
+ break;
+ case 333667: /* 29.97 */
+ fract->numerator = 30;
+ fract->denominator = 1001;
+ break;
+ default:
+ fract->numerator = vs->vs_frame_interval;
+ fract->denominator = 10000000;
+ break;
+ }
+
+ return 0;
+}
+
+static int
+uvideo_set_framerate(void *addr, struct video_fract *fract)
+{
+ /* XXX setting framerate is not supported yet, return actual rate */
+ return uvideo_get_framerate(addr, fract);
+}
+
+static int
uvideo_start_transfer(void *addr)
{
struct uvideo_softc *sc = addr;
Home |
Main Index |
Thread Index |
Old Index