Skip to content

Commit 4c1fac5

Browse files
committed
Usb camera changed bitrate to use width and height and fps
1 parent 4b1c5ae commit 4c1fac5

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

klib/usb/device/camera.hpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@
1010
#include <klib/usb/usb/video/descriptor.hpp>
1111

1212
namespace klib::usb::device {
13-
template <uint32_t Width, uint32_t Height, uint32_t InterruptEndpoint = 6, uint32_t IsoEndpoint = 8, uint32_t MaxIsoEndpointSize = 1023>
13+
/**
14+
* @brief USB camera
15+
*
16+
* @tparam Width width of the data in pixels
17+
* @tparam Height height of the data in pixels
18+
* @tparam Fps
19+
* @tparam InterruptEndpoint
20+
* @tparam IsoEndpoint
21+
* @tparam MaxIsoEndpointSize size for the isochronous endpoint. Default should be fine for most devices.
22+
*/
23+
template <uint32_t Width, uint32_t Height, uint32_t Fps = 10, uint32_t InterruptEndpoint = 6, uint32_t IsoEndpoint = 8, uint32_t MaxIsoEndpointSize = 1023>
1424
class camera {
1525
protected:
1626
/**
@@ -251,14 +261,14 @@ namespace klib::usb::device {
251261
.bmCapabilities = 0x03,
252262
.wWidth = Width,
253263
.wHeight = Height,
254-
.dwMinBitRate = 0x000dec00,
255-
.dwMaxBitRate = 0x000dec00,
256-
.dwMaxVideoFrameBufSize = 0x00009480,
257-
.dwDefaultFrameInterval = 0x000a2c2a,
264+
.dwMinBitRate = Width * Height * 16 * Fps,
265+
.dwMaxBitRate = Width * Height * 16 * Fps,
266+
.dwMaxVideoFrameBufSize = Width * Height * 16 / 8,
267+
.dwDefaultFrameInterval = 10000000 / Fps,
258268
.bFrameIntervalType = 0x00,
259269
.interval = {
260-
.dwMinFrameInterval = 0x000a2c2a,
261-
.dwMaxFrameInterval = 0x000a2c2a,
270+
.dwMinFrameInterval = 10000000 / Fps,
271+
.dwMaxFrameInterval = 10000000 / Fps,
262272
.dwFrameIntervalStep = 0x00000000,
263273
},
264274
},

0 commit comments

Comments
 (0)