Skip to content

Commit 8a537a0

Browse files
authored
Remove Hardcoded interface numbers from video descriptors
Removing the Hardcoded interface numbers from the video descriptors allow the user to add other interfaces before or after the Video Control Interface and Video Streaming Interface
1 parent e3b4d3f commit 8a537a0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/device/video_capture/src/usb_descriptors.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#define FRAME_RATE 10
3939

4040
enum {
41-
ITF_NUM_VIDEO_CONTROL = 0,
41+
ITF_NUM_VIDEO_CONTROL,
4242
ITF_NUM_VIDEO_STREAMING,
4343
ITF_NUM_TOTAL
4444
};
@@ -74,19 +74,19 @@ enum {
7474
TUD_VIDEO_DESC_CS_VS_FMT_UNCOMPR(_fmtidx, _numfmtdesc, TUD_VIDEO_GUID_I420, 12, _frmidx, _asrx, _asry, _interlace, _cp)
7575

7676
#define TUD_VIDEO_CAPTURE_DESCRIPTOR(_stridx, _epin, _width, _height, _fps, _epsize) \
77-
TUD_VIDEO_DESC_IAD(ITF_NUM_VIDEO_CONTROL, ITF_NUM_TOTAL, _stridx), \
77+
TUD_VIDEO_DESC_IAD(ITF_NUM_VIDEO_CONTROL, /* 2 Interfaces */ 0x02, _stridx), \
7878
/* Video control 0 */ \
7979
TUD_VIDEO_DESC_STD_VC(ITF_NUM_VIDEO_CONTROL, 0, _stridx), \
8080
TUD_VIDEO_DESC_CS_VC( /* UVC 1.5*/ 0x0150, \
8181
/* wTotalLength - bLength */ \
8282
TUD_VIDEO_DESC_CAMERA_TERM_LEN + TUD_VIDEO_DESC_OUTPUT_TERM_LEN, \
83-
UVC_CLOCK_FREQUENCY, 1), \
83+
UVC_CLOCK_FREQUENCY, ITF_NUM_VIDEO_STREAMING), \
8484
TUD_VIDEO_DESC_CAMERA_TERM(UVC_ENTITY_CAP_INPUT_TERMINAL, 0, 0,\
8585
/*wObjectiveFocalLengthMin*/0, /*wObjectiveFocalLengthMax*/0,\
8686
/*wObjectiveFocalLength*/0, /*bmControls*/0), \
8787
TUD_VIDEO_DESC_OUTPUT_TERM(UVC_ENTITY_CAP_OUTPUT_TERMINAL, VIDEO_TT_STREAMING, 0, 1, 0), \
8888
/* Video stream alt. 0 */ \
89-
TUD_VIDEO_DESC_STD_VS( 1, 0, 0, 0), \
89+
TUD_VIDEO_DESC_STD_VS(ITF_NUM_VIDEO_STREAMING, 0, 0, _stridx), \
9090
/* Video stream header for without still image capture */ \
9191
TUD_VIDEO_DESC_CS_VS_INPUT( /*bNumFormats*/1, \
9292
/*wTotalLength - bLength */\
@@ -106,7 +106,7 @@ enum {
106106
(10000000/_fps), (10000000/_fps), (10000000/_fps)*_fps, (10000000/_fps)), \
107107
TUD_VIDEO_DESC_CS_VS_COLOR_MATCHING(VIDEO_COLOR_PRIMARIES_BT709, VIDEO_COLOR_XFER_CH_BT709, VIDEO_COLOR_COEF_SMPTE170M), \
108108
/* VS alt 1 */\
109-
TUD_VIDEO_DESC_STD_VS(1, 1, 1, 0), \
109+
TUD_VIDEO_DESC_STD_VS(ITF_NUM_VIDEO_STREAMING, 1, 1, _stridx), \
110110
/* EP */ \
111111
TUD_VIDEO_DESC_EP_ISO(_epin, _epsize, 1)
112112

0 commit comments

Comments
 (0)