-
Notifications
You must be signed in to change notification settings - Fork 1
/
dispvid.c
5649 lines (5020 loc) · 212 KB
/
dispvid.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*++
Copyright (c) 2002-2008 Microsoft Corporation
Module Name:
DISPVID.C
Abstract:
This source file contains routines which update the edit control
to display information about USB Video descriptors.
Environment:
user mode
Revision History:
11-22-2002 : created
03-28-2003 : major revisions from latest specs.
03-28-2008 : include USB Video Class 1.1
--*/
//*****************************************************************************
// I N C L U D E S
//*****************************************************************************
#include "uvcview.h"
#include "h264.h"
//*****************************************************************************
// G L O B A L S P R I V A T E T O T H I S F I L E
//*****************************************************************************
int StillMethod = 0;
//
// USB Device Class Definition for Video Devices 0.8b version
//
// 3.6.2.3 Camera Terminal Descriptor
//
STRINGLIST slCameraControl1 [] =
{
{1, "Scanning Mode", ""},
{2, "Auto-Exposure Mode", ""},
{4, "Auto-Exposure Priority", ""},
{8, "Exposure Time (Absolute)", ""},
{0x10, "Exposure Time (Relative)", ""},
{0x20, "Focus (Absolute)", ""},
{0x40, "Focus (Relative)", ""},
{0x80, "Iris (Absolute)", ""},
};
STRINGLIST slCameraControl2 [] =
{
{1, "Iris (Relative)", ""},
{2, "Zoom (Absolute)", ""},
{4, "Zoom (Relative)", ""},
{8, "PanTilt (Absolute)", ""},
{0x10, "PanTilt (Relative)", ""},
{0x20, "Roll (Absolute)", ""},
{0x40, "Roll (Relative)", ""},
{0x80, "Reserved", ""},
};
STRINGLIST slCameraControl3 [] =
{
{1, "Reserved", ""},
{2, "Focus, Auto", ""},
{4, "Privacy", ""},
{8, "Focus, Simple", ""},
{0x10, "Window", ""},
{0x20, "Region of Interest", ""},
{0x40, "Reserved", ""},
{0x80, "Reserved", ""},
};
// 3.6.2.5 Processing Unit Descriptor
//
STRINGLIST slProcessorControls1 [] =
{
{1, "Brightness", ""},
{2, "Contrast", ""},
{4, "Hue", ""},
{8, "Saturation", ""},
{0x10, "Sharpness", ""},
{0x20, "Gamma", ""},
{0x40, "White Balance Temperature", ""},
{0x80, "White Balance Component", ""},
};
STRINGLIST slProcessorControls2 [] =
{
{1, "Backlight Compensation", ""},
{2, "Gain", ""},
{4, "Power Line Frequency", ""},
{8, "Hue, Auto", ""},
{0x10, "White Balance Temperature, Auto", ""},
{0x20, "White Balance Component, Auto", ""},
{0x40, "Digital Multiplier", ""},
{0x80, "Digital Multiplier Limit", ""},
};
STRINGLIST slProcessorControls3 [] =
{
{1, "Analog Video Standard", ""},
{2, "Analog Video Lock Status", ""},
{4, "Contrast, Auto", ""},
{8, "Reserved", ""},
{0x10, "Reserved", ""},
{0x20, "Reserved", ""},
{0x40, "Reserved", ""},
{0x80, "Reserved", ""},
};
STRINGLIST slProcessorVideoStandards [] =
{
{1, "None", ""},
{2, "NTSC - 525/60", ""},
{4, "PAL - 625/50", ""},
{8, "SECAM - 625/50", ""},
{0x10, "NTSC - 625/50", ""},
{0x20, "PAL - 525/60", ""},
{0x40, "Reserved", ""},
{0x80, "Reserved", ""},
};
// 3.8.2.1 Input Header Descriptor
//
STRINGLIST slInputHeaderControls[]=
{
{1, "Key Frame Rate" , ""},
{2, "P Frame Rate" , ""},
{4, "Compression Quality" , ""},
{8, "Compression Window Size", ""},
{0x10, "Generate Key Frame" , ""},
{0x20, "Update Frame Segment" , ""},
{0x40, "Reserved" , ""},
{0x80, "Reserved" , ""},
};
STRINGLIST slOutputHeaderControls[]=
{
{1, "Key Frame Rate" , ""},
{2, "P Frame Rate" , ""},
{4, "Compression Quality" , ""},
{8, "Compression Window Size", ""},
{0x10, "Reserved" , ""},
{0x20, "Reserved" , ""},
{0x40, "Reserved" , ""},
{0x80, "Reserved" , ""},
};
STRINGLIST slMediaTransportControls[]=
{
{1, "Transport Control" , ""},
{2, "Absolute Track Number Control", ""},
{4, "Media Information" , ""},
{8, "Time Code Information" , ""},
{0x10, "Reserved" , ""},
{0x20, "Reserved" , ""},
{0x40, "Reserved" , ""},
{0x80, "Reserved" , ""},
};
STRINGLIST slMediaTransportModes1[]=
{
{1, "Play Forward", ""},
{2, "Pause", ""},
{4, "Rewind", ""},
{8, "Fast Forward", ""},
{0x10, "High Speed Rewind", ""},
{0x20, "Stop", ""},
{0x40, "Eject", ""},
{0x80, "Play Next Frame", ""},
};
STRINGLIST slMediaTransportModes2[]=
{
{1, "Play Slowest Forward", ""},
{2, "Play Slow Forward 4", ""},
{4, "Play Slow Forward 3", ""},
{8, "Play Slow Forward 2", ""},
{0x10, "Play Slow Forward 1", ""},
{0x20, "Play X1", ""},
{0x40, "Play Fast Forward 1", ""},
{0x80, "Play Fast Forward 2", ""},
};
STRINGLIST slMediaTransportModes3[]=
{
{1, "Play Fast Forward 3", ""},
{2, "Play Fast Forward 4", ""},
{4, "Play Fastest Forward", ""},
{8, "Play Previous Frame", ""},
{0x10, "Play Slowest Reverse", ""},
{0x20, "Play Slow Reverse 4", ""},
{0x40, "Play Slow Reverse 3", ""},
{0x80, "Play Slow Reverse 2", ""},
};
STRINGLIST slMediaTransportModes4[]=
{
{1, "Play Slow Reverse 1", ""},
{2, "Play X1 Reverse", ""},
{4, "Play Fast Reverse 1", ""},
{8, "Play Fast Reverse 2", ""},
{0x10, "Play Fast Reverse 3", ""},
{0x20, "Play Fast Reverse 4", ""},
{0x40, "Play Fastest Reverse", ""},
{0x80, "Record StateStart", ""},
};
STRINGLIST slMediaTransportModes5[]=
{
{1, "Record Pause", ""},
{2, "Reserved", ""},
{4, "Reserved", ""},
{8, "Reserved", ""},
{0x10, "Reserved", ""},
{0x20, "Reserved", ""},
{0x40, "Reserved", ""},
{0x80, "Reserved", ""},
};
STRINGLIST slInputTermTypes[]=
{
{0x0100, "TT_VENDOR_SPECIFIC", "I//O"},
{0x0101, "TT_STREAMING", "I//O"},
{0x0400, "EXTERNAL_VENDOR_SPECIFIC", "I//O"},
{0x0401, "COMPOSITE_CONNECTOR", "I//O"},
{0x0402, "SVIDEO_CONNECTOR", "I//O"},
{0x0403, "COMPONENT_CONNECTOR", "I//O"},
{0x0200, "ITT_VENDOR_SPECIFIC", "I"},
{0x0201, "ITT_CAMERA", "I"},
{0x0202, "ITT_MEDIA_TRANSPORT_INPUT", "I"},
};
STRINGLIST slOutputTermTypes[]=
{
{0x0100, "TT_VENDOR_SPECIFIC", "I//O"},
{0x0101, "TT_STREAMING", "I//O"},
{0x0400, "EXTERNAL_VENDOR_SPECIFIC", "I//O"},
{0x0401, "COMPOSITE_CONNECTOR", "I//O"},
{0x0402, "SVIDEO_CONNECTOR", "I//O"},
{0x0403, "COMPONENT_CONNECTOR", "I//O"},
{0x0300, "OTT_VENDOR_SPECIFIC", "O"},
{0x0301, "OTT_DISPLAY", "O"},
{0x0302, "OTT_MEDIA_TRANSPORT_OUTPUT", "O"},
};
//*****************************************************************************
// L O C A L F U N C T I O N P R O T O T Y P E S
//*****************************************************************************
BOOL
DisplayVCHeader (
PVIDEO_CONTROL_HEADER_UNIT VCInterfaceDesc
);
BOOL
DisplayVCInputTerminal (
PVIDEO_INPUT_TERMINAL VidITDesc,
PSTRING_DESCRIPTOR_NODE StringDescs,
DEVICE_POWER_STATE LatestDevicePowerState
);
BOOL
DisplayVCOutputTerminal (
PVIDEO_OUTPUT_TERMINAL VidOTDesc,
PSTRING_DESCRIPTOR_NODE StringDescs,
DEVICE_POWER_STATE LatestDevicePowerState
);
BOOL
DisplayVCCameraTerminal (
PVIDEO_CAMERA_TERMINAL CameraDesc
);
BOOL
DisplayVCMediaTransInputTerminal (
PVIDEO_INPUT_MTT VCMedTransInDesc
);
BOOL
DisplayVCMediaTransOutputTerminal (
PVIDEO_OUTPUT_MTT VCMedTransOutDesc
);
BOOL
DisplayVCSelectorUnit (
PVIDEO_SELECTOR_UNIT VidSelectorDesc,
PSTRING_DESCRIPTOR_NODE StringDescs,
DEVICE_POWER_STATE LatestDevicePowerState
);
BOOL
DisplayVCProcessingUnit (
PVIDEO_PROCESSING_UNIT VidProcessingDesc,
PSTRING_DESCRIPTOR_NODE StringDescs,
DEVICE_POWER_STATE LatestDevicePowerState
);
BOOL
DisplayVCExtensionUnit (
PVIDEO_EXTENSION_UNIT VidExtensionDesc,
PSTRING_DESCRIPTOR_NODE StringDescs,
DEVICE_POWER_STATE LatestDevicePowerState
);
BOOL
DisplayVidInHeader (
PVIDEO_STREAMING_INPUT_HEADER VidInHeaderDesc
);
BOOL
DisplayVidOutHeader (
PVIDEO_STREAMING_OUTPUT_HEADER VidOutHeaderDesc
);
BOOL
DisplayStillImageFrame (
PVIDEO_STILL_IMAGE_FRAME StillFrameDesc
);
BOOL
DisplayColorMatching (
PVIDEO_COLORFORMAT ColorMatchDesc
);
BOOL
DisplayUncompressedFormat (
PVIDEO_FORMAT_UNCOMPRESSED UnCompFormatDesc
);
BOOL
DisplayUncompressedFrameType (
PVIDEO_FRAME_UNCOMPRESSED UnCompFrameDesc
);
BOOL
DisplayUnComContinuousFrameType(
PVIDEO_FRAME_UNCOMPRESSED UContinuousDesc
);
BOOL
DisplayUnComDiscreteFrameType(
PVIDEO_FRAME_UNCOMPRESSED UDiscreteDesc
);
BOOL
DisplayMJPEGFormat (
PVIDEO_FORMAT_MJPEG MJPEGFormatDesc
);
BOOL
DisplayMJPEGFrameType (
PVIDEO_FRAME_MJPEG MJPEGFrameDesc
);
BOOL
DisplayMJPEGContinuousFrameType(
PVIDEO_FRAME_MJPEG MContinuousDesc
);
BOOL
DisplayMJPEGDiscreteFrameType(
PVIDEO_FRAME_MJPEG MDiscreteDesc
);
BOOL
DisplayMPEG1SSFormat (
PVIDEO_FORMAT_MPEG1SS MPEG1SSFormatDesc
);
BOOL
DisplayMPEG2PSFormat (
PVIDEO_FORMAT_MPEG2PS MPEG2PSFormatDesc
);
BOOL
DisplayMPEG2TSFormat (
PVIDEO_FORMAT_MPEG2TS MPEG2TSFormatDesc
);
BOOL
DisplayMPEG4SLFormat (
PVIDEO_FORMAT_MPEG4SL MPEG4SLFormatDesc
);
BOOL
DisplayDVFormat (
PVIDEO_FORMAT_DV DVFormatDesc
);
BOOL
DisplayVendorVidFormat (
PVIDEO_FORMAT_VENDOR VendorVidFormatDesc
);
BOOL
DisplayVendorVidFrameType (
PVIDEO_FRAME_VENDOR VendorVidFrameDesc
);
BOOL
DisplayVendorVidContinuousFrameType(
PVIDEO_FRAME_VENDOR VContinuousDesc
);
BOOL
DisplayVendorVidDiscreteFrameType(
PVIDEO_FRAME_VENDOR VDiscreteDesc
);
BOOL
DisplayFramePayloadFormat(
PVIDEO_FORMAT_FRAME FramePayloadFormatDesc
);
BOOL
DisplayFramePayloadFrame(
PVIDEO_FRAME_FRAME FramePayloadFrameDesc
);
BOOL
DisplayFramePayloadContinuousFrameType(
PVIDEO_FRAME_FRAME FContinuousDesc
);
BOOL
DisplayFramePayloadDiscreteFrameType(
PVIDEO_FRAME_FRAME FDiscreteDesc
);
BOOL
DisplayStreamPayload(
PVIDEO_FORMAT_STREAM StreamPayloadDesc
);
BOOL
DisplayVSEndpoint (
PVIDEO_CS_INTERRUPT VidEndpointDesc
);
VOID
VDisplayBytes (
PUCHAR Data,
USHORT Len
);
PCHAR
VidFormatGUIDCodeToName (
REFGUID VidFormatGUIDCode
);
UINT
GetVCInterfaceSize (
PVIDEO_CONTROL_HEADER_UNIT VCInterfaceDesc
);
UINT
CheckForColorMatchingDesc (
PVIDEO_SPECIFIC FormatDesc,
UCHAR bNumFrameDescriptors,
UCHAR bDescriptorSubtype
);
UINT
GetVSInterfaceSize (
PUSB_COMMON_DESCRIPTOR VidInHeaderDesc,
USHORT wTotalLength
);
BOOL
ValidateTerminalID(
UINT uTerminalID
);
VOID
VDisplayDescString (
UINT uControlSize,
PUCHAR pControl ,
PSTRINGLIST pslControl
);
//*****************************************************************************
// L O C A L F U N C T I O N S
//*****************************************************************************
//*****************************************************************************
//
// DisplayVideoDescriptor() UPDATED
//
// VidCommonDesc - An Video Class Descriptor
//
// bInterfaceSubClass - The SubClass of the Interface containing the descriptor
//
//*****************************************************************************
BOOL
DisplayVideoDescriptor (
PVIDEO_SPECIFIC VidCommonDesc,
UCHAR bInterfaceSubClass,
PSTRING_DESCRIPTOR_NODE StringDescs,
DEVICE_POWER_STATE LatestDevicePowerState
)
{
//@@DisplayVideoDescriptor -Class-Specific Video Descriptor
switch (VidCommonDesc->bDescriptorType)
{
case CS_INTERFACE:
//@@DisplayVideoDescriptor -Class-Specific Video Interface Descriptor
switch (bInterfaceSubClass)
{
case VIDEO_SUBCLASS_CONTROL:
//@@DisplayVideoDescriptor -Class-Specific Video Control Interface Descriptor
switch (VidCommonDesc->bDescriptorSubtype)
{
case VC_HEADER:
return DisplayVCHeader(
(PVIDEO_CONTROL_HEADER_UNIT)VidCommonDesc);
case INPUT_TERMINAL:
return DisplayVCInputTerminal(
(PVIDEO_INPUT_TERMINAL)VidCommonDesc,
StringDescs,
LatestDevicePowerState);
case OUTPUT_TERMINAL:
return DisplayVCOutputTerminal(
(PVIDEO_OUTPUT_TERMINAL)VidCommonDesc,
StringDescs,
LatestDevicePowerState);
case SELECTOR_UNIT:
return DisplayVCSelectorUnit(
(PVIDEO_SELECTOR_UNIT)VidCommonDesc,
StringDescs,
LatestDevicePowerState);
case PROCESSING_UNIT:
return DisplayVCProcessingUnit(
(PVIDEO_PROCESSING_UNIT)VidCommonDesc,
StringDescs,
LatestDevicePowerState);
case EXTENSION_UNIT:
return DisplayVCExtensionUnit(
(PVIDEO_EXTENSION_UNIT)VidCommonDesc,
StringDescs,
LatestDevicePowerState);
#ifdef H264_SUPPORT
case H264_ENCODING_UNIT:
return DisplayVCH264EncodingUnit(
(PVIDEO_ENCODING_UNIT)VidCommonDesc
);
#endif
#ifdef H264_SUPPORT
case MAX_TYPE_UNIT+1:
// for H.264, the bDescriptorSubtype = 7, which is equal to MAX_TYPE_UNIT
// so now MAX_TYPE_UNIT needs to be set to 8
//(TODO: need to change nt\sdpublic\internal\drivers\inc\uvcdesc.h's define
// of MAX_TYPE_UNIT from7 to 8, and ad the type for H.264 = 8)
#else
case MAX_TYPE_UNIT:
#endif
//@@TestCase B1.1
//@@CAUTION
//@@Descriptor Field - bDescriptorSubtype
//@@An undefined descriptor subtype has been defined
AppendTextBuffer("*!*CAUTION: This is an undefined class specific "\
"Video Control bDescriptorSubtype\r\n");
break;
default:
//@@TestCase B1.2
//@@ERROR
//@@Descriptor Field - bDescriptorSubtype
//@@An unknown descriptor subtype has been defined
AppendTextBuffer("*!*ERROR: unknown bDescriptorSubtype\r\n");
OOPS();
break;
}
break;
case VIDEO_SUBCLASS_STREAMING:
//@@DisplayVideoDescriptor -Class-Specific Video Streaming Interface Descriptor
switch (VidCommonDesc->bDescriptorSubtype)
{
case VS_INPUT_HEADER:
return DisplayVidInHeader(
(PVIDEO_STREAMING_INPUT_HEADER)VidCommonDesc);
case VS_OUTPUT_HEADER:
return DisplayVidOutHeader(
(PVIDEO_STREAMING_OUTPUT_HEADER)VidCommonDesc);
case VS_STILL_IMAGE_FRAME:
return DisplayStillImageFrame(
(PVIDEO_STILL_IMAGE_FRAME)VidCommonDesc);
case VS_FORMAT_UNCOMPRESSED:
#ifdef H264_SUPPORT
{
BOOL retCode = DisplayUncompressedFormat( (PVIDEO_FORMAT_UNCOMPRESSED)VidCommonDesc );
g_expectedNumberOfUncompressedFrameFrameDescriptors += ((PVIDEO_FORMAT_UNCOMPRESSED)VidCommonDesc)->bNumFrameDescriptors;
return retCode;
}
#else
return DisplayUncompressedFormat(
(PVIDEO_FORMAT_UNCOMPRESSED)VidCommonDesc);
#endif
case VS_FRAME_UNCOMPRESSED:
#ifdef H264_SUPPORT
{
BOOL retCode = DisplayUncompressedFrameType( (PVIDEO_FRAME_UNCOMPRESSED)VidCommonDesc );
g_numberOfUncompressedFrameFrameDescriptors++;
return retCode;
}
#else
return DisplayUncompressedFrameType(
(PVIDEO_FRAME_UNCOMPRESSED)VidCommonDesc);
#endif
#ifdef H264_SUPPORT
case VS_FORMAT_H264:
{
BOOL retCode = DisplayVCH264Format( (PVIDEO_FORMAT_H264)VidCommonDesc );
g_expectedNumberOfH264FrameDescriptors += ((PVIDEO_FORMAT_H264)VidCommonDesc)->bNumFrameDescriptors;
return retCode;
}
case VS_FRAME_H264:
{
BOOL retCode = DisplayVCH264FrameType( (PVIDEO_FRAME_H264)VidCommonDesc );
g_numberOfH264FrameDescriptors++;
return retCode;
}
#endif
case VS_FORMAT_MJPEG:
#ifdef H264_SUPPORT // additional checks
{
BOOL retCode = DisplayMJPEGFormat( (PVIDEO_FORMAT_MJPEG)VidCommonDesc );
g_expectedNumberOfMJPEGFrameDescriptors += ((PVIDEO_FORMAT_MJPEG)VidCommonDesc)->bNumFrameDescriptors;
return retCode;
}
#else
return DisplayMJPEGFormat(
(PVIDEO_FORMAT_MJPEG)VidCommonDesc);
#endif
case VS_FRAME_MJPEG:
#ifdef H264_SUPPORT
{
BOOL retCode = DisplayMJPEGFrameType( (PVIDEO_FRAME_MJPEG)VidCommonDesc );
g_numberOfMJPEGFrameDescriptors++;
return retCode;
}
#else
return DisplayMJPEGFrameType(
(PVIDEO_FRAME_MJPEG)VidCommonDesc);
#endif
case VS_FORMAT_MPEG1:
{
if (UVC10 == g_chUVCversion)
{
return DisplayMPEG1SSFormat(
(PVIDEO_FORMAT_MPEG1SS)VidCommonDesc);
}
else // this format is obsoleted in UVC version >= 1.1
{
AppendTextBuffer("*!*ERROR: obsoleted bDescriptorSubtype\r\n");
OOPS();
break;
}
}
case VS_FORMAT_MPEG2PS:
{
if (UVC10 == g_chUVCversion)
{
return DisplayMPEG2PSFormat(
(PVIDEO_FORMAT_MPEG2PS)VidCommonDesc);
}
else // this format is obsoleted in UVC version >= 1.1
{
AppendTextBuffer("*!*ERROR: obsoleted bDescriptorSubtype\r\n");
OOPS();
break;
}
}
case VS_FORMAT_MPEG2TS:
return DisplayMPEG2TSFormat(
(PVIDEO_FORMAT_MPEG2TS)VidCommonDesc);
case VS_FORMAT_MPEG4SL:
{
if (UVC10 == g_chUVCversion)
{
return DisplayMPEG4SLFormat(
(PVIDEO_FORMAT_MPEG4SL)VidCommonDesc);
}
else // this format is obsoleted in UVC version >= 1.1
{
AppendTextBuffer("*!*ERROR: obsoleted bDescriptorSubtype\r\n");
OOPS();
break;
}
}
case VS_FORMAT_DV:
return DisplayDVFormat(
(PVIDEO_FORMAT_DV)VidCommonDesc);
case VS_COLORFORMAT:
return DisplayColorMatching(
(PVIDEO_COLORFORMAT)VidCommonDesc);
case VS_FORMAT_VENDOR:
{
if (UVC10 == g_chUVCversion)
{
return DisplayVendorVidFormat(
(PVIDEO_FORMAT_VENDOR)VidCommonDesc);
}
else // this format is obsoleted in UVC version >= 1.1
{
AppendTextBuffer("*!*ERROR: obsoleted bDescriptorSubtype\r\n");
OOPS();
break;
}
}
case VS_FRAME_VENDOR:
{
if (UVC10 == g_chUVCversion)
{
return DisplayVendorVidFrameType(
(PVIDEO_FRAME_VENDOR)VidCommonDesc);
}
else // this format is obsoleted in UVC version >= 1.1
{
AppendTextBuffer("*!*ERROR: obsoleted bDescriptorSubtype\r\n");
OOPS();
break;
}
}
case VS_FORMAT_FRAME_BASED:
{
if (UVC10 != g_chUVCversion)
{
return DisplayFramePayloadFormat(
(PVIDEO_FORMAT_FRAME)VidCommonDesc);
}
else // this format did not exist in UVC 1.0
{
AppendTextBuffer("*!*ERROR: bDescriptorSubtype did not exist in UVC 1.0\r\n");
OOPS();
break;
}
}
case VS_FRAME_FRAME_BASED:
{
if (UVC10 != g_chUVCversion)
{
return DisplayFramePayloadFrame(
(PVIDEO_FRAME_FRAME)VidCommonDesc);
}
else // this format did not exist in UVC 1.0
{
AppendTextBuffer("*!*ERROR: bDescriptorSubtype did not exist in UVC 1.0\r\n");
OOPS();
break;
}
}
case VS_FORMAT_STREAM_BASED:
{
if (UVC10 != g_chUVCversion)
{
return DisplayStreamPayload(
(PVIDEO_FORMAT_STREAM)VidCommonDesc);
}
else // this format did not exist in UVC 1.0
{
AppendTextBuffer("*!*ERROR: bDescriptorSubtype did not exist in UVC 1.0\r\n");
OOPS();
break;
}
}
case VS_DESCRIPTOR_UNDEFINED:
//@@TestCase B1.3
//@@CAUTION
//@@Descriptor Field - bDescriptorSubtype
//@@An undefined descriptor subtype has been defined
AppendTextBuffer("*!*CAUTION: This is an undefined class specific Video "\
"Streaming bDescriptorSubtype\r\n");
break;
default:
//@@TestCase B1.4
//@@ERROR
//@@Descriptor Field - bDescriptorSubtype
//@@An unknown descriptor subtype has been defined
AppendTextBuffer("*!*ERROR: unknown bDescriptorSubtype\r\n");
OOPS();
break;
}
break;
default:
//@@TestCase B1.6
//@@ERROR
//@@Descriptor Field - bInterfaceSubClass
//@@An unknown interface sub-class has been defined
AppendTextBuffer("*!*ERROR: unknown bInterfaceSubClass\r\n");
OOPS();
break;
}
break;
case CS_ENDPOINT:
//@@DisplayVideoDescriptor -Class-Specific Video Endpoint Descriptor
switch (VidCommonDesc->bDescriptorSubtype)
{
//@@TestCase B1.7
//@@CAUTION
//@@Descriptor Field - bInterfaceSubtype
//@@An undefined descriptor subtype has been defined
case EP_UNDEFINED:
AppendTextBuffer("*!*CAUTION: This is an undefined bDescriptorSubtype\r\n");
break;
//@@TestCase B1.8
//@@Not yet implemented - Priority 3
//@@Descriptor Field - bDescriptorSubtype
//@@Question: How valid are VIDEO_EP_GENERAL and VIDEO_EP_ENDPOINT? Should we test?
case EP_GENERAL:
break;
case EP_ENDPOINT:
break;
case EP_INTERRUPT:
return DisplayVSEndpoint(
(PVIDEO_CS_INTERRUPT)VidCommonDesc);
break;
default:
//@@TestCase B1.9
//@@ERROR
//@@Descriptor Field - bDescriptorSubtype
//@@An unknown descriptor subtype has been defined
AppendTextBuffer("*!*CAUTION: Unknown bDescriptorSubtype");
break;
}
break;
//@@DisplayVideoDescriptor -Class-Specific Video Device Descriptor
//@@DisplayVideoDescriptor -Class-Specific Video Configuration Descriptor
//@@DisplayVideoDescriptor -Class-Specific Video String Descriptor
//@@DisplayVideoDescriptor -Class-Specific Video Undefined Descriptor
//@@TestCase B1.10
//@@Not yet implemented - Priority 3
//@@Descriptor -Class-Specific Device, Configuration, String, Undefined
//@@Descriptor Field - bDescriptorType
//@@Question: How valid are these Descriptor Types? Should we test?
/* case USB_VIDEO_CS_DEVICE:
AppendTextBuffer("USB_VIDEO_CS_DEVICE bDescriptorType\r\n");
break;
case USB_VIDEO_CS_CONFIGURATION:
AppendTextBuffer("USB_VIDEO_CS_CONFIGURATION bDescriptorType\r\n");
break;
case USB_VIDEO_CS_STRING:
AppendTextBuffer("USB_VIDEO_CS_STRING bDescriptorType\r\n");
break;
case USB_VIDEO_CS_UNDEFINED:
AppendTextBuffer("USB_VIDEO_CS_UNDEFINED bDescriptorType\r\n");
break;
*/
default:
//@@TestCase B1.11
//@@ERROR
//@@Descriptor Field - bDescriptorType
//@@An unknown descriptor type has been defined
AppendTextBuffer("*!*CAUTION: Unknown bDescriptorSubtype");
OOPS();
break;
}
return FALSE;
}
//*****************************************************************************
//
// DisplayVCHeader()
//
//*****************************************************************************
BOOL
DisplayVCHeader (
PVIDEO_CONTROL_HEADER_UNIT VCInterfaceDesc
)
{
//@@DisplayVCHeader -Video Control Interface Header
UINT i = 0;
UINT uSize = 0;
PUCHAR pData = NULL;
AppendTextBuffer("\r\n ===>Class-Specific Video Control Interface Header "\
"Descriptor<===\r\n");
AppendTextBuffer("bLength: 0x%02X\r\n", VCInterfaceDesc->bLength);
AppendTextBuffer("bDescriptorType: 0x%02X\r\n", VCInterfaceDesc->bDescriptorType);
AppendTextBuffer("bDescriptorSubtype: 0x%02X\r\n", VCInterfaceDesc->bDescriptorSubtype);
if ( UVC10 == g_chUVCversion )
{
AppendTextBuffer("bcdVDC: 0x%04X\r\n", VCInterfaceDesc->bcdVideoSpec);
}
else
{
AppendTextBuffer("bcdUVC: 0x%04X\r\n", VCInterfaceDesc->bcdVideoSpec);
}
AppendTextBuffer("wTotalLength: 0x%04X", VCInterfaceDesc->wTotalLength);
// Verify the total interface size (size of this header and all descriptors
// following until and not including the first endpoint)
uSize = GetVCInterfaceSize(VCInterfaceDesc);
if (uSize != VCInterfaceDesc->wTotalLength) {
AppendTextBuffer("\r\n*!*ERROR: Invalid total interface size 0x%02X, should be 0x%02X\r\n",
VCInterfaceDesc->wTotalLength, uSize);
} else {
AppendTextBuffer(" -> Validated\r\n");
}
AppendTextBuffer("dwClockFreq: 0x%08X",
VCInterfaceDesc->dwClockFreq);
if (gDoAnnotation)
{
AppendTextBuffer(" = (%d) Hz", VCInterfaceDesc->dwClockFreq);
}
AppendTextBuffer("\r\nbInCollection: 0x%02X\r\n",
VCInterfaceDesc->bInCollection);
// baInterfaceNr is a variable length field
// Size is in bInCollection
for (i = 1, pData = (PUCHAR) &VCInterfaceDesc->bInCollection;
i <= VCInterfaceDesc->bInCollection; i++, pData++)
{
AppendTextBuffer("baInterfaceNr[%d]: 0x%02X\r\n",
i, *pData);
}
uSize = (sizeof(VIDEO_CONTROL_HEADER_UNIT) + VCInterfaceDesc->bInCollection);
if (VCInterfaceDesc->bLength != uSize)
{
//@@TestCase B2.1 (also in Descript.c)
//@@ERROR
//@@Descriptor Field - bLength
//@@The declared length in the device descriptor is less than required length in
//@@ the USB Video Device Specification
AppendTextBuffer("*!*ERROR: bLength of %d incorrect, should be %d\r\n",
VCInterfaceDesc->bLength, uSize);
OOPS();
}
//@@TestCase B2.2 (also in Descript.c)
//@@WARNING
//@@Descriptor Field - bcdVDC
//@@The bcdVDC version of the device is not the same as the version of used by USBView
if(VCInterfaceDesc->bcdVideoSpec < BCDVDC)
{
AppendTextBuffer("*!*WARNING: This device is set to the old USB Video "\
"Class spec version 0x%04X\r\n", VCInterfaceDesc->bcdVideoSpec);
OOPS();
}
if (VCInterfaceDesc->dwClockFreq < 1)
{
//@@TestCase B2.3 (Descript.c Line 70)
//@@WARNING
//@@dwClockFrequency should be greater than 0
//@@Question should we check that any non-zero value is accurate
AppendTextBuffer("*!*ERROR: dwClockFreq must be non-zero\r\n");
OOPS();
}
//@@TestCase B2.4
//@@Not yet implemented - Priority 1
//@@Descriptor Field - baInterfaceNr
//@@We should test to verify each interface number is valid?
// for (i=0; i<VCInterfaceDesc->bInCollection; i++)
// {AppendTextBuffer("baInterfaceNr[%d]: 0x%02X\r\n", i+1,
// VCInterfaceDesc->baInterfaceNr[i]);}
if (gDoAnnotation)
{
switch(g_chUVCversion)
{
case UVC10:
AppendTextBuffer("USB Video Class device: spec version 1.0\r\n");
break;
case UVC11:
AppendTextBuffer("USB Video Class device: spec version 1.1\r\n");
break;
#ifdef H264_SUPPORT
case UVC15:
AppendTextBuffer("USB Video Class device: spec version 1.5\r\n");
break;
#endif
default:
break;
}
}
return TRUE;
}
//*****************************************************************************
//
// DisplayVCInputTerminal()
//
//*****************************************************************************
BOOL