Sample Code
windows driver samples/ USBView sample application/ C++/ 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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 | /*++ 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 DisplayVCInputTerminal ( PVIDEO_INPUT_TERMINAL VidITDesc, PSTRING_DESCRIPTOR_NODE StringDescs, DEVICE_POWER_STATE LatestDevicePowerState ) { //@@DisplayVCInputTerminal -Video Control Input Terminal PCHAR pStr = NULL; AppendTextBuffer( "\r\n ===>Video Control Input Terminal Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , VidITDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , VidITDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , VidITDesc->bDescriptorSubtype); AppendTextBuffer( "bTerminalID: 0x%02X\r\n" , VidITDesc->bTerminalID); AppendTextBuffer( "wTerminalType: 0x%04X" , VidITDesc->wTerminalType); if (gDoAnnotation) { pStr = GetStringFromList(slInputTermTypes, sizeof (slInputTermTypes) / sizeof (STRINGLIST), VidITDesc->wTerminalType, "Invalid Input Terminal Type" ); AppendTextBuffer( " = (%s)" , pStr); } AppendTextBuffer( "\r\n" ); AppendTextBuffer( "bAssocTerminal: 0x%02X\r\n" , VidITDesc->bAssocTerminal); AppendTextBuffer( "iTerminal: 0x%02X\r\n" , VidITDesc->iTerminal); if (gDoAnnotation) { if (VidITDesc->iTerminal) { // if executing this code, the configuration descriptor has been // obtained. If a device is suspended, then its configuration // descriptor was not obtained and we do not want errors to be // displayed when string descriptors were not obtained. DisplayStringDescriptor(VidITDesc->iTerminal, StringDescs, LatestDevicePowerState); } } if (VidITDesc->bLength < sizeof (VIDEO_INPUT_TERMINAL)) { //@@TestCase B3.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 is too small\r\n" , VidITDesc->bLength); OOPS(); } if (VidITDesc->bTerminalID < 1) { //@@TestCase B3.2 (descript.c line 133) //@@ERROR //@@Descriptor Field - bTerminalID //@@bTerminalID should be greater than 0 //@@Question: Should test to verify terminal number is valid AppendTextBuffer( "*!*ERROR: bTerminalID of %d is too small\r\n" , VidITDesc->bTerminalID); OOPS(); } if (!(pStr)) { //@@TestCase B3.3 //@@CAUTION //@@Descriptor Field - wTerminalType //@@No valid Terminal Type was found AppendTextBuffer( "*!*CAUTION: 0x%04X is an unknown wTerminalType for an Input " \ "Terminal\r\n" , VidITDesc->wTerminalType); OOPS(); } //@@TestCase B3.4 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bAssocTerminal //@@Should test to verify terminal number is valid? // AppendTextBuffer("bAssocTerminal: 0x%02X\r\n", VidITDesc->bAssocTerminal); switch (VidITDesc->wTerminalType) { case 0x0100: // TT_VENDOR_SPECIFIC Terminal Type break ; case 0x0101: // TT_STREAMING Terminal Type break ; case 0x0200: // ITT_VENDOR_SPECIFIC Terminal Type break ; case 0x0201: // ITT_CAMERA Terminal Type return DisplayVCCameraTerminal( (PVIDEO_CAMERA_TERMINAL)VidITDesc); case 0x0202: // ITT_MEDIA_TRANSPORT_INPUT Terminal Type return DisplayVCMediaTransInputTerminal( (PVIDEO_INPUT_MTT)VidITDesc); case 0x0400: // EXTERNAL_VENDOR_SPECIFIC Terminal Type break ; case 0x0401: // COMPOSITE_CONNECTOR Terminal Type break ; case 0x0402: // SVIDEO_CONNECTOR Terminal Type break ; case 0x0403: // COMPONENT_CONNECTOR Terminal Type break ; default : break ; } return TRUE; } //***************************************************************************** // // DisplayVCOutputTerminal() // //***************************************************************************** BOOL DisplayVCOutputTerminal ( PVIDEO_OUTPUT_TERMINAL VidOTDesc, PSTRING_DESCRIPTOR_NODE StringDescs, DEVICE_POWER_STATE LatestDevicePowerState ) { //@@DisplayVCOutputTerminal -Video Control Output Terminal PCHAR pStr = NULL; AppendTextBuffer( "\r\n ===>Video Control Output Terminal Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , VidOTDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , VidOTDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , VidOTDesc->bDescriptorSubtype); AppendTextBuffer( "bTerminalID: 0x%02X\r\n" , VidOTDesc->bTerminalID); AppendTextBuffer( "wTerminalType: 0x%04X" , VidOTDesc->wTerminalType); if (gDoAnnotation) { pStr = GetStringFromList(slOutputTermTypes, sizeof (slOutputTermTypes) / sizeof (STRINGLIST), VidOTDesc->wTerminalType, "Invalid Output Terminal Type" ); AppendTextBuffer( " = (%s)" , pStr); } AppendTextBuffer( "\r\n" ); AppendTextBuffer( "bAssocTerminal: 0x%02X\r\n" , VidOTDesc->bAssocTerminal); AppendTextBuffer( "bSourceID: 0x%02X\r\n" , VidOTDesc->bSourceID); AppendTextBuffer( "iTerminal: 0x%02X\r\n" , VidOTDesc->iTerminal); if (gDoAnnotation) { if (VidOTDesc->iTerminal) { // if executing this code, the configuration descriptor has been // obtained. If a device is suspended, then its configuration // descriptor was not obtained and we do not want errors to be // displayed when string descriptors were not obtained. DisplayStringDescriptor(VidOTDesc->iTerminal, StringDescs, LatestDevicePowerState); } } if (VidOTDesc->bLength < sizeof (PVIDEO_OUTPUT_TERMINAL)) { //@@TestCase B4.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 is too small\r\n" , VidOTDesc->bLength); OOPS(); } if (VidOTDesc->bTerminalID < 1) { //@@TestCase B4.2 (see Descript.c line 328) //@@ERROR //@@Descriptor Field - bTerminalID //@@bTerminalID should be greater than 0 //@@Question: Should test to verify terminal number is valid AppendTextBuffer( "*!*ERROR: bTerminalID of %d is too small\r\n" , VidOTDesc->bTerminalID); OOPS(); } if (!(pStr)) { //@@TestCase B4.3 //@@ERROR //@@Descriptor Field - wTerminalType //@@No valid Terminal Type was found AppendTextBuffer( "*!*ERROR: 0x%04X is an invalid wTerminalType for an Output Terminal\r\n" , VidOTDesc->wTerminalType); OOPS(); } //@@TestCase B4.4 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bAssocTerminal //@@We should test to verify terminal number is valid // AppendTextBuffer("bAssocTerminal: 0x%02X\r\n", VidOTDesc->bAssocTerminal); if (VidOTDesc->bSourceID < 1) { //@@TestCase B4.5 (see Descript.c line 333) //@@ERROR //@@Descriptor Field - bSourceID //@@bSourceID should be greater than 0 //@@Question: Should test to verify source number is valid AppendTextBuffer( "*!*ERROR: bSourceID of %d is too small\r\n" , VidOTDesc->bSourceID); OOPS(); } switch (VidOTDesc->wTerminalType) { case 0x0100: // TT_VENDOR_SPECIFIC Terminal Type break ; case 0x0101: // TT_STREAMING Terminal Type break ; case 0x0300: // OTT_VENDOR_SPECIFIC Terminal Type break ; case 0x0301: // OTT_DISPLAY Terminal Type break ; case 0x0302: // OTT_MEDIA_TRANSPORT_OUTPUT Terminal Type return DisplayVCMediaTransOutputTerminal( (PVIDEO_OUTPUT_MTT)VidOTDesc); case 0x0400: // EXTERNAL_VENDOR_SPECIFIC Terminal Type break ; case 0x0401: // COMPOSITE_CONNECTOR Terminal Type break ; case 0x0402: // SVIDEO_CONNECTOR Terminal Type break ; case 0x0403: // COMPONENT_CONNECTOR Terminal Type break ; default : break ; } return TRUE; } //***************************************************************************** // // DisplayVCMediaTransInputTerminal() // //***************************************************************************** BOOL DisplayVCMediaTransInputTerminal( PVIDEO_INPUT_MTT MediaTransportInDesc ) { //@@DisplayVCMediaTransInputTerminal -Video Control Media Transport Input Terminal UCHAR p = 0; PUCHAR pData = NULL; size_t bLength = 0; bLength = SizeOfVideoInputMTT(MediaTransportInDesc); AppendTextBuffer( "===>Additional Media Transport Input Terminal Data\r\n" ); AppendTextBuffer( "bControlSize: 0x%02X\r\n" , MediaTransportInDesc->bControlSize); // point to bControlSize pData = & MediaTransportInDesc->bControlSize; // Are there any controls? if (0 < * pData) { UINT uBitIndex = 0; BYTE cCheckBit = 0; BYTE cMask = 1; AppendTextBuffer( "bmControls : " ); VDisplayBytes(pData + 1, *pData); // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportControls, sizeof (slMediaTransportControls) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportCtrl bmControl value" )); cMask = cMask << 1; } } // point to bTransportModeSize pData = pData + 2 ; // Are there any controls? if (0 < * pData) { UINT uBitIndex = 0; BYTE cCheckBit = 0; BYTE cMask = 1; AppendTextBuffer( "bmControls : " ); VDisplayBytes(pData + 1, *pData); // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportModes1, sizeof (slMediaTransportModes1) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportMode value" )); cMask = cMask << 1; } // Is there a second control? if (1 < * pData) { // map the second control for ( uBitIndex = 8, cMask = 1; uBitIndex < 16; uBitIndex++ ) { cCheckBit = cMask & *(pData + 2); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportModes2, sizeof (slMediaTransportModes2) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportMode value" )); cMask = cMask << 1; } } // Is there a third control? if (2 < * pData) { // map the third control for ( uBitIndex = 16, cMask = 1; uBitIndex < 24; uBitIndex++ ) { cCheckBit = cMask & *(pData + 3); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportModes3, sizeof (slMediaTransportModes3) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportMode value" )); cMask = cMask << 1; } } // Is there a fourth control? if (3 < * pData) { // map the fourth control for ( uBitIndex = 24, cMask = 1; uBitIndex < 32; uBitIndex++ ) { cCheckBit = cMask & *(pData + 4); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportModes4, sizeof (slMediaTransportModes4) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportMode value" )); cMask = cMask << 1; } } // Is there a fifth control? if (4 < * pData) { // map the fifth control for ( uBitIndex = 32, cMask = 1; uBitIndex < 40; uBitIndex++ ) { cCheckBit = cMask & *(pData + 5); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportModes5, sizeof (slMediaTransportModes5) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportMode value" )); cMask = cMask << 1; } } } // The size of a Media Transport Descriptor is // the size of the Descriptor plus // (bControlSize - 1) plus // IF bmControls & 1 THEN 1 (bTransportModeSize) plus // bTransportModeSize // // p = sizeof(VIDEO_INPUT_MTT) + // (MediaTransportInDesc->bControlSize - 1); // if (MediaTransportInDesc->bmControls[0] & 1) // p += 1 + (*pData); if (MediaTransportInDesc->bLength != bLength) { //@@TestCase B5.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength //@@Invalid Descriptor length AppendTextBuffer( "*!*ERROR: Invalid descriptor bLength 0x%02X. " \ "Should be 0x%02X\r\n" , MediaTransportInDesc->bLength, p); OOPS(); } return TRUE; } //***************************************************************************** // // DisplayVCMediaTransOutputTerminal() // //***************************************************************************** BOOL DisplayVCMediaTransOutputTerminal( PVIDEO_OUTPUT_MTT MediaTransportOutDesc ) { //@@DisplayVCMediaTransOutputTerminal -Video Control Media Transport Output Terminal UCHAR p = 0; PUCHAR pData = NULL; AppendTextBuffer( "===>Additional Media Transport Output Terminal Data\r\n" ); AppendTextBuffer( "bControlSize: 0x%02X\r\n" , MediaTransportOutDesc->bControlSize); // point to bControlSize pData = & MediaTransportOutDesc->bControlSize; // Are there any controls? if (0 < * pData) { UINT uBitIndex = 0; BYTE cCheckBit = 0; BYTE cMask = 1; AppendTextBuffer( "bmControls : " ); VDisplayBytes(pData + 1, *pData); // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportControls, sizeof (slMediaTransportControls) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportCtrl bmControl value" )); cMask = cMask << 1; } } // point to bTransportModeSize pData = pData + 2 ; // Are there any controls? if (0 < * pData) { UINT uBitIndex = 0; BYTE cCheckBit = 0; BYTE cMask = 1; AppendTextBuffer( "bmControls : " ); VDisplayBytes(pData + 1, *pData); // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportModes1, sizeof (slMediaTransportModes1) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportMode value" )); cMask = cMask << 1; } // Is there a second control? if (1 < * pData) { // map the second control for ( uBitIndex = 8, cMask = 1; uBitIndex < 16; uBitIndex++ ) { cCheckBit = cMask & *(pData + 2); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportModes2, sizeof (slMediaTransportModes2) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportMode value" )); cMask = cMask << 1; } } // Is there a third control? if (2 < * pData) { // map the third control for ( uBitIndex = 16, cMask = 1; uBitIndex < 24; uBitIndex++ ) { cCheckBit = cMask & *(pData + 3); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportModes3, sizeof (slMediaTransportModes3) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportMode value" )); cMask = cMask << 1; } } // Is there a fourth control? if (3 < * pData) { // map the fourth control for ( uBitIndex = 24, cMask = 1; uBitIndex < 32; uBitIndex++ ) { cCheckBit = cMask & *(pData + 4); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportModes4, sizeof (slMediaTransportModes4) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportMode value" )); cMask = cMask << 1; } } // Is there a fifth control? if (4 < * pData) { // map the fourth control for ( uBitIndex = 32, cMask = 1; uBitIndex < 40; uBitIndex++ ) { cCheckBit = cMask & *(pData + 5); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slMediaTransportModes5, sizeof (slMediaTransportModes5) / sizeof (STRINGLIST), cMask, "Invalid MediaTransportMode value" )); cMask = cMask << 1; } } } // The size of a Media Transport Descriptor is // the size of the Descriptor plus // (bControlSize - 1) plus // IF bmControls & 1 THEN 1 (bTransportModeSize) plus // bTransportModeSize // p = sizeof (VIDEO_OUTPUT_MTT) + (MediaTransportOutDesc->bControlSize - 1); if (MediaTransportOutDesc->bmControls[0] & 1) p += 1 + (*pData); if (MediaTransportOutDesc->bLength != p) { //@@TestCase B5.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength //@@Invalid Descriptor length AppendTextBuffer( "*!*ERROR: Invalid descriptor bLength 0x%02X. " \ "Should be 0x%02X\r\n" , MediaTransportOutDesc->bLength, p); OOPS(); } return TRUE; } //***************************************************************************** // // DisplayVCCameraTerminal() // //***************************************************************************** BOOL DisplayVCCameraTerminal( PVIDEO_CAMERA_TERMINAL CameraDesc ) { //@@DisplayVCCameraTerminal -Video Control Camera Terminal UCHAR p = 0; PUCHAR pData = NULL; AppendTextBuffer( "===>Camera Input Terminal Data\r\n" ); AppendTextBuffer( "wObjectiveFocalLengthMin: 0x%04X\r\n" , CameraDesc->wObjectiveFocalLengthMin); AppendTextBuffer( "wObjectiveFocalLengthMax: 0x%04X\r\n" , CameraDesc->wObjectiveFocalLengthMax); AppendTextBuffer( "wOcularFocalLength: 0x%04X\r\n" , CameraDesc->wOcularFocalLength); AppendTextBuffer( "bControlSize: 0x%02X\r\n" , CameraDesc->bControlSize); pData = &CameraDesc->bControlSize; // Are there any controls? if (0 < * pData) { UINT uBitIndex = 0; BYTE cCheckBit = 0; BYTE cMask = 1; AppendTextBuffer( "bmControls : " ); VDisplayBytes(pData + 1, *pData); // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slCameraControl1, sizeof (slCameraControl1) / sizeof (STRINGLIST), cMask, "Invalid CamCtrl bmControl value" )); cMask = cMask << 1; } // Is there a second control? if (1 < * pData) { // map the second control for ( uBitIndex = 8, cMask = 1; uBitIndex < 16; uBitIndex++ ) { cCheckBit = cMask & *(pData + 2); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slCameraControl2, sizeof (slCameraControl2) / sizeof (STRINGLIST), cMask, "Invalid CamCtrl bmControl value" )); cMask = cMask << 1; } } // Is there a third control? if (2 < * pData) { // map the third control for ( uBitIndex = 16, cMask = 1; uBitIndex < 24; uBitIndex++ ) { cCheckBit = cMask & *(pData + 3); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slCameraControl3, sizeof (slCameraControl3) / sizeof (STRINGLIST), cMask, "Invalid CamCtrl bmControl value" )); cMask = cMask << 1; } } } p = ( sizeof (VIDEO_CAMERA_TERMINAL) + CameraDesc->bControlSize); if (CameraDesc->bLength != p) { //@@TestCase B7.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength //@@The descriptor should be the size of the descriptor structure //@@ plus the number of controls AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , CameraDesc->bLength, p); OOPS(); } //@@TestCase B7.2 //@@Not yet implemented - Priority 3 //@@Descriptor Field - wObjectiveFocalLengthMin //@@Question - Should we do any checking here? What are the acceptable boundaries? //@@Question - Is zero an acceptable value? // AppendTextBuffer("wObjectiveFocalLengthMin: 0x%04X\r\n", CameraDesc->wObjectiveFocalLengthMin); //@@TestCase B7.3 //@@Not yet implemented - Priority 3 //@@Descriptor Field - wObjectiveFocalLengthMax //@@Question - Should we do any checking here? What are the acceptable boundaries //@@Question - Is zero an acceptable value? // AppendTextBuffer("wObjectiveFocalLengthMax: 0x%04X\r\n", CameraDesc->wObjectiveFocalLengthMax); //@@TestCase B7.4 //@@Not yet implemented - Priority 3 //@@Descriptor Field - wOcularFocalLength //@@Question - Should we do any checking here? What are the acceptable boundaries //@@Question - Is zero an acceptable value? // AppendTextBuffer("wOcularFocalLength: 0x%04X\r\n", CameraDesc->wOcularFocalLength); //@@TestCase B7.5 //@@ERROR //@@Descriptor Field - wObjectiveFocalLengthMin and wObjectiveFocalLengthMax //@@Verify that wObjectiveFocalLengthMax is greater than wObjectiveFocalLengthMin if (CameraDesc->wObjectiveFocalLengthMin > CameraDesc->wObjectiveFocalLengthMax) { AppendTextBuffer( "*!*ERROR: wObjectiveFocalLengthMin is larger than wObjectiveFocalLengthMax\r\n" ); OOPS(); } //@@TestCase B7.6 //@@ERROR //@@Descriptor Field - bControlSize //@@Verify that wObjectiveFocalLengthMax is 3 or less if (CameraDesc->bControlSize > 3) { AppendTextBuffer( "*!*ERROR: bControlSize must be 3 or less\r\n" ); OOPS(); } return TRUE; } //***************************************************************************** // // DisplayVCSelectorUnit() // //***************************************************************************** BOOL DisplayVCSelectorUnit ( PVIDEO_SELECTOR_UNIT VidSelectorDesc, PSTRING_DESCRIPTOR_NODE StringDescs, DEVICE_POWER_STATE LatestDevicePowerState ) { //@@DisplayVCSelectorUnit -Video Control Selector Unit UCHAR i = 0; UCHAR p = 0; PUCHAR pData = NULL; AppendTextBuffer( "\r\n ===>Video Control Selector Unit Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , VidSelectorDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , VidSelectorDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , VidSelectorDesc->bDescriptorSubtype); AppendTextBuffer( "bUnitID: 0x%02X\r\n" , VidSelectorDesc->bUnitID); AppendTextBuffer( "bNrInPins: 0x%02X\r\n" , VidSelectorDesc->bNrInPins); if (gDoAnnotation) { AppendTextBuffer( "===>List of Connected Unit and Terminal ID's\r\n" ); } // baSourceID is a variable length field // Size is in bNrInPins, must be at least 1 (so index starts at 1) for (i = 1, pData = ( PUCHAR ) &VidSelectorDesc->baSourceID; i <= VidSelectorDesc->bNrInPins; i++, pData++) { AppendTextBuffer( "baSourceID[%d]: 0x%02X\r\n" , i, *pData); } // get address of iSelector, the last field in this descriptor pData = ( PUCHAR ) VidSelectorDesc + (VidSelectorDesc->bLength - 1); AppendTextBuffer( "iSelector: 0x%02X\r\n" , *pData); if (gDoAnnotation) { if (*pData) { // if executing this code, the configuration descriptor has been // obtained. If a device is suspended, then its configuration // descriptor was not obtained and we do not want errors to be // displayed when string descriptors were not obtained. DisplayStringDescriptor(*pData, StringDescs, LatestDevicePowerState); } } p = ( sizeof (VIDEO_SELECTOR_UNIT) + VidSelectorDesc->bNrInPins + 1); if (VidSelectorDesc->bLength != p) { //@@TestCase B8.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength //@@The descriptor should be the size of the descriptor structure plus the number of pins AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , VidSelectorDesc->bLength, p); OOPS(); } if (VidSelectorDesc->bUnitID < 1) { //@@TestCase B8.2 (Descript.c Line 396) //@@ERROR //@@Descriptor Field - bUnitID //@@bUnitID must be greater than 0 //@@Question: Should we test to verify unit number is unique? AppendTextBuffer( "*!*ERROR: bUnitID must be non-zero\r\n" ); OOPS(); } if (VidSelectorDesc->bNrInPins < 1) { //@@TestCase B8.3 //@@ERROR //@@Descriptor Field - bNrInPins //@@bNrInPins should be greater than 0 //@@Question: Should test to verify total in pins is valid AppendTextBuffer( "*!*ERROR: bNrInPins must be non-zero\r\n" ); OOPS(); } // baSourceID is a variable length field // Size is in bNrInPins, must be at least 1 (so index starts at 1) for (i = 1, pData = ( PUCHAR ) &VidSelectorDesc->baSourceID; i <= VidSelectorDesc->bNrInPins; i++, pData++) { if (*pData < 1) { //@@TestCase B8.4 //@@ERROR //@@Descriptor Field - baSourceID[] //@@baSourceID should be greater than 0 AppendTextBuffer( "*!*ERROR: baSourceID[%d] must be non-zero\r\n" , i); OOPS(); } else { if (! ValidateTerminalID(*pData)) { //@@TestCase B8.5 //@@ERROR //@@Descriptor Field - baSourceID[] //@@baSourceID should be a valid terminal ID AppendTextBuffer( "*!*ERROR: baSourceID[%d] must be non-zero\r\n" , i); OOPS(); } } } return TRUE; } //***************************************************************************** // // DisplayVCProcessingUnit() // //***************************************************************************** BOOL DisplayVCProcessingUnit ( PVIDEO_PROCESSING_UNIT VidProcessingDesc, PSTRING_DESCRIPTOR_NODE StringDescs, DEVICE_POWER_STATE LatestDevicePowerState ) { //@@DisplayVCProcessingUnit -Video Control Processor Unit PUCHAR pData = NULL; UCHAR bLength = 0; AppendTextBuffer( "\r\n ===>Video Control Processing Unit Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , VidProcessingDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , VidProcessingDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , VidProcessingDesc->bDescriptorSubtype); AppendTextBuffer( "bUnitID: 0x%02X\r\n" , VidProcessingDesc->bUnitID); AppendTextBuffer( "bSourceID: 0x%02X\r\n" , VidProcessingDesc->bSourceID); AppendTextBuffer( "wMaxMultiplier: 0x%04X\r\n" , VidProcessingDesc->wMaxMultiplier); AppendTextBuffer( "bControlSize: 0x%02X\r\n" , VidProcessingDesc->bControlSize); pData = &VidProcessingDesc->bControlSize; // Are there any controls? if (0 < * pData) { UINT uBitIndex = 0; BYTE cCheckBit = 0; BYTE cMask = 1; AppendTextBuffer( "bmControls : " ); VDisplayBytes(pData + 1, *pData); // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + 1); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slProcessorControls1, sizeof (slProcessorControls1) / sizeof (STRINGLIST), cMask, "Invalid PU bmControl value" )); cMask = cMask << 1; } // Is there a second control? if (1 < * pData) { // map the second control for ( uBitIndex = 8, cMask = 1; uBitIndex < 16; uBitIndex++ ) { cCheckBit = cMask & *(pData + 2); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slProcessorControls2, sizeof (slProcessorControls2) / sizeof (STRINGLIST), cMask, "Invalid PU bmControl value" )); cMask = cMask << 1; } } // Is there a third control? if (2 < * pData) { // map the third control for ( uBitIndex = 16, cMask = 1; uBitIndex < 24; uBitIndex++ ) { cCheckBit = cMask & *(pData + 3); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slProcessorControls3, sizeof (slProcessorControls3) / sizeof (STRINGLIST), cMask, "Invalid PU bmControl value" )); cMask = cMask << 1; } } } // get address of iProcessing if (UVC10 != g_chUVCversion) { // size of descriptor is struct size plus control size plus 2 if UVC11 bLength = sizeof (VIDEO_PROCESSING_UNIT) + 2 + VidProcessingDesc->bControlSize; pData = ( PUCHAR ) VidProcessingDesc + (VidProcessingDesc->bLength - 2); } else // UVC 1.0 { // size of descriptor is struct size plus control size plus 1 if UVC10 bLength = sizeof (VIDEO_PROCESSING_UNIT) + 1 + VidProcessingDesc->bControlSize; pData = ( PUCHAR ) VidProcessingDesc + (VidProcessingDesc->bLength - 1); } AppendTextBuffer( "iProcessing : 0x%02X\r\n" , *pData); if (gDoAnnotation) { if (*pData) { // if executing this code, the configuration descriptor has been // obtained. If a device is suspended, then its configuration // descriptor was not obtained and we do not want errors to be // displayed when string descriptors were not obtained. DisplayStringDescriptor(*pData, StringDescs, LatestDevicePowerState); } } // check for new UVC 1.1 bmVideoStandards fields if (UVC10 != g_chUVCversion) { UINT uBitIndex = 0; BYTE cCheckBit = 0; BYTE cMask = 1; pData = ( PUCHAR ) VidProcessingDesc + (VidProcessingDesc->bLength - 1); AppendTextBuffer( "bmVideoStandards : " ); VDisplayBytes(pData, 1); // map the first control for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slProcessorVideoStandards, sizeof (slProcessorVideoStandards) / sizeof (STRINGLIST), cMask, "Invalid PU bmVideoStandards value" )); cMask = cMask << 1; } } if (VidProcessingDesc->bLength != bLength) { //@@TestCase B9.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength AppendTextBuffer( "*!*ERROR: bLength of 0x%02X incorrect, should be 0x%02X\r\n" , VidProcessingDesc->bLength, bLength); OOPS(); } if (VidProcessingDesc->bUnitID < 1) { //@@TestCase B9.2 (Descript.c Line 466) //@@ERROR //@@Descriptor Field - bUnitID //@@bUnitID must be greater than 0 //@@Question: Should we test to verify unit number is unique? AppendTextBuffer( "*!*ERROR: bUnitID must be non-zero\r\n" ); OOPS(); } if (VidProcessingDesc->bSourceID < 1) { //@@TestCase B9.3 (Descript.c Line 471) //@@ERROR //@@Descriptor Field - bSourceID //@@bSourceID must be non-zero //@@Question: Should we test to verify the bSourceID is valid? AppendTextBuffer( "*!*ERROR: bSourceID must be non-zero\r\n" ); OOPS(); } //@@TestCase B9.4 //@@Not yet implemented - Priority 1 //@@Descriptor Field - wMaxMultiplier //@@We should test to verify multiplier is valid // AppendTextBuffer("wMaxMultiplier: 0x%04X\r\n", VidProcessingDesc->wMaxMultiplier); return TRUE; } //***************************************************************************** // // DisplayVCExtensionUnit() // //***************************************************************************** BOOL DisplayVCExtensionUnit ( PVIDEO_EXTENSION_UNIT VidExtensionDesc, PSTRING_DESCRIPTOR_NODE StringDescs, DEVICE_POWER_STATE LatestDevicePowerState ) { //@@DisplayVCExtensionUnit -Video Control Extension Unit int i = 0; UCHAR p = 0; UCHAR bControlSize = 0; PUCHAR pData = NULL; OLECHAR szGUID[256]; size_t bLength = 0; bLength = SizeOfVideoExtensionUnit(VidExtensionDesc); memset ((LPOLESTR) szGUID, 0, sizeof (OLECHAR) * 256); i = StringFromGUID2((REFGUID) &VidExtensionDesc->guidExtensionCode, (LPOLESTR) szGUID, 255); i++; AppendTextBuffer( "\r\n ===>Video Control Extension Unit Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , VidExtensionDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , VidExtensionDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , VidExtensionDesc->bDescriptorSubtype); AppendTextBuffer( "bUnitID: 0x%02X\r\n" , VidExtensionDesc->bUnitID); AppendTextBuffer( "guidExtensionCode: %S\r\n" , szGUID); AppendTextBuffer( "bNumControls: 0x%02X\r\n" , VidExtensionDesc->bNumControls); AppendTextBuffer( "bNrInPins: 0x%02X\r\n" , VidExtensionDesc->bNrInPins); if (gDoAnnotation) { AppendTextBuffer( "===>List of Connected Units and Terminal ID's\r\n" ); } // baSourceID is a variable length field // Size is in bNrInPins, must be at least 1 (so index starts at 1) for (i = 1, pData = ( PUCHAR ) &VidExtensionDesc->baSourceID; i <= VidExtensionDesc->bNrInPins; i++, pData++) { AppendTextBuffer( "baSourceID[%d]: 0x%02X\r\n" , i, *pData); } // point to bControlSize (address of bNrInPins plus number of fields in bNrInPins // plus 1 for next field) pData = &VidExtensionDesc->bNrInPins + VidExtensionDesc->bNrInPins +1; bControlSize = *pData; AppendTextBuffer( "bControlSize: 0x%02X\r\n" , bControlSize); // Are there any controls? if ( bControlSize > 0) { AppendTextBuffer( "bmControls : " ); VDisplayBytes(pData + 1, *pData); // Map one byte at a time of the bmControls field in the Video Control Extension Unit Descriptor for (i = 1; i <= bControlSize; i++) { UINT uBitIndex = 0; BYTE cCheckBit = 0; BYTE cMask = 1; // map byte for ( ; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData + i); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex + 8 * (i-1), cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , "Vendor-Specific (Optional)" ); cMask = cMask << 1; } } } // get address of iExtension pData = &VidExtensionDesc->bNrInPins + VidExtensionDesc->bNrInPins + bControlSize + 2; // pData = (PUCHAR) VidExtensionDesc + (VidExtensionDesc->bLength - 1); AppendTextBuffer( "iExtension: 0x%02X\r\n" , *pData); if (gDoAnnotation) { if (*pData) { DisplayStringDescriptor(*pData,StringDescs, LatestDevicePowerState); } } // size of descriptor struct size (23) + bNrInPins + bControlSize + iExtension size // // p = (sizeof(VIDEO_EXTENSION_UNIT) // + VidExtensionDesc->bNrInPins + bControlSize + 1); if (VidExtensionDesc->bLength != bLength) { //@@TestCase B10.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the //@@ required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of 0x%02X incorrect, should be 0x%02X\r\n" , VidExtensionDesc->bLength, p); OOPS(); } if (VidExtensionDesc->bUnitID < 1) { //@@TestCase B10.2 (Descript.c Line 517) //@@ERROR //@@Descriptor Field - bUnitID //@@bUnitID must be non-zero //@@Question: Should we test to verify bUnitID is valid AppendTextBuffer( "*!*ERROR: bUnitID must be non-zero\r\n" ); OOPS(); } //bugbug do we need two if (VidExtensionDesc->bNrInPins < 1) { //@@TestCase B10.3 (Descript.c Line 522) //@@ERROR //@@Descriptor Field - bNrInPins //@@bNrInPins must be non-zero //@@Question: Should we test to verify bNrInPins is valid AppendTextBuffer( "*!*ERROR: bNrInPins must be non-zero\r\n" ); OOPS(); } for (i = 1, pData = ( PUCHAR ) &VidExtensionDesc->baSourceID; i <= VidExtensionDesc->bNrInPins; i++, pData++) { if (*pData == 0) { //@@TestCase B10.4 (Descript.c Line 527) //@@ERROR //@@Descriptor Field - baSourceID[] //@@baSourceID[] must be non-zero //@@Question: Should we test to verify baSourceID is valid AppendTextBuffer( "*!*ERROR: baSourceID[%d] must be non-zero\r\n" , *pData); OOPS(); } } return TRUE; } //***************************************************************************** // // DisplayVidInHeaderl() // //***************************************************************************** BOOL DisplayVidInHeader ( PVIDEO_STREAMING_INPUT_HEADER VidInHeaderDesc ) { //@@DisplayVidInHeader -Video Streaming Video Input Header UINT p = 0; UINT uCount = 0; PUCHAR pData = NULL; AppendTextBuffer( "\r\n ===>Video Class-Specific VS Video Input Header Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , VidInHeaderDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , VidInHeaderDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , VidInHeaderDesc->bDescriptorSubtype); AppendTextBuffer( "bNumFormats: 0x%02X\r\n" , VidInHeaderDesc->bNumFormats); AppendTextBuffer( "wTotalLength: 0x%04X" , VidInHeaderDesc->wTotalLength); uCount = GetVSInterfaceSize((PUSB_COMMON_DESCRIPTOR) VidInHeaderDesc, VidInHeaderDesc->wTotalLength); if (uCount != VidInHeaderDesc->wTotalLength) { AppendTextBuffer( "\r\n*!*ERROR: invalid interface size 0x%02X, should be 0x%02X\r\n" , VidInHeaderDesc->wTotalLength, uCount); } else { AppendTextBuffer( " -> Validated\r\n" ); } AppendTextBuffer( "bEndpointAddress: 0x%02X" , VidInHeaderDesc->bEndpointAddress); if (USB_ENDPOINT_DIRECTION_IN(VidInHeaderDesc->bEndpointAddress)) { if (gDoAnnotation) { AppendTextBuffer( " -> Direction: IN - EndpointID: %d" , (VidInHeaderDesc->bEndpointAddress & 0x0F)); } AppendTextBuffer( "\r\n" ); } AppendTextBuffer( "bmInfo: 0x%02X" , VidInHeaderDesc->bmInfo); if (gDoAnnotation) { AppendTextBuffer( " -> Dynamic Format Change %sSupported" , ! (VidInHeaderDesc->bmInfo & 0x01) ? "not " : " " ); } AppendTextBuffer( "\r\nbTerminalLink: 0x%02X\r\n" , VidInHeaderDesc->bTerminalLink); AppendTextBuffer( "bStillCaptureMethod: 0x%02X" , VidInHeaderDesc->bStillCaptureMethod); // globally save the StillMethod, then verify value StillMethod = VidInHeaderDesc->bStillCaptureMethod; if (StillMethod > 3) { //@@TestCase B11.1 (Descript.c Line 798) //@@ERROR //@@Descriptor Field - bStillCaptureMethod //@@bStillCaptureMethod is greater than 3 AppendTextBuffer( "*!*ERROR: invalid bStillCaptureMethod 0x%02X\r\n" , VidInHeaderDesc->bStillCaptureMethod); if (gDoAnnotation) { AppendTextBuffer( " -> Invalid Still Capture Method" ); } } else { if (0 == StillMethod) { AppendTextBuffer( " -> No Still Capture" ); } else { AppendTextBuffer( " -> Still Capture Method %d" , VidInHeaderDesc->bStillCaptureMethod); } } AppendTextBuffer( "\r\nbTriggerSupport: 0x%02X" , VidInHeaderDesc->bTriggerSupport); if (gDoAnnotation) { AppendTextBuffer( " -> " ); if (! VidInHeaderDesc->bTriggerSupport) AppendTextBuffer( "No " ); AppendTextBuffer( "Hardware Triggering Support" ); } AppendTextBuffer( "\r\n" ); AppendTextBuffer( "bTriggerUsage: 0x%02X" , VidInHeaderDesc->bTriggerUsage); if (gDoAnnotation) { if (VidInHeaderDesc->bTriggerSupport != 0) { if (VidInHeaderDesc->bTriggerUsage == 0) AppendTextBuffer( " -> Host will initiate still image capture" ); if (VidInHeaderDesc->bTriggerUsage == 1) AppendTextBuffer( " -> Host will notify client application of button event" ); } } AppendTextBuffer( "\r\nbControlSize: 0x%02X\r\n" , VidInHeaderDesc->bControlSize); // are there formats to display? if (VidInHeaderDesc->bNumFormats) { UINT uFormatIndex = 1; UINT uBitIndex = 0; BYTE cCheckBit = 0; BYTE cMask = 1; // There are (bNumFormats) bmaControls fields, each with size (bControlSize) pData = ( PUCHAR ) &(VidInHeaderDesc->bControlSize); // VidInHeaderDesc->bNumFormats -> number of formats // VidInHeaderDesc->bControlSize -> size of EACH format control // ((PUCHAR) &VidInHeaderDesc->bControlSize) + 1 -> address of first format control for ( pData++ ; uFormatIndex <= VidInHeaderDesc->bNumFormats; uFormatIndex++ ) { AppendTextBuffer( "Video Payload Format %d " , uFormatIndex); // Handle case of 0 control size if (! VidInHeaderDesc->bControlSize) { AppendTextBuffer( "0x00\r\n" ); } else { VDisplayBytes(pData, VidInHeaderDesc->bControlSize); // map the first control for (uBitIndex = 0, cMask = 1; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pData); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slInputHeaderControls, sizeof (slInputHeaderControls) / sizeof (STRINGLIST), cMask, "Invalid Control value" )); cMask = cMask << 1; } } pData += VidInHeaderDesc->bControlSize; } } p = ( sizeof (VIDEO_STREAMING_INPUT_HEADER) + (VidInHeaderDesc->bNumFormats * VidInHeaderDesc->bControlSize)); if (VidInHeaderDesc->bLength != p) { //@@TestCase B11.2 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength //@@The descriptor should be the size of the descriptor structure //@@ plus the number of formats times the size of each format AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , VidInHeaderDesc->bLength, p); OOPS(); } if (VidInHeaderDesc->bNumFormats < 1) { //@@TestCase B11.3 (Descript.c Line778) //@@ERROR //@@Descriptor Field - bNumFormats //@@bNumFormats must be non-zero //@@Question: Should we test to verify the non-zero value for bNumFormats is valid AppendTextBuffer( "*!*ERROR: bNumFormats must be non-zero\r\n" , VidInHeaderDesc->bNumFormats); OOPS(); } if (VidInHeaderDesc->bEndpointAddress < 1) { //@@TestCase B11.4 (Descript.c Line788) //@@ERROR //@@Descriptor Field - bEndpointAddress //@@bEndpointAddress should be greater than 0 //@@Question: Should we test to verify the non-zero value for bEndpointAddress is valid AppendTextBuffer( "*!*ERROR: bEndpointAddress of %d is too small\r\n" , VidInHeaderDesc->bEndpointAddress); OOPS(); } //@@TestCase B11.5 //@@ERROR //@@Descriptor Field - bEndPointAddress //@@The bEndPointAddress is set incorrectly according to the USB Video Device Specification if (!USB_ENDPOINT_DIRECTION_IN(VidInHeaderDesc->bEndpointAddress)){ AppendTextBuffer( "\r\n*!*ERROR: bEndPointAddress needs to have the Direction IN for this header\r\n" ); OOPS();} //@@TestCase B11.6 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bmInfo //@@We should validate that reserved bits are set to zero. // AppendTextBuffer("bmInfo: 0x%02X", VidInHeaderDesc->bmInfo); if (VidInHeaderDesc->bTerminalLink < 1) { //@@TestCase B11.7 (Descript.c Line 793) //@@ERROR //@@Descriptor Field - bTerminalLink //@@bTerminalLink should be greater than 0 //@@Question: Should we test to verify the non-zero value for bTerminalLink is valid AppendTextBuffer( "*!*ERROR: bTerminalLink of %d is too small\r\n" , VidInHeaderDesc->bTerminalLink); OOPS(); } //@@TestCase B11.8 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bTriggerSupport //@@We should validate that reserved bits are set to zero. // AppendTextBuffer("bTriggerSupport: 0x%02X", VidInHeaderDesc->bTriggerSupport); //@@TestCase B11.9 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bTriggerUsage //@@We should validate that reserved bits are set to zero. // AppendTextBuffer("bTriggerUsage: 0x%02X", VidInHeaderDesc->bTriggerUsage); return TRUE; } //***************************************************************************** // // DisplayVidOutHeader() // //***************************************************************************** BOOL DisplayVidOutHeader ( PVIDEO_STREAMING_OUTPUT_HEADER VidOutHeaderDesc ) { //@@DisplayVidOutHeader -Video Streaming Video Output Header UINT uCount = 0; UCHAR bLength = sizeof (VIDEO_STREAMING_OUTPUT_HEADER); AppendTextBuffer( "\r\n ===>Video Class-Specific VS Video Output Header Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , VidOutHeaderDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , VidOutHeaderDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , VidOutHeaderDesc->bDescriptorSubtype); AppendTextBuffer( "bNumFormats: 0x%02X\r\n" , VidOutHeaderDesc->bNumFormats); AppendTextBuffer( "wTotalLength: 0x%04X" , VidOutHeaderDesc->wTotalLength); uCount = GetVSInterfaceSize((PUSB_COMMON_DESCRIPTOR) VidOutHeaderDesc, VidOutHeaderDesc->wTotalLength); if (uCount != VidOutHeaderDesc->wTotalLength) { AppendTextBuffer( "\r\n*!*ERROR: invalid interface size 0x%02X, should be 0x%02X\r\n" , VidOutHeaderDesc->wTotalLength, uCount); } else { AppendTextBuffer( " -> Validated\r\n" ); } AppendTextBuffer( "bEndpointAddress: 0x%02X" , VidOutHeaderDesc->bEndpointAddress); if (USB_ENDPOINT_DIRECTION_OUT(VidOutHeaderDesc->bEndpointAddress)) { if (gDoAnnotation) { AppendTextBuffer( " -> Direction: OUT - EndpointID: %d" , (VidOutHeaderDesc->bEndpointAddress & 0x0F)); } AppendTextBuffer( "\r\n" ); } AppendTextBuffer( "bTerminalLink: 0x%02X\r\n" , VidOutHeaderDesc->bTerminalLink); // UVC11 Video Output Header has additional fields, larger size #ifdef H264_SUPPORT if (UVC10 != g_chUVCversion) #else if (UVC11 == g_chUVCversion) #endif { UCHAR bControlSize = 0; PUCHAR pControls = NULL; // bControlSize field is next after bTerminalLink pControls = &(VidOutHeaderDesc->bTerminalLink)+1; bControlSize = *(pControls); // point to first bmaControls pControls++; // Size of UVC 1.1 Video Output Header is 1.0 size // plus 1 (bControlSize field) plus (number of formats * bControlSize) bLength += 1 + (VidOutHeaderDesc->bNumFormats * bControlSize); // Need new uvcdesc.h to handle new fields AppendTextBuffer( "bControlSize: 0x%02X\r\n" , bControlSize); // are there formats to display? if (VidOutHeaderDesc->bNumFormats) { UINT uFormatIndex = 1; UINT uBitIndex = 0; BYTE cCheckBit = 0; BYTE cMask = 1; // There are (bNumFormats) bmaControls fields, each with size (bControlSize) for ( ; uFormatIndex <= VidOutHeaderDesc->bNumFormats; uFormatIndex++, pControls ++) { AppendTextBuffer( "Video Payload Format %d " , uFormatIndex); // Handle case of 0 control size if (0 == bControlSize) { AppendTextBuffer( "0x00\r\n" ); } else { VDisplayBytes(pControls, bControlSize); // map the first control for (uBitIndex = 0, cMask = 1; uBitIndex < 8; uBitIndex++ ) { cCheckBit = cMask & *(pControls); AppendTextBuffer( " D%02d = %d %s %s\r\n" , uBitIndex, cCheckBit ? 1 : 0, cCheckBit ? "yes - " : " no - " , GetStringFromList(slOutputHeaderControls, sizeof (slOutputHeaderControls) / sizeof (STRINGLIST), cMask, "Invalid control value" )); cMask = cMask << 1; } } } // for ( pData++ ; uFormatIndex <= VidOutHeaderDesc->bNumFormats; uFormatIndex++ ) } // if (VidOutHeaderDesc->bNumFormats) } // if (UVC11 == g_chUVCversion) if (VidOutHeaderDesc->bLength != bLength) { //@@TestCase B12.1 (also in Descript.c) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the //@@ required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , VidOutHeaderDesc->bLength, sizeof (VIDEO_STREAMING_OUTPUT_HEADER)); OOPS(); } if (VidOutHeaderDesc->bNumFormats < 1) { //@@TestCase B12.2 (Descript.c Line 827) //@@ERROR //@@Descriptor Field - bNumFormats //@@bNumFormats should be greater than 0 //@@Question: Should we test to verify the non-zero value for bNumFormats is valid AppendTextBuffer( "*!*ERROR: bNumFormats of %d is too small\r\n" , VidOutHeaderDesc->bNumFormats); OOPS(); } if (VidOutHeaderDesc->wTotalLength < VidOutHeaderDesc->bLength) { //@@TestCase B12.3 (Descript.c Line 832) //@@ERROR //@@Descriptor Field - wTotalLength //@@wTotalLength should be greater than bLength //@@Question: Should we calculate wTotalLength to verify the value is valid AppendTextBuffer( "*!*ERROR: wTotalLength of %d is small than the bLength of %d\r\n" , VidOutHeaderDesc->wTotalLength, VidOutHeaderDesc->bLength); OOPS(); } if (VidOutHeaderDesc->bEndpointAddress < 1) { //@@TestCase B12.4 (Descript.c Line 837) //@@ERROR //@@Descriptor Field - bEndpointAddress //@@bEndpointAddress should be greater than 0 //@@Question: Should we test to verify the non-zero value for bEndpointAddress is valid AppendTextBuffer( "*!*ERROR: bEndpointAddress of %d is too small\r\n" , VidOutHeaderDesc->bEndpointAddress); OOPS(); } if (!(USB_ENDPOINT_DIRECTION_OUT(VidOutHeaderDesc->bEndpointAddress))) { //@@TestCase B12.5 //@@ERROR //@@Descriptor Field - bEndPointAddress //@@The bEndPointAddress is set for the wrong direction AppendTextBuffer( "\r\n*!*ERROR: bEndPointAddress needs to have the Direction OUT for this header\r\n" ); OOPS();} if (VidOutHeaderDesc->bTerminalLink < 1) { //@@TestCase B12.6 (Descript.c Line 842) //@@ERROR //@@Descriptor Field - bTerminalLink //@@bTerminalLink should be greater than 0 //@@Question: Should we test to verify the non-zero value for bTerminalLink is valid AppendTextBuffer( "*!*ERROR: bTerminalLink of %d is too small\r\n" , VidOutHeaderDesc->bTerminalLink); OOPS(); } return TRUE; } //***************************************************************************** // // DisplayStillImageFrame() // //***************************************************************************** BOOL DisplayStillImageFrame ( PVIDEO_STILL_IMAGE_FRAME StillFrameDesc ) { //@@DisplayStillImageFrame -Still Image Frame VIDEO_STILL_IMAGE_RECT * pXY; PUCHAR pbCurr = NULL; UINT i = 0; UINT uNumComp = 0; UINT uSize = 0; size_t bLength = 0; bLength = SizeOfVideoStillImageFrame(StillFrameDesc); AppendTextBuffer( "\r\n ===>Still Image Frame Type Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , StillFrameDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , StillFrameDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , StillFrameDesc->bDescriptorSubtype); AppendTextBuffer( "bEndpointAddress: 0x%02X\r\n" , StillFrameDesc->bEndpointAddress); AppendTextBuffer( "bNumImageSizePatterns: 0x%02X\r\n" , StillFrameDesc->bNumImageSizePatterns); if (StillFrameDesc->bNumImageSizePatterns < 1) { //@@TestCase B13.1 (also Descript.c Line 886) //@@Not yet implemented - Priority 1 //@@Descriptor Field - bNumImageSizePatterns //@@The bNumImageSizePatterns should be greater than 0 //@@Question: Should we test to verify the non-zero value for bNumImageSizePatterns is valid AppendTextBuffer( "*!*ERROR: bNumImageSizePatterns must be non-zero\r\n" ); OOPS(); } // point to first StillFrameDesc->dwStillImage structure pXY = (VIDEO_STILL_IMAGE_RECT *) &StillFrameDesc->aStillRect[0]; for (i = 1; i <= StillFrameDesc->bNumImageSizePatterns; i++, pXY++) { AppendTextBuffer( "wWidth[%d]: 0x%04X\r\n" , i, pXY->wWidth); AppendTextBuffer( "wHeight[%d]: 0x%04X\r\n" , i, pXY->wHeight); } // point to bNumCompressionPattern field (after variable count field dwStillImage) pbCurr = ( PUCHAR ) pXY; // get number of compression patterns uNumComp = *pbCurr; AppendTextBuffer( "bNumCompressionPattern: 0x%02X\r\n" , *pbCurr++); for (i = 1; i <= uNumComp; i++) { AppendTextBuffer( "bCompression[%d]: 0x%02X\r\n" , i, *pbCurr++); } switch (StillMethod) { case 0: //@@TestCase B13.2 //@@ERROR //@@Descriptor Field - Still Image Frame Type Descriptor //@@An still method type has been defined that shouldn't use a Still Image Frame AppendTextBuffer( "*!*ERROR: VS Video Input Header set to " \ "No Still Method support\r\n" ); OOPS(); case 1: //@@TestCase B13.3 //@@ERROR //@@Descriptor Field - Still Image Frame Type Descriptor //@@An still method type has been defined that shouldn't use a Still Image Frame AppendTextBuffer( "*!*ERROR: VS Video Input Header set to " \ "Still Method One support with a Still Image Frame descriptor\r\n" ); OOPS(); default : break ;} if (StillFrameDesc->bLength != bLength) { //@@TestCase B13.4 (Also in descript.c) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is incorrect AppendTextBuffer( "*!*ERROR: bLength 0x%02X incorrect, should be 0x%02X\r\n" , StillFrameDesc->bLength, uSize); OOPS(); } //@@TestCase B13.5 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bEndpointAddress //@@Should test to verify endpoint validity // AppendTextBuffer("bEndpointAddress: 0x%02X", StillFrameDesc->bEndpointAddress); if (USB_ENDPOINT_DIRECTION_IN(StillFrameDesc->bEndpointAddress) && StillMethod==3){ if ((StillFrameDesc->bEndpointAddress) == 0){ //@@TestCase B13.6 //@@ERROR //@@Descriptor Field - bEndPointAddress //@@bEndPointAddress should be non-zero for 0 when using StillMethod 3 AppendTextBuffer( "\r\n*!*ERROR: bEndpointAddress is reported as %d. " \ "This should be non-zero when using StillMethod 3.\r\n" , (StillFrameDesc->bEndpointAddress)); OOPS(); } if (gDoAnnotation) { AppendTextBuffer( " -> Direction: IN - EndpointID: %d" , (StillFrameDesc->bEndpointAddress & 0x0F)); } AppendTextBuffer( "\r\n" ); } else if (USB_ENDPOINT_DIRECTION_OUT(StillFrameDesc->bEndpointAddress) && StillMethod==2) { if ((StillFrameDesc->bEndpointAddress & 0x0F) != 0) { //@@TestCase B13.7 //@@ERROR //@@Descriptor Field - bEndPointAddress //@@The EndpointID of bEndPointAddress should be set for 0 when using StillMethod 2 AppendTextBuffer( "\r\n*!*ERROR: The EndpointID of the " \ "bEndpointAddress is reported as %d. This should be 0.\r\n" , (StillFrameDesc->bEndpointAddress & 0x0F)); OOPS(); } else {AppendTextBuffer( "\r\n" );}} else if (StillFrameDesc->bEndpointAddress != 0) { //@@TestCase B13.8 //@@ERROR //@@Descriptor Field - bEndPointAddress //@@The bEndPointAddress should be set for 0 when not using StillMethod 2 or 3 AppendTextBuffer( "\r\n*!*ERROR: bEndPointAddress should be 0.\r\n" ); OOPS(); } else {AppendTextBuffer( "\r\n" );} return TRUE; } //***************************************************************************** // // DisplayColorMatching() // //***************************************************************************** BOOL DisplayColorMatching ( PVIDEO_COLORFORMAT ColorMatchDesc ) { //@@DisplayColorMatching -Color Matching AppendTextBuffer( "\r\n ===>Color Matching Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , ColorMatchDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , ColorMatchDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , ColorMatchDesc->bDescriptorSubtype); AppendTextBuffer( "bColorPrimaries: 0x%02X\r\n" , ColorMatchDesc->bColorPrimaries); AppendTextBuffer( "bTransferCharacteristics: 0x%02X\r\n" , ColorMatchDesc->bTransferCharacteristics); AppendTextBuffer( "bMatrixCoefficients: 0x%02X\r\n" , ColorMatchDesc->bMatrixCoefficients); if (ColorMatchDesc->bLength != sizeof (VIDEO_COLORFORMAT)) { //@@TestCase B14.1 (Descript.c Line 1596) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , ColorMatchDesc->bLength, sizeof (VIDEO_COLORFORMAT)); OOPS(); } //@@TestCase B14.2 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bColorPrimaries //@@Question - Should we test to verify bColorPrimaries // AppendTextBuffer("bColorPrimaries: 0x%02X\r\n", ColorMatchDesc->bColorPrimaries); //@@TestCase B14.3 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bTransferCharacteristics //@@Question - Should we test to verify bTransferCharacteristics // AppendTextBuffer("bTransferCharacteristics: 0x%02X\r\n", ColorMatchDesc->bTransferCharacteristics); //@@TestCase B14.4 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bMatrixCoefficients //@@Question - Should we test to verify bMatrixCoefficients // AppendTextBuffer("bMatrixCoefficients: 0x%02X\r\n", ColorMatchDesc->bMatrixCoefficients); return TRUE; } //***************************************************************************** // // DisplayUncompressedFormat() // //***************************************************************************** BOOL DisplayUncompressedFormat ( PVIDEO_FORMAT_UNCOMPRESSED UnCompFormatDesc ) { //@@DisplayUncompressedFormat - Uncompressed Format int i = 0; PCHAR pStr = NULL; OLECHAR szGUID[256]; // Initialize the default Frame g_chUNCFrameDefault = UnCompFormatDesc->bDefaultFrameIndex; memset ((LPOLESTR) szGUID, 0, sizeof (OLECHAR) * 256); i = StringFromGUID2((REFGUID) &UnCompFormatDesc->guidFormat, (LPOLESTR) szGUID, 255); i++; AppendTextBuffer( "\r\n ===>Video Streaming Uncompressed Format Type Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , UnCompFormatDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , UnCompFormatDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , UnCompFormatDesc->bDescriptorSubtype); AppendTextBuffer( "bFormatIndex: 0x%02X\r\n" , UnCompFormatDesc->bFormatIndex); AppendTextBuffer( "bNumFrameDescriptors: 0x%02X\r\n" , UnCompFormatDesc->bNumFrameDescriptors); AppendTextBuffer( "guidFormat: %S" , szGUID); pStr = VidFormatGUIDCodeToName((REFGUID) &UnCompFormatDesc->guidFormat); if ( pStr ) { if ( gDoAnnotation ) { AppendTextBuffer( " = %s Format" , pStr); } } AppendTextBuffer( "\r\n" ); AppendTextBuffer( "bBitsPerPixel: 0x%02X\r\n" , UnCompFormatDesc->bBitsPerPixel); AppendTextBuffer( "bDefaultFrameIndex: 0x%02X\r\n" , UnCompFormatDesc->bDefaultFrameIndex); if (UnCompFormatDesc->bLength != sizeof (VIDEO_FORMAT_UNCOMPRESSED)) { //@@TestCase B15.1 (descript.c line 925) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required //@@length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , UnCompFormatDesc->bLength, sizeof (VIDEO_FORMAT_UNCOMPRESSED)); OOPS(); } if (UnCompFormatDesc->bFormatIndex == 0 ) { //@@TestCase B15.2 (descript.c line 930) //@@ERROR //@@Descriptor Field - bFormatIndex //@@bFormatIndex is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bFormatIndex = 0, this is a 1 based index\r\n" ); OOPS(); } if (UnCompFormatDesc->bNumFrameDescriptors == 0 ) { //@@TestCase B15.3 (descript.c line 930) //@@ERROR //@@Descriptor Field - bNumFrameDescriptors //@@bNumFrameDescriptors is set to zero which is not in accordance with the //@@USB Video Device Specification AppendTextBuffer( "*!*ERROR: bNumFrameDescriptors = 0, must have at least 1 Frame descriptor\r\n" ); OOPS(); } if (!(pStr)) { //@@TestCase B15.4 //@@WARNING //@@Descriptor Field - guidFormat //@@guidFormat is set to unknown or undefined format AppendTextBuffer( "\r\n*!*WARNING: guidFormat is an unknown format\r\n" ); OOPS(); } if (UnCompFormatDesc->bBitsPerPixel == 0 ) { //@@TestCase B15.5 (descript.c line 940) //@@ERROR //@@Descriptor Field - bBitsPerPixel //@@bBitsPerPixel is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bBitsPerPixel = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (UnCompFormatDesc->bDefaultFrameIndex == 0 || UnCompFormatDesc->bDefaultFrameIndex > UnCompFormatDesc->bNumFrameDescriptors) { //@@TestCase B15.6 (desctipt.c line 945) //@@ERROR //@@Descriptor Field - bDefaultFrameIndex //@@The value for bDefaultFrameIndex is not greater than 0 or less than or equal to bNumFrameDescriptors AppendTextBuffer( "*!*ERROR: The value %d for the bDefaultFrameIndex is out of range, this invalidates the descriptor\r\n*!*The proper range is 1 to %d)" , UnCompFormatDesc->bDefaultFrameIndex, UnCompFormatDesc->bNumFrameDescriptors); OOPS(); } AppendTextBuffer( "bAspectRatioX: 0x%02X\r\n" , UnCompFormatDesc->bAspectRatioX); AppendTextBuffer( "bAspectRatioY: 0x%02X" , UnCompFormatDesc->bAspectRatioY); if (((UnCompFormatDesc->bmInterlaceFlags & 0x01) && (UnCompFormatDesc->bAspectRatioY != 0 && UnCompFormatDesc->bAspectRatioX != 0))) { if (gDoAnnotation) { AppendTextBuffer( " -> Aspect Ratio is set for a %d:%d display" , (UnCompFormatDesc->bAspectRatioX),(UnCompFormatDesc->bAspectRatioY)); } else { if (UnCompFormatDesc->bAspectRatioY != 0 || UnCompFormatDesc->bAspectRatioX != 0) { //@@TestCase B15.7 //@@ERROR //@@Descriptor Field - bAspectRatioX, bAspectRatioY //@@Verify that that bAspectRatioX and bAspectRatioY are set to zero //@@ if stream is non-interlaced AppendTextBuffer( "\r\n*!*ERROR: Both bAspectRatioX and bAspectRatioY " \ "must equal 0 if stream is non-interlaced" ); OOPS(); } } } AppendTextBuffer( "\r\nbmInterlaceFlags: 0x%02X\r\n" , UnCompFormatDesc->bmInterlaceFlags); if (gDoAnnotation) { AppendTextBuffer( " D0 = 0x%02X Interlaced stream or variable: %s\r\n" , (UnCompFormatDesc->bmInterlaceFlags & 1), (UnCompFormatDesc->bmInterlaceFlags & 1) ? "Yes" : "No" ); AppendTextBuffer( " D1 = 0x%02X Fields per frame: %s\r\n" , ((UnCompFormatDesc->bmInterlaceFlags >> 1) & 1), ((UnCompFormatDesc->bmInterlaceFlags >> 1) & 1) ? "1 field" : "2 fields" ); AppendTextBuffer( " D2 = 0x%02X Field 1 first: %s\r\n" , ((UnCompFormatDesc->bmInterlaceFlags >> 2) & 1), ((UnCompFormatDesc->bmInterlaceFlags >> 2) & 1) ? "Yes" : "No" ); //@@TestCase B15.9 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bmInterlaceFlags //@@Validate that reserved bits (D3) are set to zero. AppendTextBuffer( " D3 = 0x%02X Reserved%s\r\n" , ((UnCompFormatDesc->bmInterlaceFlags >> 3) & 1), ((UnCompFormatDesc->bmInterlaceFlags >> 3) & 1) ? "\r\n*!*ERROR: Reserved to 0" : "" ); AppendTextBuffer( " D4..5 = 0x%02X Field patterns ->" , ((UnCompFormatDesc->bmInterlaceFlags >> 4) & 3)); switch (UnCompFormatDesc->bmInterlaceFlags & 0x30) { case 0x00: AppendTextBuffer( " Field 1 only" ); break ; case 0x10: AppendTextBuffer( " Field 2 only" ); break ; case 0x20: AppendTextBuffer( " Regular Pattern of fields 1 and 2" ); break ; case 0x30: AppendTextBuffer( " Random Pattern of fields 1 and 2" ); break ; } AppendTextBuffer( "\r\n D6..7 = 0x%02X Display Mode ->" , ((UnCompFormatDesc->bmInterlaceFlags >> 6) & 3)); switch (UnCompFormatDesc->bmInterlaceFlags & 0xC0) { case 0x00: AppendTextBuffer( " Bob only" ); break ; case 0x40: AppendTextBuffer( " Weave only" ); break ; case 0x80: AppendTextBuffer( " Bob or weave" ); break ; case 0xC0: //@@TestCase B15.10 //@@Not yet implemented - Priority 3 //@@Descriptor Field - bmInterlaceFlags //@@Question - Should we validate that reserved bits are set to zero? AppendTextBuffer( " Reserved" ); break ; } } //@@TestCase B15.11 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bCopyProtect //@@Question - Are their reserved bits and should we validate that //@@ reserved bits are set to zero? AppendTextBuffer( "\r\nbCopyProtect: 0x%02X" , UnCompFormatDesc->bCopyProtect); if (gDoAnnotation) { if (UnCompFormatDesc->bCopyProtect) AppendTextBuffer( " -> Duplication Restricted" ); else AppendTextBuffer( " -> Duplication Unrestricted" ); } AppendTextBuffer( "\r\n" ); //@@TestCase B15.12 //@@We should check to make sure that a Color Matching Descriptor is included in the device // Check that the correct number of Frame Descriptors and one Color Matching // descriptor follow CheckForColorMatchingDesc ((PVIDEO_SPECIFIC) UnCompFormatDesc, UnCompFormatDesc->bNumFrameDescriptors, VS_FRAME_UNCOMPRESSED); return TRUE; } //***************************************************************************** // // DisplayUncompressedFrameType() // //***************************************************************************** BOOL DisplayUncompressedFrameType ( PVIDEO_FRAME_UNCOMPRESSED UnCompFrameDesc ) { size_t bLength = 0; bLength = SizeOfVideoFrameUncompressed(UnCompFrameDesc); //@@DisplayUncompressedFrameType -Uncompressed Frame AppendTextBuffer( "\r\n ===>Video Streaming Uncompressed Frame Type Descriptor<===\r\n" ); if (gDoAnnotation) { if (UnCompFrameDesc->bFrameIndex == g_chUNCFrameDefault) { AppendTextBuffer( " --->This is the Default (optimum) Frame index\r\n" ); } } AppendTextBuffer( "bLength: 0x%02X\r\n" , UnCompFrameDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , UnCompFrameDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , UnCompFrameDesc->bDescriptorSubtype); AppendTextBuffer( "bFrameIndex: 0x%02X\r\n" , UnCompFrameDesc->bFrameIndex); AppendTextBuffer( "bmCapabilities: 0x%02X\r\n" , UnCompFrameDesc->bmCapabilities); AppendTextBuffer( "wWidth: 0x%04X = %d\r\n" , UnCompFrameDesc->wWidth, UnCompFrameDesc->wWidth); AppendTextBuffer( "wHeight: 0x%04X = %d\r\n" , UnCompFrameDesc->wHeight, UnCompFrameDesc->wHeight); AppendTextBuffer( "dwMinBitRate: 0x%08X\r\n" , UnCompFrameDesc->dwMinBitRate); AppendTextBuffer( "dwMaxBitRate: 0x%08X\r\n" , UnCompFrameDesc->dwMaxBitRate); AppendTextBuffer( "dwMaxVideoFrameBufferSize: 0x%08X\r\n" , UnCompFrameDesc->dwMaxVideoFrameBufferSize); // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n" , UnCompFrameDesc->dwDefaultFrameInterval, (( double )UnCompFrameDesc->dwDefaultFrameInterval)/10000.0, (10000000.0/(( double )UnCompFrameDesc->dwDefaultFrameInterval)) ); AppendTextBuffer( "bFrameIntervalType: 0x%02X\r\n" , UnCompFrameDesc->bFrameIntervalType); if (UnCompFrameDesc->bLength != bLength) { //@@TestCase B15.1 (descript.c line 925) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required //@@length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , UnCompFrameDesc->bLength, bLength); OOPS(); } if (UnCompFrameDesc->bFrameIndex == 0 ) { //@@TestCase B16.2 (descript.c line 991) //@@ERROR //@@Descriptor Field - bFrameIndex //@@bFrameIndex must be nonzero AppendTextBuffer( "*!*ERROR: bFrameIndex = 0, this is a 1 based index\r\n" ); OOPS(); } //@@TestCase B16.3 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bmCapabilities //@@Question: Should we try to verify that bmCapabilities is valid? // AppendTextBuffer("bmCapabilities: 0x%02X\r\n", UnCompFrameDesc->bmCapabilities); if (UnCompFrameDesc->wWidth == 0 ) { //@@TestCase B16.4 (descript.c line 996) //@@ERROR //@@Descriptor Field - wWidth //@@wWidth must be nonzero AppendTextBuffer( "*!*ERROR: wWidth must be nonzero\r\n" ); OOPS(); } if (UnCompFrameDesc->wHeight == 0 ) { //@@TestCase B16.5 (descript.c line 1001) //@@ERROR //@@Descriptor Field - wHeight //@@wHeight must be nonzero AppendTextBuffer( "*!*ERROR: wHeight must be nonzero\r\n" ); OOPS(); } if (UnCompFrameDesc->dwMinBitRate == 0 ) { //@@TestCase B16.6 (descript.c line 1006) //@@ERROR //@@Descriptor Field - dwMinBitRate //@@dwMinBitRate must be nonzero AppendTextBuffer( "*!*ERROR: dwMinBitRate must be nonzero\r\n" ); OOPS(); } if (UnCompFrameDesc->dwMaxBitRate == 0 ) { //@@TestCase B16.7 (descript.c line 1011) //@@ERROR //@@Descriptor Field - dwMaxBitRate //@@dwMaxBitRate must be nonzero AppendTextBuffer( "*!*ERROR: dwMaxBitRate must be nonzero\r\n" ); OOPS(); } if (UnCompFrameDesc->dwMinBitRate > UnCompFrameDesc->dwMaxBitRate) { //@@TestCase B16.8 //@@ERROR //@@Descriptor Field - dwMinBitRate and dwMaxBitRate //@@Verify that dwMaxBitRate is greater than dwMinBitRate AppendTextBuffer( "*!*ERROR: dwMinBitRate should be less than dwMaxBitRate\r\n" ); OOPS(); } else { if (UnCompFrameDesc->bFrameIntervalType == 1 && UnCompFrameDesc->dwMinBitRate != UnCompFrameDesc->dwMaxBitRate) { //@@TestCase B16.9 //@@WARNING //@@Descriptor Field - bFrameIntervalType, dwMinBitRate, and dwMaxBitRate //@@Verify that dwMaxBitRate is equal to dwMinBitRate if bFrameIntervalType is 1 AppendTextBuffer( "*!*WARNING: if bFrameIntervalType is 1 then dwMinBitRate " \ "should equal dwMaxBitRate\r\n" ); OOPS(); } } if (UnCompFrameDesc->dwMaxVideoFrameBufferSize == 0 ) { //@@TestCase B16.10 (descript.c line 1015) //@@WARNING //@@Descriptor Field - bFrameIndex //@@bFrameIndex must be nonzero AppendTextBuffer( "*!*WARNING: dwMaxVideoFrameBufferSize must be nonzero\r\n" ); OOPS(); } if (UnCompFrameDesc->dwDefaultFrameInterval == 0 ) { //@@TestCase B16.11 (descript.c line 1020) //@@WARNING //@@Descriptor Field - dwDefaultFrameInterval //@@dwDefaultFrameInterval must be nonzero AppendTextBuffer( "*!*WARNING: dwDefaultFrameInterval must be nonzero\r\n" ); OOPS(); } if (0 == UnCompFrameDesc->bFrameIntervalType) { DisplayUnComContinuousFrameType(UnCompFrameDesc); } else { DisplayUnComDiscreteFrameType(UnCompFrameDesc); } return TRUE; } //***************************************************************************** // // DisplayUnComContinuousFrameType() // //***************************************************************************** BOOL DisplayUnComContinuousFrameType( PVIDEO_FRAME_UNCOMPRESSED UContinuousDesc ) { //@@DisplayUnComContinuousFrameType -Uncompressed Continuous Frame ULONG dwMinFrameInterval = UContinuousDesc->adwFrameInterval[0]; ULONG dwMaxFrameInterval = UContinuousDesc->adwFrameInterval[1]; ULONG dwFrameIntervalStep = UContinuousDesc->adwFrameInterval[2]; AppendTextBuffer( "===>Additional Continuous Frame Type Data\r\n" ); // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n" , dwMinFrameInterval, (( double )dwMinFrameInterval)/10000.0, ( ULONG )(10000000.0/(( double )dwMinFrameInterval) + 0.5)); AppendTextBuffer( "dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n" , dwMaxFrameInterval, (( double )dwMaxFrameInterval)/10000.0, ( ULONG )(10000000.0/(( double )dwMaxFrameInterval) + 0.5)); AppendTextBuffer( "dwFrameIntervalStep: 0x%08X\r\n" , dwFrameIntervalStep); if (dwMinFrameInterval == 0 ) { //@@TestCase B17.2 (descript.c line 1025) //@@ERROR //@@Descriptor Field - dwMinFrameInterval //@@dwMinFrameInterval is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMinFrameInterval = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (dwMaxFrameInterval == 0 ) { //@@TestCase B17.3 (descript.c line 1025) //@@ERROR //@@Descriptor Field - dwMaxFrameInterval //@@dwMaxFrameInterval is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMaxFrameInterval = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (dwMinFrameInterval > dwMaxFrameInterval) { //@@TestCase B17.4 (descript.c 1043) //@@ERROR //@@Descriptor Field - dwMinFrameInterval and dwMaxFrameInterval //@@Verify that dwMaxFrameInterval is greater than dwMinFrameInterval AppendTextBuffer( "*!*ERROR: dwMinFrameInterval is larger that dwMaxFrameInterval, this invalidates the descriptor\r\n" ); OOPS(); } else if ((dwMinFrameInterval + dwFrameIntervalStep) > dwMaxFrameInterval) { //@@TestCase B17.5 //@@WARNING //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that dwMaxFrameInterval is greater than dwMinFrameInterval combined with dwFrameIntervalStep AppendTextBuffer( "*!*WARNING: dwMinFrameInterval + dwFrameIntervalStep is greater than dwMaxFrameInterval, this could cause problems\r\n" ); OOPS(); } else if ((dwMaxFrameInterval - dwMinFrameInterval) == 0 ) { //@@TestCase B17.6 //@@CAUTION //@@Descriptor Field - dwFrameIntervalStep //@@Suggestion to use descrite frames if dwFrameIntervalStep is zero AppendTextBuffer( "*!*CAUTION: dwFrameIntervalStep equals zero, consider using discrete frames\r\n" ); OOPS(); } else if ((dwMaxFrameInterval - dwMinFrameInterval) % dwFrameIntervalStep ) { //@@TestCase B17.7 (descript.c 1052) //@@WARNING //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that the difference between dwMaxFrameInterval and dwMinFrameInterval is evenly divisible by dwFrameIntervalStep AppendTextBuffer( "*!*WARNING: dwMaxFrameInterval minus dwMinFrameInterval is not evenly divisible by dwFrameIntervalStep, this could cause problems\r\n" ); OOPS(); } if (dwFrameIntervalStep == 0 && (dwMaxFrameInterval - dwMinFrameInterval)) { //@@TestCase B17.8 (descript.c line 1032) //@@WARNING //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that the dwFrameIntervalStep is not zero if there is a difference between dwMaxFrameInterval and dwMinFrameInterval AppendTextBuffer( "*!*WARNING: dwFrameIntervalStep = 0, this invalidates the descriptor when there is a difference between dwMinFrameInterval and dwMaxFrameInterval\r\n" ); OOPS(); } return TRUE; } //***************************************************************************** // // DisplayUnComDiscreteFrameType() // //***************************************************************************** BOOL DisplayUnComDiscreteFrameType( PVIDEO_FRAME_UNCOMPRESSED UDiscreteDesc ) { //@@DisplayUnComDiscreteFrameType -Uncompressed Discrete Frame UINT iNdex = 1; UINT iCurFrame = 0; ULONG * ulFrameInterval = NULL; AppendTextBuffer( "===>Additional Discrete Frame Type Data\r\n" ); // There are (UDiscreteDesc->bFrameIntervalType) dwFrameIntervals (1 based index) for (; iNdex <= UDiscreteDesc->bFrameIntervalType; iNdex++, iCurFrame++) { ulFrameInterval = &UDiscreteDesc->adwFrameInterval[iCurFrame]; // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n" , iNdex, *ulFrameInterval, (( double )*ulFrameInterval)/10000.0, (10000000.0/(( double )*ulFrameInterval)) ); if (0 == *ulFrameInterval) { //@@TestCase B18.1 (descript.c line 1061) //@@ERROR //@@Descriptor Field - dwFrameInterval[x] //@@dwFrameInterval[x] must be non-zero AppendTextBuffer( "*!*ERROR: dwFrameInterval[%d] must be non-zero\r\n" , iNdex); OOPS(); } if ((iNdex > 1)&&(*ulFrameInterval <= UDiscreteDesc->adwFrameInterval[iCurFrame - 1])) { //@@TestCase B18.2 (descript.c line 1067) //@@ERROR //@@Descriptor Field - dwFrameInterval[x] //@@dwFrameInterval[n] must be greater than dwFrameInterval[n - 1] AppendTextBuffer( "*!*ERROR: dwFrameInterval[0x%02X] must be " \ "greater than preceding dwFrameInterval[0x%02X]\r\n" , iNdex, iNdex - 1); OOPS(); } } return TRUE; } //***************************************************************************** // // DisplayMJPEGFormat() // //***************************************************************************** BOOL DisplayMJPEGFormat ( PVIDEO_FORMAT_MJPEG MJPEGFormatDesc ) { //@@DisplayMJPEGFormat - MJPEG Format // Initialize the default Frame g_chMJPEGFrameDefault = MJPEGFormatDesc->bDefaultFrameIndex; AppendTextBuffer( "\r\n ===>Video Streaming MJPEG Format Type Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , MJPEGFormatDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , MJPEGFormatDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , MJPEGFormatDesc->bDescriptorSubtype); AppendTextBuffer( "bFormatIndex: 0x%02X\r\n" , MJPEGFormatDesc->bFormatIndex); AppendTextBuffer( "bNumFrameDescriptors: 0x%02X\r\n" , MJPEGFormatDesc->bNumFrameDescriptors); if (MJPEGFormatDesc->bLength != sizeof (VIDEO_FORMAT_MJPEG)) { //@@TestCase B19.1 (descript.c line 1098) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the //@@ required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , MJPEGFormatDesc->bLength, sizeof (VIDEO_FORMAT_MJPEG)); OOPS(); } if (MJPEGFormatDesc->bFormatIndex == 0 ) { //@@TestCase B19.2 (descript.c line 1103) //@@ERROR //@@Descriptor Field - bFormatIndex //@@bFormatIndex is set to zero which is not in accordance with //@@ the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bFormatIndex must be non-zero\r\n" ); OOPS(); } if (MJPEGFormatDesc->bNumFrameDescriptors == 0 ) { //@@TestCase B19.3 (descript.c line 1108) //@@ERROR //@@Descriptor Field - bNumFrameDescriptors //@@bNumFrameDescriptors is set to zero which is not in accordance //@@ with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bNumFrameDescriptors must be non-zero\r\n" ); OOPS(); } AppendTextBuffer( "bmFlags: 0x%02X" , (MJPEGFormatDesc->bmFlags & 0x01)); //@@TestCase B19.4 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bmFlags //@@We should validate that reserved bits are set to zero. if (gDoAnnotation) { if (MJPEGFormatDesc->bmFlags & 0x01) { AppendTextBuffer( " -> Sample Size is Fixed" ); } else { AppendTextBuffer( " -> Sample Size is Not Fixed" ); } } AppendTextBuffer( "\r\nbDefaultFrameIndex: 0x%02X\r\n" , MJPEGFormatDesc->bDefaultFrameIndex); if (MJPEGFormatDesc->bDefaultFrameIndex == 0 || MJPEGFormatDesc->bDefaultFrameIndex > MJPEGFormatDesc->bNumFrameDescriptors) { //@@TestCase B19.5 (descript.c line 1113) //@@ERROR //@@Descriptor Field - bDefaultFrameIndex //@@bDefaultFrameIndex is not in the domain of constrained by //@@ bNumFrameDescriptors AppendTextBuffer( "*!*ERROR: bDefaultFrameIndex 0x%02X invalid, should " \ "be between 1 and 0x%02x/r/n" , MJPEGFormatDesc->bDefaultFrameIndex, MJPEGFormatDesc->bNumFrameDescriptors); OOPS(); } AppendTextBuffer( "bAspectRatioX: 0x%02X\r\n" , MJPEGFormatDesc->bAspectRatioX); AppendTextBuffer( "bAspectRatioY: 0x%02X" , MJPEGFormatDesc->bAspectRatioY); if (((MJPEGFormatDesc->bmInterlaceFlags & 0x01) && ((MJPEGFormatDesc->bAspectRatioY != 0) && (MJPEGFormatDesc->bAspectRatioX != 0)))) { if (gDoAnnotation) { AppendTextBuffer( " -> Aspect Ratio is set for a %d:%d display" , (MJPEGFormatDesc->bAspectRatioX), (MJPEGFormatDesc->bAspectRatioY)); } } else { if (MJPEGFormatDesc->bAspectRatioY != 0 || MJPEGFormatDesc->bAspectRatioX != 0) { //@@TestCase B19.6 //@@ERROR //@@Descriptor Field - bAspectRatioX and bAspectRatioY //@@Verify that that bAspectRatioX and bAspectRatioY are set to zero //@@ if stream is non-interlaced AppendTextBuffer( "\r\n*!*ERROR: bAspectRatioX and bAspectRatioY must " \ "be 0 if stream non-Interlaced" ); OOPS(); } } AppendTextBuffer( "\r\nbmInterlaceFlags: 0x%02X\r\n" , MJPEGFormatDesc->bmInterlaceFlags); if (gDoAnnotation) { AppendTextBuffer( " D00 = %x %sInterlaced stream or variable\r\n" , (MJPEGFormatDesc->bmInterlaceFlags & 1), (MJPEGFormatDesc->bmInterlaceFlags & 1) ? "" : " non-" ); AppendTextBuffer( " D01 = %x %s per frame\r\n" , ((MJPEGFormatDesc->bmInterlaceFlags >> 1) & 1), ((MJPEGFormatDesc->bmInterlaceFlags >> 1) & 1) ? " 1 field" : " 2 fields" ); AppendTextBuffer( " D02 = %x Field 1 %sfirst\r\n" , ((MJPEGFormatDesc->bmInterlaceFlags >> 2) & 1), ((MJPEGFormatDesc->bmInterlaceFlags >> 2) & 1) ? "" : "not " ); //@@TestCase B19.7 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bmInterlaceFlags //@@Validate that reserved bits (D3) are set to zero. AppendTextBuffer( " D03 = %x Reserved%s\r\n" , ((MJPEGFormatDesc->bmInterlaceFlags >> 3) & 1), ((MJPEGFormatDesc->bmInterlaceFlags >> 3) & 1) ? "\r\n*!*ERROR: non zero" : "" ); AppendTextBuffer( " D4..5 = %x Field patterns ->" , ((MJPEGFormatDesc->bmInterlaceFlags >> 4) & 3)); switch (MJPEGFormatDesc->bmInterlaceFlags & 0x30) { case 0x00: AppendTextBuffer( " Field 1 only" ); break ; case 0x10: AppendTextBuffer( " Field 2 only" ); break ; case 0x20: AppendTextBuffer( " Regular Pattern of fields 1 and 2" ); break ; case 0x30: AppendTextBuffer( " Random Pattern of fields 1 and 2" ); break ; } AppendTextBuffer( "\r\n D6..7 = %x Display Mode ->" , ((MJPEGFormatDesc->bmInterlaceFlags >> 6) & 3)); switch (MJPEGFormatDesc->bmInterlaceFlags & 0xC0) { case 0x00: AppendTextBuffer( " Bob only" ); break ; case 0x40: AppendTextBuffer( " Weave only" ); break ; case 0x80: AppendTextBuffer( " Bob or weave" ); break ; case 0xC0: //@@TestCase B19.8 //@@Not yet implemented - Priority 3 //@@Descriptor Field - bmInterlaceFlags //@@Question - Should we validate that reserved bits are set to zero? AppendTextBuffer( " Reserved" ); break ; } } //@@TestCase B19.9 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bCopyProtect //@@Question - Are their reserved bits and should we validate that //@@ reserved bits are set to zero? AppendTextBuffer( "\r\nbCopyProtect: 0x%02X" , MJPEGFormatDesc->bCopyProtect); if (gDoAnnotation) { if (MJPEGFormatDesc->bCopyProtect) AppendTextBuffer( " -> Duplication Restricted" ); else AppendTextBuffer( " -> Duplication Unrestricted" ); } AppendTextBuffer( "\r\n" ); // Check that the correct number of Frame Descriptors and one Color Matching // descriptor follow CheckForColorMatchingDesc ((PVIDEO_SPECIFIC) MJPEGFormatDesc, MJPEGFormatDesc->bNumFrameDescriptors, VS_FRAME_MJPEG); return TRUE; } //***************************************************************************** // // DisplayMJPEGFrameType() // //***************************************************************************** BOOL DisplayMJPEGFrameType ( PVIDEO_FRAME_MJPEG MJPEGFrameDesc ) { //@@DisplayMJPEGFrameType -MJPEG Frame size_t bLength = 0; bLength = SizeOfVideoFrameMjpeg(MJPEGFrameDesc); AppendTextBuffer( "\r\n ===>Video Streaming MJPEG Frame Type Descriptor<===\r\n" ); if (gDoAnnotation) { if (MJPEGFrameDesc->bFrameIndex == g_chMJPEGFrameDefault) { AppendTextBuffer( " --->This is the Default (optimum) Frame index\r\n" ); } } AppendTextBuffer( "bLength: 0x%02X\r\n" , MJPEGFrameDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , MJPEGFrameDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , MJPEGFrameDesc->bDescriptorSubtype); AppendTextBuffer( "bFrameIndex: 0x%02X\r\n" , MJPEGFrameDesc->bFrameIndex); AppendTextBuffer( "bmCapabilities: 0x%02X\r\n" , MJPEGFrameDesc->bmCapabilities); AppendTextBuffer( "wWidth: 0x%04X = %d\r\n" , MJPEGFrameDesc->wWidth, MJPEGFrameDesc->wWidth); AppendTextBuffer( "wHeight: 0x%04X = %d\r\n" , MJPEGFrameDesc->wHeight, MJPEGFrameDesc->wHeight); AppendTextBuffer( "dwMinBitRate: 0x%08X\r\n" , MJPEGFrameDesc->dwMinBitRate); AppendTextBuffer( "dwMaxBitRate: 0x%08X\r\n" , MJPEGFrameDesc->dwMaxBitRate); AppendTextBuffer( "dwMaxVideoFrameBufferSize: 0x%08X\r\n" , MJPEGFrameDesc->dwMaxVideoFrameBufferSize); // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n" , MJPEGFrameDesc->dwDefaultFrameInterval, (( double )MJPEGFrameDesc->dwDefaultFrameInterval)/10000.0, (10000000.0/(( double )MJPEGFrameDesc->dwDefaultFrameInterval)) ); AppendTextBuffer( "bFrameIntervalType: 0x%02X\r\n" , MJPEGFrameDesc->bFrameIntervalType); if (MJPEGFrameDesc->bLength != bLength) { //@@TestCase B20.1 (descript.c line 1154) //@@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 is incorrect, should be %d\r\n" , MJPEGFrameDesc->bLength, bLength); OOPS(); } if (MJPEGFrameDesc->bFrameIndex == 0 ) { //@@TestCase B20.2 (descript.c line 1159) //@@WARNING //@@Descriptor Field - bFrameIndex //@@bFrameIndex is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*WARNING: bFrameIndex = 0, this invalidates the descriptor\r\n" ); OOPS(); } //@@TestCase B20.3 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bmCapabilities //@@Question: Should we try to verify that bmCapabilities is valid? // AppendTextBuffer("bmCapabilities: 0x%02X\r\n", MJPEGFrameDesc->bmCapabilities); if (MJPEGFrameDesc->wWidth == 0 ) { //@@TestCase B20.4 (descript.c line 1164) //@@ERROR //@@Descriptor Field - wWidth //@@wWidth is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: wWidth = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (MJPEGFrameDesc->wHeight == 0 ) { //@@TestCase B20.5 (descript.c line 1169) //@@ERROR //@@Descriptor Field - wHeight //@@wHeight is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: wHeight = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (MJPEGFrameDesc->dwMinBitRate == 0 ) { //@@TestCase B20.6 (descript.c line 1174) //@@ERROR //@@Descriptor Field - dwMinBitRate //@@dwMinBitRate is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMinBitRate = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (MJPEGFrameDesc->dwMaxBitRate == 0 ) { //@@TestCase B20.7 (descript.c line 1179) //@@ERROR //@@Descriptor Field - dwMaxBitRate //@@dwMaxBitRate is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMaxBitRate = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (MJPEGFrameDesc->dwMinBitRate > MJPEGFrameDesc->dwMaxBitRate) { //@@TestCase B20.8 //@@ERROR //@@Descriptor Field - dwMinBitRate and dwMaxBitRate //@@Verify that dwMaxBitRate is greater than dwMinBitRate AppendTextBuffer( "*!*ERROR: dwMinBitRate > dwMaxBitRate, this invalidates the descriptor\r\n" ); OOPS(); } else if (MJPEGFrameDesc->bFrameIntervalType == 1 && MJPEGFrameDesc->dwMinBitRate != MJPEGFrameDesc->dwMaxBitRate) { //@@TestCase B20.9 //@@WARNING //@@Descriptor Field - bFrameIntervalType, dwMinBitRate, and dwMaxBitRate //@@Verify that dwMaxBitRate is equal to dwMinBitRate if bFrameIntervalType is 1 AppendTextBuffer( "*!*WARNING: if bFrameIntervalType is 1 then dwMinBitRate should equal dwMaxBitRate\r\n" ); OOPS(); } if (MJPEGFrameDesc->dwMaxVideoFrameBufferSize == 0 ) { //@@TestCase B20.10 (descript.c line 1183) //@@ERROR //@@Descriptor Field - dwMaxVideoFrameBufferSize //@@dwMaxVideoFrameBufferSize is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMaxVideoFrameBufferSize = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (MJPEGFrameDesc->dwMaxVideoFrameBufferSize == 0 ) { //@@TestCase B20.11 (descript.c line 1188) //@@ERROR //@@Descriptor Field - dwDefaultFrameInterval //@@dwDefaultFrameInterval is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwDefaultFrameInterval = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (0 == MJPEGFrameDesc->bFrameIntervalType) { DisplayMJPEGContinuousFrameType(MJPEGFrameDesc); } else { DisplayMJPEGDiscreteFrameType(MJPEGFrameDesc); } return TRUE; } //***************************************************************************** // // DisplayMJPEGContinuousFrameType() // //***************************************************************************** BOOL DisplayMJPEGContinuousFrameType( PVIDEO_FRAME_MJPEG MContinuousDesc ) { //@@DisplayMJPEGContinuousFrameType - MJPEG Continuous Frame ULONG dwMinFrameInterval = MContinuousDesc->adwFrameInterval[0]; ULONG dwMaxFrameInterval = MContinuousDesc->adwFrameInterval[1]; ULONG dwFrameIntervalStep = MContinuousDesc->adwFrameInterval[2]; AppendTextBuffer( "===>Additional Continuous Frame Type Data\r\n" ); // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n" , dwMinFrameInterval, (( double )dwMinFrameInterval)/10000.0, ( ULONG )(10000000.0/(( double )dwMinFrameInterval) + 0.5)); AppendTextBuffer( "dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n" , dwMaxFrameInterval, (( double )dwMaxFrameInterval)/10000.0, ( ULONG )(10000000.0/(( double )dwMaxFrameInterval) + 0.5)); AppendTextBuffer( "dwFrameIntervalStep: 0x%08X\r\n" , dwFrameIntervalStep); if (dwMinFrameInterval == 0 ) { //@@TestCase B21.2 (descript.c line 1188) //@@ERROR //@@Descriptor Field - dwMinFrameInterval //@@dwMinFrameInterval is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMinFrameInterval = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (dwMaxFrameInterval == 0 ) { //@@TestCase B21.3 (descript.c line 1188) //@@ERROR //@@Descriptor Field - dwMaxFrameInterval //@@dwMaxFrameInterval is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMaxFrameInterval = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (dwMinFrameInterval > dwMaxFrameInterval) { //@@TestCase B21.4 (descript.c line 1211) //@@ERROR //@@Descriptor Field - dwMinFrameInterval and dwMaxFrameInterval //@@Verify that dwMaxFrameInterval is greater than dwMinFrameInterval AppendTextBuffer( "*!*ERROR: dwMinFrameInterval is larger that dwMaxFrameInterval, this invalidates the descriptor\r\n" ); OOPS(); } else if ((dwMinFrameInterval + dwFrameIntervalStep) > dwMaxFrameInterval) { //@@TestCase B21.5 //@@WARNING //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that dwMaxFrameInterval is greater than dwMinFrameInterval combined with dwFrameIntervalStep AppendTextBuffer( "*!*WARNING: dwMinFrameInterval + dwFrameIntervalStep is greater than dwMaxFrameInterval, this could cause problems\r\n" ); OOPS(); } else if ((dwMaxFrameInterval - dwMinFrameInterval) == 0 ) { //@@TestCase B21.6 //@@CAUTION //@@Descriptor Field - dwFrameIntervalStep //@@Suggestion to use descrite frames if dwFrameIntervalStep is zero AppendTextBuffer( "*!*CAUTION: dwFrameIntervalStep equals zero, consider using discrete frames\r\n" ); OOPS(); } else if ((dwMaxFrameInterval - dwMinFrameInterval) % dwFrameIntervalStep ) { //@@TestCase B21.7 (descript.c line 1220) //@@WARNING //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that the difference between dwMaxFrameInterval and dwMinFrameInterval is evenly divisible by dwFrameIntervalStep AppendTextBuffer( "*!*WARNING: dwMaxFrameInterval minus dwMinFrameInterval is not evenly divisible by dwFrameIntervalStep, this could cause problems\r\n" ); OOPS(); } if (dwFrameIntervalStep == 0 && (dwMaxFrameInterval - dwMinFrameInterval)) { //@@TestCase B21.8 (descript.c line 1200) //@@WARNING //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that the dwFrameIntervalStep is not zero if there is a difference between dwMaxFrameInterval and dwMinFrameInterval AppendTextBuffer( "*!*WARNING: dwFrameIntervalStep = 0, this invalidates the descriptor when there is a difference between \r\n *!*dwMinFrameInterval and dwMaxFrameInterval\r\n" ); OOPS(); } return TRUE; } //***************************************************************************** // // DisplayMJPEGDiscreteFrameType() // //***************************************************************************** BOOL DisplayMJPEGDiscreteFrameType( PVIDEO_FRAME_MJPEG MDiscreteDesc ) { //@@DisplayMJPEGDiscreteFrameType -MJPEG Discrete Frame UINT iNdex = 1; UINT iCurFrame = 0; ULONG * ulFrameInterval = NULL; AppendTextBuffer( "===>Additional Discrete Frame TypeData\r\n" ); // There are (MDiscreteDesc->bFrameIntervalType) dwFrameIntervals (1 based index) for (; iNdex <= MDiscreteDesc->bFrameIntervalType; iNdex++, iCurFrame++) { ulFrameInterval = &MDiscreteDesc->adwFrameInterval[iCurFrame]; // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n" , iNdex, *ulFrameInterval, (( double )*ulFrameInterval)/10000.0, (10000000.0/(( double )*ulFrameInterval)) ); if (0 == *ulFrameInterval) { //@@TestCase B22.1 (descript.c line 1229) //@@ERROR //@@Descriptor Field - dwFrameInterval[x] //@@dwFrameInterval[x] must be non-zero AppendTextBuffer( "*!*ERROR: dwFrameInterval[%d] must be non-zero\r\n" , iNdex); OOPS(); } if ((iNdex > 1)&&(*ulFrameInterval <= MDiscreteDesc->adwFrameInterval[iCurFrame - 1])) { //@@TestCase B22.2 (descript.c line 1235) //@@ERROR //@@Descriptor Field - dwFrameInterval[x] //@@dwFrameInterval[n] must be greater than dwFrameInterval[n - 1] AppendTextBuffer( "*!*ERROR: dwFrameInterval[0x%02X] must be " \ "greater than preceding dwFrameInterval[0x%02X]\r\n" , iNdex, iNdex - 1); OOPS(); } } return TRUE; } //***************************************************************************** // // DisplayMPEG1SSFormat() // //***************************************************************************** BOOL DisplayMPEG1SSFormat ( PVIDEO_FORMAT_MPEG1SS MPEG1SSFormatDesc ) { //@@DisplayMPEG1SSFormat -MPEG1 SS Format AppendTextBuffer( "\r\n ===>Video Streaming MPEG1-SS Format Type Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , MPEG1SSFormatDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , MPEG1SSFormatDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , MPEG1SSFormatDesc->bDescriptorSubtype); AppendTextBuffer( "bFormatIndex: 0x%02X\r\n" , MPEG1SSFormatDesc->bFormatIndex); AppendTextBuffer( "wPacketLength: 0x%02X\r\n" , MPEG1SSFormatDesc->bPacketLength); AppendTextBuffer( "wPackLength: 0x%02X\r\n" , MPEG1SSFormatDesc->bPackLength); AppendTextBuffer( "bPackdataType: 0x%02X" , (MPEG1SSFormatDesc->bPackDataType)); if (gDoAnnotation) { if (MPEG1SSFormatDesc->bPackDataType & 0x01){AppendTextBuffer( " -> Pack data size fixed\r\n" );} else {AppendTextBuffer( " -> Pack data size variable\r\n" ); }} else {AppendTextBuffer( "\r\n" );} if (MPEG1SSFormatDesc->bLength != sizeof (VIDEO_FORMAT_MPEG1SS)) { //@@TestCase B23.1 (descript.c line 1514) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d. USBView cannot correctly display descriptor\r\n" , MPEG1SSFormatDesc->bLength, sizeof (VIDEO_FORMAT_MPEG1SS)); OOPS(); } if (MPEG1SSFormatDesc->bFormatIndex == 0 ) { //@@TestCase B23.2 (descript.c line 1519) //@@WARNING //@@Descriptor Field - bFormatIndex //@@bFormatIndex is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*WARNING: bFormatIndex = 0, this invalidates the descriptor\r\n" ); OOPS(); } //@@TestCase B23.3 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bPackdataType //@@Question - Should we validate that reserved bits are set to zero? // AppendTextBuffer("bPackdataType: 0x%02X", (MPEG1SSFormatDesc->bPackdataType & 0x01)); // This descriptor is deprecated for UVC 1.1 #ifdef H264_SUPPORT if (UVC10 != g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC version >= 1.1 devices\r\n" ); } #else if (UVC11 == g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC 1.1 devices\r\n" ); } #endif return TRUE; } //***************************************************************************** // // DisplayMPEG2PSFormat() // //***************************************************************************** BOOL DisplayMPEG2PSFormat ( PVIDEO_FORMAT_MPEG2PS MPEG2PSFormatDesc ) { //@@DisplayMPEG2PSFormat -MPEG2 PS Format AppendTextBuffer( "\r\n ===>Video Streaming MPEG2-PS Format Type Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , MPEG2PSFormatDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , MPEG2PSFormatDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , MPEG2PSFormatDesc->bDescriptorSubtype); AppendTextBuffer( "bFormatIndex: 0x%02X\r\n" , MPEG2PSFormatDesc->bFormatIndex); AppendTextBuffer( "bPacketLength: 0x%02X\r\n" , MPEG2PSFormatDesc->bPacketLength); AppendTextBuffer( "bPackLength: 0x%02X\r\n" , MPEG2PSFormatDesc->bPackLength); AppendTextBuffer( "bPackDataType: 0x%02X" , (MPEG2PSFormatDesc->bPackDataType)); if (MPEG2PSFormatDesc->bLength != sizeof (VIDEO_FORMAT_MPEG2PS)) { //@@TestCase B24.1 (descript.c line 1542) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d. USBView cannot correctly display descriptor\r\n" , MPEG2PSFormatDesc->bLength, sizeof (VIDEO_FORMAT_MPEG2PS)); OOPS(); AppendTextBuffer( "*!*USBView will try to display the rest of the descriptor but results may not be accurate\r\n" ); } if (MPEG2PSFormatDesc->bFormatIndex == 0 ) { //@@TestCase B24.2 (descript.c line 1547) //@@WARNING //@@Descriptor Field - bFormatIndex //@@bFormatIndex is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*WARNING: bFormatIndex = 0, this invalidates the descriptor\r\n" ); OOPS(); } //@@TestCase B24.3 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bPackdataType //@@Question - Should we validate that reserved bits are set to zero? // AppendTextBuffer("bPackdataType: 0x%02X", (MPEG2PSFormatDesc->bPackdataType & 0x01)); // This descriptor is deprecated for UVC 1.1 #ifdef H264_SUPPORT if (UVC10 != g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC version >= 1.1 devices\r\n" ); } #else if (UVC11 == g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC 1.1 devices\r\n" ); } #endif return TRUE; } //***************************************************************************** // // DisplayMPEG2TSFormat() // //***************************************************************************** BOOL DisplayMPEG2TSFormat ( PVIDEO_FORMAT_MPEG2TS MPEG2TSFormatDesc ) { //@@DisplayMPEG2TSFormat -MPEG2 TS Format UCHAR bLength = sizeof (VIDEO_FORMAT_MPEG2TS); AppendTextBuffer( "\r\n ===>Video Streaming MPEG2-TS Format Type Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , MPEG2TSFormatDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , MPEG2TSFormatDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , MPEG2TSFormatDesc->bDescriptorSubtype); AppendTextBuffer( "bFormatIndex: 0x%02X\r\n" , MPEG2TSFormatDesc->bFormatIndex); AppendTextBuffer( "bDataOffset: 0x%02X\r\n" , MPEG2TSFormatDesc->bDataOffset); AppendTextBuffer( "bPacketLength: 0x%02X\r\n" , MPEG2TSFormatDesc->bPacketLength); AppendTextBuffer( "bStrideLength: 0x%02X\r\n" , MPEG2TSFormatDesc->bStrideLength); #ifdef H264_SUPPORT if (UVC10 != g_chUVCversion) #else if (UVC11 == g_chUVCversion) #endif { int i = 0; PCHAR pStr = NULL; OLECHAR szGUID[256]; GUID * pStrideGuid = NULL; pStrideGuid = (GUID *) (&MPEG2TSFormatDesc->bStrideLength + 1); memset ((LPOLESTR) szGUID, 0, sizeof (OLECHAR) * 256); i = StringFromGUID2((REFGUID) pStrideGuid, (LPOLESTR) szGUID, 255); i++; AppendTextBuffer( "guidStrideFormat: %S" , szGUID); pStr = VidFormatGUIDCodeToName((REFGUID) pStrideGuid); if (gDoAnnotation) { if (pStr) { AppendTextBuffer( " = %s Format" , pStr); } } AppendTextBuffer( "\r\n" ); bLength = sizeof (VIDEO_FORMAT_MPEG2TS) + sizeof (GUID); } if (MPEG2TSFormatDesc->bLength != bLength) { //@@TestCase B25.1 (descript.c line 1486) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , MPEG2TSFormatDesc->bLength, sizeof (VIDEO_FORMAT_MPEG2TS)); OOPS(); } if (MPEG2TSFormatDesc->bFormatIndex == 0 ) { //@@TestCase B25.2 (descript.c line 1491) //@@WARNING //@@Descriptor Field - bFormatIndex //@@bFormatIndex is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*WARNING: bFormatIndex = 0, this invalidates the descriptor\r\n" ); OOPS(); } //@@TestCase B25.3 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bDataOffset, wPacket and wStride //@@Question - Should we check that if bDataOffset is 0 that wPacket and wStride should equal each other // AppendTextBuffer("bDataOffset: 0x%02X\r\n", MPEG2TSFormatDesc->bDataOffset); return TRUE; } //***************************************************************************** // // DisplayMPEG4SLFormat() // //***************************************************************************** BOOL DisplayMPEG4SLFormat ( PVIDEO_FORMAT_MPEG4SL MPEG4SLFormatDesc ) { //@@DisplayMPEG4SLFormat -MPEG4 SL Format AppendTextBuffer( "\r\n ===>Video Streaming MPEG4-SL Format Type Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , MPEG4SLFormatDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , MPEG4SLFormatDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , MPEG4SLFormatDesc->bDescriptorSubtype); AppendTextBuffer( "bFormatIndex: 0x%02X\r\n" , MPEG4SLFormatDesc->bFormatIndex); AppendTextBuffer( "bPacketLength: 0x%02X\r\n" , MPEG4SLFormatDesc->bPacketLength); if (MPEG4SLFormatDesc->bLength != sizeof (VIDEO_FORMAT_MPEG4SL)) { //@@TestCase B26.1 (descript.c line 1568) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d. USBView cannot correctly display descriptor\r\n" , MPEG4SLFormatDesc->bLength, sizeof (VIDEO_FORMAT_MPEG4SL)); OOPS(); } if (MPEG4SLFormatDesc->bFormatIndex == 0 ) { //@@TestCase B26.2 (descript.c line 1573) //@@WARNING //@@Descriptor Field - bFormatIndex //@@bFormatIndex is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*WARNING: bFormatIndex = 0, this invalidates the descriptor\r\n" ); OOPS(); } // This descriptor is deprecated for UVC 1.1 #ifdef H264_SUPPORT if (UVC10 != g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC version >= 1.1 devices\r\n" ); } #else if (UVC11 == g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC 1.1 devices\r\n" ); } #endif return TRUE; } //***************************************************************************** // // DisplayStreamPayload() // //***************************************************************************** BOOL DisplayStreamPayload ( PVIDEO_FORMAT_STREAM StreamPayloadDesc ) { //@@DisplayStreamPayload -Stream Based Payload Format PCHAR pStr = NULL; OLECHAR szGUID[256]; int i = 0; memset ((LPOLESTR) szGUID, 0, sizeof (OLECHAR) * 256); i = StringFromGUID2((REFGUID) &StreamPayloadDesc->guidFormat, (LPOLESTR) szGUID, 255); i++; AppendTextBuffer( "\r\n ===>Video Streaming Stream Based Payload Format Type Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , StreamPayloadDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , StreamPayloadDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , StreamPayloadDesc->bDescriptorSubtype); AppendTextBuffer( "bFormatIndex: 0x%02X\r\n" , StreamPayloadDesc->bFormatIndex); AppendTextBuffer( "guidFormat: %S" , szGUID); pStr = VidFormatGUIDCodeToName((REFGUID) &StreamPayloadDesc->guidFormat); if (gDoAnnotation) { if (pStr) { AppendTextBuffer( " = %s Format" , pStr); } } AppendTextBuffer( "\r\n" ); AppendTextBuffer( "dwPacketLength: 0x%02X\r\n" , StreamPayloadDesc->dwPacketLength); if (StreamPayloadDesc->bLength != sizeof (VIDEO_FORMAT_STREAM)) { //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , StreamPayloadDesc->bLength, sizeof (PVIDEO_FORMAT_STREAM)); OOPS(); } if (StreamPayloadDesc->bFormatIndex == 0 ) { //@@WARNING //@@Descriptor Field - bFormatIndex //@@bFormatIndex is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*WARNING: bFormatIndex = 0, this is a 1 based index\r\n" ); OOPS(); } // This descriptor is new for UVC 1.1 if (UVC10 == g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC 1.0 devices\r\n" ); } return TRUE; } //***************************************************************************** // // DisplayDVFormat() // //***************************************************************************** BOOL DisplayDVFormat ( PVIDEO_FORMAT_DV DVFormatDesc ) { //@@DisplayDVFormat -Digital Video Format AppendTextBuffer( "\r\n ===>Video Streaming DV Format Type Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , DVFormatDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , DVFormatDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , DVFormatDesc->bDescriptorSubtype); AppendTextBuffer( "bFormatIndex: 0x%02X\r\n" , DVFormatDesc->bFormatIndex); AppendTextBuffer( "dwMaxVideoFrameBufferSize: 0x%08X\r\n" , DVFormatDesc->dwMaxVideoFrameBufferSize); AppendTextBuffer( "bFormatType: 0x%02X\r\n" , DVFormatDesc->bFormatType); if (gDoAnnotation) { AppendTextBuffer( " D0..6 = Format Type ->" ); switch (DVFormatDesc->bFormatType & 0x03) { case 0x00: AppendTextBuffer( " SD-DV\r\n" ); break ; case 0x01: AppendTextBuffer( " SDL-DV\r\n" ); break ; case 0x02: AppendTextBuffer( " HD-DV\r\n" ); break ; default : AppendTextBuffer( " Unknown Format\r\n" ); break ; } if (DVFormatDesc->bFormatType & 0x80) AppendTextBuffer( " D7 = 60Hz" ); else AppendTextBuffer( " D7 = 50Hz" ); AppendTextBuffer( "\r\n" );} if (DVFormatDesc->bLength != sizeof (VIDEO_FORMAT_DV)) { //@@TestCase B27.1 (descript.c line 1453) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , DVFormatDesc->bLength, sizeof (VIDEO_FORMAT_DV)); OOPS(); } if (DVFormatDesc->bFormatIndex == 0 ) { //@@TestCase B27.2 (descript.c line 1458) //@@ERROR //@@Descriptor Field - bFormatIndex //@@bFormatIndex invalid AppendTextBuffer( "*!*ERROR: bFormatIndex of 0x%02X is invalid\r\n" , DVFormatDesc->bFormatIndex); OOPS(); } if (DVFormatDesc->dwMaxVideoFrameBufferSize == 0 ) { //@@TestCase B27.3 (descript.c line 1463) //@@ERROR //@@Descriptor Field - dwMaxVideoFrameBufferSize //@@dwMaxVideoFrameBufferSize invalid AppendTextBuffer( "*!*ERROR: dwMaxVideoFrameBufferSize of 0x%02X is invalid\r\n" , DVFormatDesc->dwMaxVideoFrameBufferSize); OOPS(); } //@@TestCase B27.4 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bFormatType //@@Question - Should we validate that reserved bits are set to zero? return TRUE; } //***************************************************************************** // // DisplayVidVendorFormat() // //***************************************************************************** BOOL DisplayVendorVidFormat ( PVIDEO_FORMAT_VENDOR VendorVidFormatDesc ) { //@@DisplayVendorVidFormat -Vendor Video Format OLECHAR szGUID[256]; int i = 0; // Initialize the default Frame g_chVendorFrameDefault = VendorVidFormatDesc->bDefaultFrameIndex; memset ((LPOLESTR) szGUID, 0, sizeof (OLECHAR) * 256); i = StringFromGUID2((REFGUID) &VendorVidFormatDesc->guidMajorFormat, (LPOLESTR) szGUID, 255); i++; AppendTextBuffer( "\r\n ===>Video Streaming Vendor Video Format Type Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , VendorVidFormatDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , VendorVidFormatDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , VendorVidFormatDesc->bDescriptorSubtype); AppendTextBuffer( "bFormatIndex: 0x%02X\r\n" , VendorVidFormatDesc->bFormatIndex); AppendTextBuffer( "bNumFrameDescriptors: 0x%02X\r\n" , VendorVidFormatDesc->bNumFrameDescriptors); AppendTextBuffer( "guidMajorFormat: %S\r\n" , szGUID); i = StringFromGUID2((REFGUID) &VendorVidFormatDesc->guidSubFormat, (LPOLESTR) szGUID, 255); i++; AppendTextBuffer( "guidSubFormat: %S\r\n" , szGUID); i = StringFromGUID2((REFGUID) &VendorVidFormatDesc->guidSpecifier, (LPOLESTR) szGUID, 255); i++; AppendTextBuffer( "guidSpecifier: %S\r\n" , szGUID); AppendTextBuffer( "bPayloadClass: 0x%02X\r\n" , VendorVidFormatDesc->bPayloadClass); AppendTextBuffer( "bDefaultFrameIndex: 0x%02X\r\n" , VendorVidFormatDesc->bDefaultFrameIndex); AppendTextBuffer( "bCopyProtect: 0x%02X" , VendorVidFormatDesc->bCopyProtect); if (gDoAnnotation) { if (VendorVidFormatDesc->bCopyProtect) { AppendTextBuffer( " -> Duplication Restricted\r\n" );} else {AppendTextBuffer( " -> Duplication Unrestricted\r\n" );}} else {AppendTextBuffer( "\r\n" );} if (VendorVidFormatDesc->bLength != sizeof (VIDEO_FORMAT_VENDOR)) { //@@TestCase B28.1 (descript.c line 1297) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d. USBView cannot correctly display descriptor\r\n" , VendorVidFormatDesc->bLength, sizeof (VIDEO_FORMAT_VENDOR)); OOPS(); } if (VendorVidFormatDesc->bFormatIndex == 0 ) { //@@TestCase B28.2 (descript.c line 1302) //@@ERROR //@@Descriptor Field - bFormatIndex //@@bFormatIndex is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bFormatIndex = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (VendorVidFormatDesc->bNumFrameDescriptors == 0 ) { //@@TestCase B28.3 (descript.c line 1307) //@@ERROR //@@Descriptor Field - bNumFrameDescriptors //@@bNumFrameDescriptors is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bNumFrameDescriptors = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (VendorVidFormatDesc->bPayloadClass > 1) { //@@TestCase B28.4 //@@WARNING //@@Descriptor Field - bPayloadClass //@@bPayloadClass is using reserved space AppendTextBuffer( "*!*WARNING: bPayloadClass is incorrectly using reserved space\r\n" ); OOPS(); } else { if (gDoAnnotation) { if (VendorVidFormatDesc->bPayloadClass == 1) { AppendTextBuffer( " -> Using a Frame Based Payload\r\n" );} else { AppendTextBuffer( " -> Using a Stream Based Payload\r\n" );} } else {AppendTextBuffer( "\r\n" );} } if (VendorVidFormatDesc->bDefaultFrameIndex == 0 ) { //@@TestCase B28.5 (descript.c line 1312) //@@ERROR //@@Descriptor Field - bDefaultFrameIndex //@@bDefaultFrameIndex is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bDefaultFrameIndex = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (VendorVidFormatDesc->bDefaultFrameIndex == 0 || VendorVidFormatDesc->bDefaultFrameIndex > VendorVidFormatDesc->bNumFrameDescriptors) { //@@TestCase B28.6 //@@WARNING //@@Descriptor Field - bDefaultFrameIndex //@@bDefaultFrameIndex is out of range AppendTextBuffer( "*!*WARNING: The value %d for the bDefaultFrameIndex is out of range this invalidates the descriptor\r\n*!* The proper range is 1 to %d)" , VendorVidFormatDesc->bDefaultFrameIndex, VendorVidFormatDesc->bNumFrameDescriptors); OOPS(); } //@@TestCase B28.7 //@@Not yet implemented - Priority 1 //@@Descriptor Field - bCopyProtect //@@Question - Are their reserved bits and should we validate that reserved bits are set to zero? // AppendTextBuffer("bCopyProtect: 0x%02X", VendorVidFormatDesc->bCopyProtect); // Check that the correct number of Frame Descriptors and one Color Matching // descriptor follow CheckForColorMatchingDesc ((PVIDEO_SPECIFIC) VendorVidFormatDesc, VendorVidFormatDesc->bNumFrameDescriptors, VS_FRAME_VENDOR); // This descriptor is deprecated for UVC 1.1 #ifdef H264_SUPPORT if (UVC10 != g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC version >= 1.1 devices\r\n" ); } #else if (UVC11 == g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC 1.1 devices\r\n" ); } #endif return TRUE; } //***************************************************************************** // // DisplayVendorVidFrameType() // //***************************************************************************** BOOL DisplayVendorVidFrameType ( PVIDEO_FRAME_VENDOR VendorVidFrameDesc ) { //@@DisplayVendorVidFrameType -Vendor Video Frame size_t bLength = 0; bLength = SizeOfVideoFrameVendor(VendorVidFrameDesc); AppendTextBuffer( "\r\n ===>Video Streaming Vendor Video Frame Type Descriptor<===\r\n" ); if (gDoAnnotation) { if (VendorVidFrameDesc->bFrameIndex == g_chVendorFrameDefault) { AppendTextBuffer( " --->This is the Default (optimum) Frame index\r\n" ); } } AppendTextBuffer( "bLength: 0x%02X\r\n" , VendorVidFrameDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , VendorVidFrameDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , VendorVidFrameDesc->bDescriptorSubtype); AppendTextBuffer( "bFrameIndex: 0x%02X\r\n" , VendorVidFrameDesc->bFrameIndex); if (VendorVidFrameDesc->bLength != bLength) { //@@TestCase B29.1 (descript.c line 1352) //@@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" , VendorVidFrameDesc->bLength, bLength); OOPS(); } if (VendorVidFrameDesc->bFrameIndex == 0 ) { //@@TestCase B29.2 (descript.c line 1357) //@@ERROR //@@Descriptor Field - bFrameIndex //@@bFrameIndex is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bFrameIndex = 0, this is a 1 based index\r\n" ); OOPS(); } AppendTextBuffer( "bmCapabilities: 0x%02X" , VendorVidFrameDesc->bmCapabilities); if (VendorVidFrameDesc->bmCapabilities & 0x01){ if (gDoAnnotation) { AppendTextBuffer( " -> Still Images are supported\r\n" );} else {AppendTextBuffer( "\r\n" );} } else if (VendorVidFrameDesc->bmCapabilities & 0xFF) { //@@TestCase B29.3 //@@WARNING //@@Descriptor Field - bmCapabilities //@@bmCapabilities has a bit using reserved areas that should be set to zero AppendTextBuffer( "\r\n*!*WARNING: bmCapabilities is using reserved areas.\r\n" ); OOPS(); } else {AppendTextBuffer( "\r\n" );} AppendTextBuffer( "wWidth: 0x%04X = %d\r\n" , VendorVidFrameDesc->wWidth, VendorVidFrameDesc->wWidth); AppendTextBuffer( "wHeight: 0x%04X = %d\r\n" , VendorVidFrameDesc->wHeight, VendorVidFrameDesc->wHeight); AppendTextBuffer( "dwMinBitRate: 0x%08X\r\n" , VendorVidFrameDesc->dwMinBitRate); AppendTextBuffer( "dwMaxBitRate: 0x%08X\r\n" , VendorVidFrameDesc->dwMaxBitRate); AppendTextBuffer( "dwMaxVideoFrameBufferSize: 0x%08X\r\n" , VendorVidFrameDesc->dwMaxVideoFrameBufferSize); // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n" , VendorVidFrameDesc->dwDefaultFrameInterval, (( double )VendorVidFrameDesc->dwDefaultFrameInterval)/10000.0, (10000000.0/(( double )VendorVidFrameDesc->dwDefaultFrameInterval)) ); AppendTextBuffer( "bFrameIntervalType: 0x%02X\r\n" , VendorVidFrameDesc->bFrameIntervalType); if (VendorVidFrameDesc->wWidth == 0 ) { //@@TestCase B29.4 (descript.c line 1362) //@@ERROR //@@Descriptor Field - wWidth //@@wWidth is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: wWidth must be nonzero\r\n" ); OOPS(); } if (VendorVidFrameDesc->wHeight == 0 ) { //@@TestCase B29.5 (descript.c line 1367) //@@ERROR //@@Descriptor Field - wHeight //@@wHeight is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: wHeight must be nonzero\r\n" ); OOPS(); } if (VendorVidFrameDesc->dwMinBitRate == 0 ) { //@@TestCase B29.6 (descript.c line 1372) //@@ERROR //@@Descriptor Field - dwMinBitRate //@@dwMinBitRate is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMinBitRate must be nonzero\r\n" ); OOPS(); } if (VendorVidFrameDesc->dwMaxBitRate == 0 ) { //@@TestCase B29.7 (descript.c line 1377) //@@ERROR //@@Descriptor Field - dwMaxBitRate //@@dwMaxBitRate is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMaxBitRate must be nonzero\r\n" ); OOPS(); } if (VendorVidFrameDesc->dwMinBitRate > VendorVidFrameDesc->dwMaxBitRate) { //@@TestCase B29.8 //@@ERROR //@@Descriptor Field - dwMinBitRate and dwMaxBitRate //@@Verify that dwMaxBitRate is greater than dwMinBitRate AppendTextBuffer( "*!*ERROR: dwMinBitRate should be less than dwMaxBitRate\r\n" ); OOPS(); } else { if (VendorVidFrameDesc->bFrameIntervalType == 1 && VendorVidFrameDesc->dwMinBitRate != VendorVidFrameDesc->dwMaxBitRate) { //@@TestCase B29.9 //@@WARNING //@@Descriptor Field - bFrameIntervalType, dwMinBitRate, and dwMaxBitRate //@@Verify that dwMaxBitRate is equal to dwMinBitRate if bFrameIntervalType is 1 AppendTextBuffer( "*!*WARNING: if bFrameIntervalType is 1 then dwMinBitRate " \ "should equal dwMaxBitRate\r\n" ); OOPS(); } } if (VendorVidFrameDesc->dwMaxVideoFrameBufferSize == 0 ) { //@@TestCase B29.10 (descript.c line 1382) //@@WARNING //@@Descriptor Field - dwMaxVideoFrameBufferSize //@@dwMaxVideoFrameBufferSize is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*WARNING: dwMaxVideoFrameBufferSize must be nonzero\r\n" ); OOPS(); } if (VendorVidFrameDesc->dwDefaultFrameInterval == 0 ) { //@@TestCase B29.11 (descript.c line 1020) //@@WARNING //@@Descriptor Field - dwDefaultFrameInterval //@@dwDefaultFrameInterval must be nonzero AppendTextBuffer( "*!*WARNING: dwDefaultFrameInterval must be nonzero\r\n" ); OOPS(); } if (VendorVidFrameDesc->bFrameIntervalType == 0) { DisplayVendorVidContinuousFrameType(VendorVidFrameDesc); } else { DisplayVendorVidDiscreteFrameType(VendorVidFrameDesc); } // This descriptor is deprecated for UVC 1.1 #ifdef H264_SUPPORT if (UVC10 != g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC version >= 1.1 devices\r\n" ); } #else if (UVC11 == g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC 1.1 devices\r\n" ); } #endif return TRUE; } //***************************************************************************** // // DisplayVendorVidContinuousFrameType() // //***************************************************************************** BOOL DisplayVendorVidContinuousFrameType( PVIDEO_FRAME_VENDOR VContinuousDesc ) { //@@DisplayVendorVidContinuousFrameType -Vendor Video Continuous Frame ULONG dwMinFrameInterval = VContinuousDesc->adwFrameInterval[0]; ULONG dwMaxFrameInterval = VContinuousDesc->adwFrameInterval[1]; ULONG dwFrameIntervalStep = VContinuousDesc->adwFrameInterval[2]; AppendTextBuffer( "===>Additional Continuous Frame Type Data\r\n" ); // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n" , dwMinFrameInterval, (( double )dwMinFrameInterval)/10000.0, ( ULONG )(10000000.0/(( double )dwMinFrameInterval) + 0.5)); AppendTextBuffer( "dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n" , dwMaxFrameInterval, (( double )dwMaxFrameInterval)/10000.0, ( ULONG )(10000000.0/(( double )dwMaxFrameInterval) + 0.5)); AppendTextBuffer( "dwFrameIntervalStep: 0x%08X\r\n" , dwFrameIntervalStep); if (dwMinFrameInterval == 0 ) { //@@TestCase B30.2 (descript.c line 1388) //@@ERROR //@@Descriptor Field - dwMinFrameInterval //@@dwMinFrameInterval is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMinFrameInterval = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (dwMaxFrameInterval == 0 ) { //@@TestCase B30.3 (descript.c line 1388) //@@ERROR //@@Descriptor Field - dwMaxFrameInterval //@@dwMaxFrameInterval is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMaxFrameInterval = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (dwMinFrameInterval > dwMaxFrameInterval) { //@@TestCase B30.4 (descript.c line 1405) //@@ERROR //@@Descriptor Field - dwMinFrameInterval and dwMaxFrameInterval //@@Verify that dwMaxFrameInterval is greater than dwMinFrameInterval AppendTextBuffer( "*!*ERROR: dwMinFrameInterval is larger that dwMaxFrameInterval, this invalidates the descriptor\r\n" ); OOPS(); } else if ((dwMinFrameInterval + dwFrameIntervalStep) > dwMaxFrameInterval) { //@@TestCase B30.5 //@@WARNING //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that dwMaxFrameInterval is greater than dwMinFrameInterval combined with dwFrameIntervalStep AppendTextBuffer( "*!*WARNING: dwMinFrameInterval + dwFrameIntervalStep is greater than dwMaxFrameInterval, this could cause problems\r\n" ); OOPS(); } else if ((dwMaxFrameInterval - dwMinFrameInterval) == 0 ) { //@@TestCase B30.6 //@@CAUTION //@@Descriptor Field - dwFrameIntervalStep //@@Suggestion to use descrite frames if dwFrameIntervalStep is zero AppendTextBuffer( "*!*CAUTION: dwFrameIntervalStep equals zero, consider using discrete frames\r\n" ); OOPS(); } else if ((dwMaxFrameInterval - dwMinFrameInterval) % dwFrameIntervalStep ) { //@@TestCase B30.7 (descript.c line 1414) //@@ERROR //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that the difference between dwMaxFrameInterval and dwMinFrameInterval is evenly divisible by dwFrameIntervalStep AppendTextBuffer( "*!*ERROR: dwMaxFrameInterval minus dwMinFrameInterval is not evenly divisible by dwFrameIntervalStep, this could cause problems\r\n" ); OOPS(); } if (dwFrameIntervalStep == 0 && (dwMaxFrameInterval - dwMinFrameInterval)) { //@@TestCase B30.8 (descript.c line 1394) //@@ERROR //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that the dwFrameIntervalStep is not zero if there is a difference between dwMaxFrameInterval and dwMinFrameInterval AppendTextBuffer( "*!*ERROR: dwFrameIntervalStep = 0, this invalidates the descriptor when there is a difference between \r\n dwMinFrameInterval and dwMaxFrameInterval\r\n" ); OOPS(); } return TRUE; } //***************************************************************************** // // DisplayVendorVidDiscreteFrameType() // //***************************************************************************** BOOL DisplayVendorVidDiscreteFrameType( PVIDEO_FRAME_VENDOR VDiscreteDesc ) { //@@DisplayVendorVidDiscreteFrameType -Vendor Video Discrete Frame UINT iNdex = 1; UINT iCurFrame = 0; ULONG * ulFrameInterval = NULL; AppendTextBuffer( "===>Additional Discrete Frame TypeData\r\n" ); // There are (VDiscreteDesc->bFrameIntervalType) dwFrameIntervals for (; iNdex <= VDiscreteDesc->bFrameIntervalType; iNdex++, iCurFrame++) { ulFrameInterval = &VDiscreteDesc->adwFrameInterval[iCurFrame]; // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n" , iNdex, *ulFrameInterval, (( double )*ulFrameInterval)/10000.0, (10000000.0/(( double )*ulFrameInterval)) ); if (0 == *ulFrameInterval) { //@@TestCase B31.1 (descript.c line 1061) //@@ERROR //@@Descriptor Field - dwFrameInterval[x] //@@dwFrameInterval[x] must be non-zero AppendTextBuffer( "*!*ERROR: dwFrameInterval[%d] must be non-zero\r\n" , iNdex); OOPS(); } if ((iNdex > 1)&&(*ulFrameInterval <= VDiscreteDesc->adwFrameInterval[iCurFrame - 1])) { //@@TestCase B31.2 (descript.c line 1067) //@@ERROR //@@Descriptor Field - dwFrameInterval[x] //@@dwFrameInterval[n] must be greater than dwFrameInterval[n - 1] AppendTextBuffer( "*!*ERROR: dwFrameInterval[0x%02X] must be " \ "greater than preceding dwFrameInterval[0x%02X]\r\n" , iNdex, iNdex - 1); OOPS(); } } return TRUE; } //***************************************************************************** // // DisplayFramePayloadFormat() // //***************************************************************************** BOOL DisplayFramePayloadFormat ( PVIDEO_FORMAT_FRAME FramePayloadFormatDesc ) { //@@DisplayFramePayloadFormat - FrameBased Payload Format PCHAR pStr = NULL; OLECHAR szGUID[256]; int i = 0; // Initialize the default Frame g_chFrameBasedFrameDefault = FramePayloadFormatDesc->bDefaultFrameIndex; memset ((LPOLESTR) szGUID, 0, sizeof (OLECHAR) * 256); i = StringFromGUID2((REFGUID) &FramePayloadFormatDesc->guidFormat, (LPOLESTR) szGUID, 255); i++; AppendTextBuffer( "\r\n ===>Video Streaming Frame Based Payload Format Type Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X\r\n" , FramePayloadFormatDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , FramePayloadFormatDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , FramePayloadFormatDesc->bDescriptorSubtype); AppendTextBuffer( "bFormatIndex: 0x%02X\r\n" , FramePayloadFormatDesc->bFormatIndex); AppendTextBuffer( "bNumFrameDescriptors: 0x%02X\r\n" , FramePayloadFormatDesc->bNumFrameDescriptors); AppendTextBuffer( "guidFormat: %S" , szGUID); pStr = VidFormatGUIDCodeToName((REFGUID) &FramePayloadFormatDesc->guidFormat); if ( pStr ) { if ( gDoAnnotation ) { AppendTextBuffer( " = %s Format" , pStr); } } AppendTextBuffer( "\r\n" ); AppendTextBuffer( "bBitsPerPixel: 0x%02X\r\n" , FramePayloadFormatDesc->bBitsPerPixel); AppendTextBuffer( "bDefaultFrameIndex: 0x%02X\r\n" , FramePayloadFormatDesc->bDefaultFrameIndex); if (FramePayloadFormatDesc->bLength != sizeof (VIDEO_FORMAT_FRAME)) { //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required //@@length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , FramePayloadFormatDesc->bLength, sizeof (VIDEO_FORMAT_FRAME)); OOPS(); } if (FramePayloadFormatDesc->bFormatIndex == 0 ) { //@@ERROR //@@Descriptor Field - bFormatIndex //@@bFormatIndex is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bFormatIndex = 0, this is a 1 based index\r\n" ); OOPS(); } if (FramePayloadFormatDesc->bNumFrameDescriptors == 0 ) { //@@ERROR //@@Descriptor Field - bNumFrameDescriptors //@@bNumFrameDescriptors is set to zero which is not in accordance with the //@@USB Video Device Specification AppendTextBuffer( "*!*ERROR: bNumFrameDescriptors = 0, must have at least 1 Frame descriptor\r\n" ); OOPS(); } if (!(pStr)) { //@@WARNING //@@Descriptor Field - guidFormat //@@guidFormat is set to unknown or undefined format AppendTextBuffer( "\r\n*!*WARNING: guidFormat is an unknown format\r\n" ); OOPS(); } if (FramePayloadFormatDesc->bBitsPerPixel == 0 ) { //@@ERROR //@@Descriptor Field - bBitsPerPixel //@@bBitsPerPixel is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bBitsPerPixel = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (FramePayloadFormatDesc->bDefaultFrameIndex == 0 || FramePayloadFormatDesc->bDefaultFrameIndex > FramePayloadFormatDesc->bNumFrameDescriptors) { //@@ERROR //@@Descriptor Field - bDefaultFrameIndex //@@The value for bDefaultFrameIndex is not greater than 0 or less than or equal to bNumFrameDescriptors AppendTextBuffer( "*!*ERROR: The value %d for the bDefaultFrameIndex is out of range, this invalidates the descriptor\r\n*!*The proper range is 1 to %d)" , FramePayloadFormatDesc->bDefaultFrameIndex, FramePayloadFormatDesc->bNumFrameDescriptors); OOPS(); } AppendTextBuffer( "bAspectRatioX: 0x%02X\r\n" , FramePayloadFormatDesc->bAspectRatioX); AppendTextBuffer( "bAspectRatioY: 0x%02X" , FramePayloadFormatDesc->bAspectRatioY); if (((FramePayloadFormatDesc->bmInterlaceFlags & 0x01) && (FramePayloadFormatDesc->bAspectRatioY != 0 && FramePayloadFormatDesc->bAspectRatioX != 0))) { if (gDoAnnotation) { AppendTextBuffer( " -> Aspect Ratio is set for a %d:%d display" , (FramePayloadFormatDesc->bAspectRatioX),(FramePayloadFormatDesc->bAspectRatioY)); } else { if (FramePayloadFormatDesc->bAspectRatioY != 0 || FramePayloadFormatDesc->bAspectRatioX != 0) { //@@ERROR //@@Descriptor Field - bAspectRatioX, bAspectRatioY //@@Verify that that bAspectRatioX and bAspectRatioY are set to zero //@@ if stream is non-interlaced AppendTextBuffer( "\r\n*!*ERROR: Both bAspectRatioX and bAspectRatioY " \ "must equal 0 if stream is non-interlaced" ); OOPS(); } } } AppendTextBuffer( "\r\nbmInterlaceFlags: 0x%02X\r\n" , FramePayloadFormatDesc->bmInterlaceFlags); if (gDoAnnotation) { AppendTextBuffer( " D0 = 0x%02X Interlaced stream or variable: %s\r\n" , (FramePayloadFormatDesc->bmInterlaceFlags & 1), (FramePayloadFormatDesc->bmInterlaceFlags & 1) ? "Yes" : "No" ); AppendTextBuffer( " D1 = 0x%02X Fields per frame: %s\r\n" , ((FramePayloadFormatDesc->bmInterlaceFlags >> 1) & 1), ((FramePayloadFormatDesc->bmInterlaceFlags >> 1) & 1) ? "1 field" : "2 fields" ); AppendTextBuffer( " D2 = 0x%02X Field 1 first: %s\r\n" , ((FramePayloadFormatDesc->bmInterlaceFlags >> 2) & 1), ((FramePayloadFormatDesc->bmInterlaceFlags >> 2) & 1) ? "Yes" : "No" ); //@@Descriptor Field - bmInterlaceFlags //@@Validate that reserved bits (D3) are set to zero. AppendTextBuffer( " D3 = 0x%02X Reserved%s\r\n" , ((FramePayloadFormatDesc->bmInterlaceFlags >> 3) & 1), ((FramePayloadFormatDesc->bmInterlaceFlags >> 3) & 1) ? "\r\n*!*ERROR: Reserved to 0" : "" ); AppendTextBuffer( " D4..5 = 0x%02X Field patterns ->" , ((FramePayloadFormatDesc->bmInterlaceFlags >> 4) & 3)); switch (FramePayloadFormatDesc->bmInterlaceFlags & 0x30) { case 0x00: AppendTextBuffer( " Field 1 only" ); break ; case 0x10: AppendTextBuffer( " Field 2 only" ); break ; case 0x20: AppendTextBuffer( " Regular Pattern of fields 1 and 2" ); break ; case 0x30: AppendTextBuffer( " Random Pattern of fields 1 and 2" ); break ; } AppendTextBuffer( "\r\n D6..7 = 0x%02X Display Mode ->" , ((FramePayloadFormatDesc->bmInterlaceFlags >> 6) & 3)); switch (FramePayloadFormatDesc->bmInterlaceFlags & 0xC0) { case 0x00: AppendTextBuffer( " Bob only" ); break ; case 0x40: AppendTextBuffer( " Weave only" ); break ; case 0x80: AppendTextBuffer( " Bob or weave" ); break ; case 0xC0: //@@Descriptor Field - bmInterlaceFlags //@@Question - Should we validate that reserved bits are set to zero? AppendTextBuffer( " Reserved" ); break ; } } //@@Descriptor Field - bCopyProtect //@@Question - Are their reserved bits and should we validate that //@@ reserved bits are set to zero? AppendTextBuffer( "\r\nbCopyProtect: 0x%02X" , FramePayloadFormatDesc->bCopyProtect); if (gDoAnnotation) { if (FramePayloadFormatDesc->bCopyProtect) AppendTextBuffer( " -> Duplication Restricted" ); else AppendTextBuffer( " -> Duplication Unrestricted" ); } //@@Descriptor Field - bVariableSize AppendTextBuffer( "\r\nbVariableSize: 0x%02X" , FramePayloadFormatDesc->bVariableSize); if (gDoAnnotation) { if (FramePayloadFormatDesc->bVariableSize) AppendTextBuffer( " -> Variable Size" ); else AppendTextBuffer( " -> Fixed Size" ); } AppendTextBuffer( "\r\n" ); // Check that the correct number of Frame Descriptors and one Color Matching // descriptor follow CheckForColorMatchingDesc ((PVIDEO_SPECIFIC) FramePayloadFormatDesc, FramePayloadFormatDesc->bNumFrameDescriptors, VS_FRAME_FRAME_BASED); // This descriptor is new for UVC 1.1 if (UVC10 == g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC 1.0 devices\r\n" ); } return TRUE; } //***************************************************************************** // // DisplayFramePayloadFrame() // //***************************************************************************** BOOL DisplayFramePayloadFrame ( PVIDEO_FRAME_FRAME FramePayloadFrameDesc ) { size_t bLength = 0; bLength = SizeOfVideoFrameFrame(FramePayloadFrameDesc); //@@DisplayFramePayloadFrame -Frame Based Payload Frame AppendTextBuffer( "\r\n ===>Video Streaming Frame Based Payload Frame Type Descriptor<===\r\n" ); if (gDoAnnotation) { if (FramePayloadFrameDesc->bFrameIndex == g_chFrameBasedFrameDefault) { AppendTextBuffer( " --->This is the Default (optimum) Frame index\r\n" ); } } AppendTextBuffer( "bLength: 0x%02X\r\n" , FramePayloadFrameDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , FramePayloadFrameDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , FramePayloadFrameDesc->bDescriptorSubtype); AppendTextBuffer( "bFrameIndex: 0x%02X\r\n" , FramePayloadFrameDesc->bFrameIndex); AppendTextBuffer( "bmCapabilities: 0x%02X\r\n" , FramePayloadFrameDesc->bmCapabilities); AppendTextBuffer( "wWidth: 0x%04X = %d\r\n" , FramePayloadFrameDesc->wWidth, FramePayloadFrameDesc->wWidth); AppendTextBuffer( "wHeight: 0x%04X = %d\r\n" , FramePayloadFrameDesc->wHeight, FramePayloadFrameDesc->wHeight); AppendTextBuffer( "dwMinBitRate: 0x%08X\r\n" , FramePayloadFrameDesc->dwMinBitRate); AppendTextBuffer( "dwMaxBitRate: 0x%08X\r\n" , FramePayloadFrameDesc->dwMaxBitRate); // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwDefaultFrameInterval: 0x%08X = %lf mSec (%4.2f Hz)\r\n" , FramePayloadFrameDesc->dwDefaultFrameInterval, (( double )FramePayloadFrameDesc->dwDefaultFrameInterval)/10000.0, (10000000.0/(( double )FramePayloadFrameDesc->dwDefaultFrameInterval)) ); AppendTextBuffer( "bFrameIntervalType: 0x%02X\r\n" , FramePayloadFrameDesc->bFrameIntervalType); if (FramePayloadFrameDesc->bLength != bLength) { //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required //@@length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d\r\n" , FramePayloadFrameDesc->bLength, bLength); OOPS(); } if (FramePayloadFrameDesc->bFrameIndex == 0 ) { //@@ERROR //@@Descriptor Field - bFrameIndex //@@bFrameIndex must be nonzero AppendTextBuffer( "*!*ERROR: bFrameIndex = 0, this is a 1 based index\r\n" ); OOPS(); } //@@Descriptor Field - bmCapabilities //@@Question: Should we try to verify that bmCapabilities is valid? // AppendTextBuffer("bmCapabilities: 0x%02X\r\n", UnCompFrameDesc->bmCapabilities); if (FramePayloadFrameDesc->wWidth == 0 ) { //@@ERROR //@@Descriptor Field - wWidth //@@wWidth must be nonzero AppendTextBuffer( "*!*ERROR: wWidth must be nonzero\r\n" ); OOPS(); } if (FramePayloadFrameDesc->wHeight == 0 ) { //@@ERROR //@@Descriptor Field - wHeight //@@wHeight must be nonzero AppendTextBuffer( "*!*ERROR: wHeight must be nonzero\r\n" ); OOPS(); } if (FramePayloadFrameDesc->dwMinBitRate == 0 ) { //@@ERROR //@@Descriptor Field - dwMinBitRate //@@dwMinBitRate must be nonzero AppendTextBuffer( "*!*ERROR: dwMinBitRate must be nonzero\r\n" ); OOPS(); } if (FramePayloadFrameDesc->dwMaxBitRate == 0 ) { //@@ERROR //@@Descriptor Field - dwMaxBitRate //@@dwMaxBitRate must be nonzero AppendTextBuffer( "*!*ERROR: dwMaxBitRate must be nonzero\r\n" ); OOPS(); } if (FramePayloadFrameDesc->dwMinBitRate > FramePayloadFrameDesc->dwMaxBitRate) { //@@ERROR //@@Descriptor Field - dwMinBitRate and dwMaxBitRate //@@Verify that dwMaxBitRate is greater than dwMinBitRate AppendTextBuffer( "*!*ERROR: dwMinBitRate should be less than dwMaxBitRate\r\n" ); OOPS(); } else { if (FramePayloadFrameDesc->bFrameIntervalType == 1 && FramePayloadFrameDesc->dwMinBitRate != FramePayloadFrameDesc->dwMaxBitRate) { //@@WARNING //@@Descriptor Field - bFrameIntervalType, dwMinBitRate, and dwMaxBitRate //@@Verify that dwMaxBitRate is equal to dwMinBitRate if bFrameIntervalType is 1 AppendTextBuffer( "*!*WARNING: if bFrameIntervalType is 1 then dwMinBitRate " \ "should equal dwMaxBitRate\r\n" ); OOPS(); } } if (FramePayloadFrameDesc->dwDefaultFrameInterval == 0 ) { //@@TestCase B16.11 (descript.c line 1020) //@@WARNING //@@Descriptor Field - dwDefaultFrameInterval //@@dwDefaultFrameInterval must be nonzero AppendTextBuffer( "*!*WARNING: dwDefaultFrameInterval must be nonzero\r\n" ); OOPS(); } if (0 == FramePayloadFrameDesc->bFrameIntervalType) { DisplayFramePayloadContinuousFrameType(FramePayloadFrameDesc); } else { DisplayFramePayloadDiscreteFrameType(FramePayloadFrameDesc); } // This descriptor is new for UVC 1.1 if (UVC10 == g_chUVCversion) { AppendTextBuffer( "*!*ERROR: This format is NOT ALLOWED for UVC 1.0 devices\r\n" ); } return TRUE; } //***************************************************************************** // // DisplayFramePayloadContinuousFrameType() // //***************************************************************************** BOOL DisplayFramePayloadContinuousFrameType( PVIDEO_FRAME_FRAME FContinuousDesc ) { //@@DisplayFramePayloadContinuousFrameType -Frame Payload Continuous Frame ULONG dwMinFrameInterval = FContinuousDesc->adwFrameInterval[0]; ULONG dwMaxFrameInterval = FContinuousDesc->adwFrameInterval[1]; ULONG dwFrameIntervalStep = FContinuousDesc->adwFrameInterval[2]; AppendTextBuffer( "===>Additional Continuous Frame Type Data\r\n" ); // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwMinFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n" , dwMinFrameInterval, (( double )dwMinFrameInterval)/10000.0, ( ULONG )(10000000.0/(( double )dwMinFrameInterval) + 0.5)); AppendTextBuffer( "dwMaxFrameInterval: 0x%08X = %lf mSec (%d Hz)\r\n" , dwMaxFrameInterval, (( double )dwMaxFrameInterval)/10000.0, ( ULONG )(10000000.0/(( double )dwMaxFrameInterval) + 0.5)); AppendTextBuffer( "dwFrameIntervalStep: 0x%08X\r\n" , dwFrameIntervalStep); if (dwMinFrameInterval == 0 ) { //@@ERROR //@@Descriptor Field - dwMinFrameInterval //@@dwMinFrameInterval is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMinFrameInterval = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (dwMaxFrameInterval == 0 ) { //@@ERROR //@@Descriptor Field - dwMaxFrameInterval //@@dwMaxFrameInterval is set to zero which is not in accordance with the USB Video Device Specification AppendTextBuffer( "*!*ERROR: dwMaxFrameInterval = 0, this invalidates the descriptor\r\n" ); OOPS(); } if (dwMinFrameInterval > dwMaxFrameInterval) { //@@ERROR //@@Descriptor Field - dwMinFrameInterval and dwMaxFrameInterval //@@Verify that dwMaxFrameInterval is greater than dwMinFrameInterval AppendTextBuffer( "*!*ERROR: dwMinFrameInterval is larger that dwMaxFrameInterval, this invalidates the descriptor\r\n" ); OOPS(); } else if ((dwMinFrameInterval + dwFrameIntervalStep) > dwMaxFrameInterval) { //@@WARNING //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that dwMaxFrameInterval is greater than dwMinFrameInterval combined with dwFrameIntervalStep AppendTextBuffer( "*!*WARNING: dwMinFrameInterval + dwFrameIntervalStep is greater than dwMaxFrameInterval, this could cause problems\r\n" ); OOPS(); } else if ((dwMaxFrameInterval - dwMinFrameInterval) == 0 ) { //@@CAUTION //@@Descriptor Field - dwFrameIntervalStep //@@Suggestion to use descrite frames if dwFrameIntervalStep is zero AppendTextBuffer( "*!*CAUTION: dwFrameIntervalStep equals zero, consider using discrete frames\r\n" ); OOPS(); } else if ((dwMaxFrameInterval - dwMinFrameInterval) % dwFrameIntervalStep ) { //@@WARNING //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that the difference between dwMaxFrameInterval and dwMinFrameInterval is evenly divisible by dwFrameIntervalStep AppendTextBuffer( "*!*WARNING: dwMaxFrameInterval minus dwMinFrameInterval is not evenly divisible by dwFrameIntervalStep, this could cause problems\r\n" ); OOPS(); } if (dwFrameIntervalStep == 0 && (dwMaxFrameInterval - dwMinFrameInterval)) { //@@WARNING //@@Descriptor Field - dwFrameIntervalStep, dwMinFrameInterval, and dwMaxFrameInterval //@@Verify that the dwFrameIntervalStep is not zero if there is a difference between dwMaxFrameInterval and dwMinFrameInterval AppendTextBuffer( "*!*WARNING: dwFrameIntervalStep = 0, this invalidates the descriptor when there is a difference between dwMinFrameInterval and dwMaxFrameInterval\r\n" ); OOPS(); } return TRUE; } //***************************************************************************** // // DisplayFramePayloadDiscreteFrameType() // //***************************************************************************** BOOL DisplayFramePayloadDiscreteFrameType( PVIDEO_FRAME_FRAME FDiscreteDesc ) { //@@DisplayFramePayloadDiscreteFrameType -Frame Based Payload Discrete Frame UINT iNdex = 1; UINT iCurFrame = 0; ULONG * ulFrameInterval = NULL; AppendTextBuffer( "===>Additional Discrete Frame Type Data\r\n" ); // There are (UDiscreteDesc->bFrameIntervalType) dwFrameIntervals (1 based index) for (; iNdex <= FDiscreteDesc->bFrameIntervalType; iNdex++, iCurFrame++) { ulFrameInterval = &FDiscreteDesc->adwFrameInterval[iCurFrame]; // To convert the default frame interval, which is in 100 ns units, to milliseconds, we divide by 10,000. // 100 ns = 10^(-7) seconds = 10^(-7) sec * 1000 msec/sec = 10^(-7) * 10^3 milleseconds = 10^(-4) seconds // = 1/10,000 milliseconds // To convert the frame interval to Hz, we divide by 10,000,000 and then take the inverse AppendTextBuffer( "dwFrameInterval[%d]: 0x%08X = %lf mSec (%4.2f Hz)\r\n" , iNdex, *ulFrameInterval, (( double )*ulFrameInterval)/10000.0, (10000000.0/(( double )*ulFrameInterval)) ); if (0 == *ulFrameInterval) { //@@TestCase B18.1 (descript.c line 1061) //@@ERROR //@@Descriptor Field - dwFrameInterval[x] //@@dwFrameInterval[x] must be non-zero AppendTextBuffer( "*!*ERROR: dwFrameInterval[%d] must be non-zero\r\n" , iNdex); OOPS(); } if ((iNdex > 1)&&(*ulFrameInterval <= FDiscreteDesc->adwFrameInterval[iCurFrame - 1])) { //@@TestCase B18.2 (descript.c line 1067) //@@ERROR //@@Descriptor Field - dwFrameInterval[x] //@@dwFrameInterval[n] must be greater than dwFrameInterval[n - 1] AppendTextBuffer( "*!*ERROR: dwFrameInterval[0x%02X] must be " \ "greater than preceding dwFrameInterval[0x%02X]\r\n" , iNdex, iNdex - 1); OOPS(); } } return TRUE; } //***************************************************************************** // // DisplayVSEndpoint() // //***************************************************************************** BOOL DisplayVSEndpoint ( PVIDEO_CS_INTERRUPT VidEndpointDesc ) { //@@DisplayVSEndpoint - Video Streaming Endpoint AppendTextBuffer( "\r\n ===>Class-specific VC Interrupt Endpoint Descriptor<===\r\n" ); AppendTextBuffer( "bLength: 0x%02X \r\n" , VidEndpointDesc->bLength); AppendTextBuffer( "bDescriptorType: 0x%02X\r\n" , VidEndpointDesc->bDescriptorType); AppendTextBuffer( "bDescriptorSubtype: 0x%02X\r\n" , VidEndpointDesc->bDescriptorSubtype); AppendTextBuffer( "wMaxTransferSize: 0x%04X" , VidEndpointDesc->wMaxTransferSize); if (gDoAnnotation) { AppendTextBuffer( " = (%d) Bytes\r\n" , VidEndpointDesc->wMaxTransferSize);} else {AppendTextBuffer( "\r\n" );} if (VidEndpointDesc->bLength != sizeof (VIDEO_CS_INTERRUPT)) { //@@TestCase B32.1 (descript.c line 1616) //@@ERROR //@@Descriptor Field - bLength //@@The declared length in the device descriptor is not equal to the required length in the USB Video Device Specification AppendTextBuffer( "*!*ERROR: bLength of %d incorrect, should be %d. USBView cannot correctly display descriptor\r\n" , VidEndpointDesc->bLength, sizeof (VIDEO_CS_INTERRUPT)); OOPS(); } return TRUE; } //***************************************************************************** // // VDisplayBytes() // //***************************************************************************** VOID VDisplayBytes ( PUCHAR Data, USHORT Len ) { USHORT i = 0; for (i = 0; i < Len; i++) { AppendTextBuffer( "0x%02X " , Data[i]); if (i % 16 == 15) { AppendTextBuffer( "\r\n" ); } } if (i % 16 != 0) { AppendTextBuffer( "\r\n" ); } } //***************************************************************************** // // VidFormatGUIDCodeToName() // //***************************************************************************** PCHAR VidFormatGUIDCodeToName ( REFGUID VidFormatGUIDCode ) { // GUID pYUY2 = YUY2_Format; // GUID pNV12 = NV12_Format; if (IsEqualGUID(VidFormatGUIDCode, (REFGUID) &YUY2_Format)) { return ( PCHAR ) & "YUY2" ; } if (IsEqualGUID(VidFormatGUIDCode, (REFGUID) &NV12_Format)) { return ( PCHAR ) & "NV12" ; } #ifdef H264_SUPPORT // GUID pH264 = H264_Format; if (IsEqualGUID(VidFormatGUIDCode, (REFGUID) &H264_Format)) { return ( PCHAR ) & "H.264" ; } #endif return FALSE; } /***************************************************************************** GetVCInterfaceSize() *****************************************************************************/ UINT GetVCInterfaceSize ( PVIDEO_CONTROL_HEADER_UNIT VCInterfaceDesc ) { PUSB_COMMON_DESCRIPTOR commonDesc = (PUSB_COMMON_DESCRIPTOR) VCInterfaceDesc; PUCHAR descEnd = ( PUCHAR ) VCInterfaceDesc + VCInterfaceDesc->wTotalLength; UINT uCount = 0; // return this interface's sum of descriptor lengths // starting from this header until (and not including) the first endpoint while (( PUCHAR )commonDesc + sizeof (USB_COMMON_DESCRIPTOR) < descEnd && ( PUCHAR )commonDesc + commonDesc->bLength <= descEnd) { if (commonDesc->bDescriptorType == USB_ENDPOINT_DESCRIPTOR_TYPE) break ; uCount += commonDesc->bLength; commonDesc = (PUSB_COMMON_DESCRIPTOR) (( PUCHAR ) commonDesc + commonDesc->bLength); } return (uCount); } /***************************************************************************** CheckForColorMatchingDesc () Given starting address of format descriptor; number of frame descriptors; subtype of frame to look for; 1) walk through each descriptor = if desc is frame of given subtype, update counter = if desc is still frame, update counter = if desc is color matching descriptor, update counter ! if frame is something else, break (all these frames should be consecutive) ! if next frame is beyond ending address of configuration, break PASS frame count == numframes passed in color match == 1 still frames are handled in the video stream input header and the frame displays *****************************************************************************/ UINT CheckForColorMatchingDesc ( PVIDEO_SPECIFIC pFormatDesc, UCHAR bNumFrameDescriptors, UCHAR bDescriptorSubtype ) { UINT uFrameCount = 0; UINT uStillFrameCount = 0; UINT uColorCount = 0; // DONE if the descriptor address is beyond the configuration range for ( ; ValidateDescAddress ((PUSB_COMMON_DESCRIPTOR) pFormatDesc); ) { // DONE if it's not an interface desc if (CS_INTERFACE != pFormatDesc->bDescriptorType) { break ; } switch (pFormatDesc->bDescriptorSubtype) { case VS_STILL_IMAGE_FRAME: uStillFrameCount++; break ; case VS_COLORFORMAT: uColorCount++; break ; default : if (bDescriptorSubtype == pFormatDesc->bDescriptorSubtype) { uFrameCount++; } break ; } pFormatDesc = (PVIDEO_SPECIFIC) (( PUCHAR ) pFormatDesc + pFormatDesc->bLength); } if (uFrameCount != bNumFrameDescriptors) { AppendTextBuffer( "*!*ERROR: Found %d frame descriptors (should be %d)\r\n" , uFrameCount, bNumFrameDescriptors); } // We already check Still Frames in the Video Info Header and Still Frames displays if (0 == uColorCount) { AppendTextBuffer( "*!*ERROR: no Color Matching Descriptor for this format\r\n" ); } return (uColorCount); } /***************************************************************************** GetVSInterfaceSize() *****************************************************************************/ UINT GetVSInterfaceSize ( PUSB_COMMON_DESCRIPTOR VidInHeaderDesc, USHORT wTotalLength ) { PUSB_COMMON_DESCRIPTOR commonDesc = (PUSB_COMMON_DESCRIPTOR) VidInHeaderDesc; PUCHAR descEnd = ( PUCHAR ) VidInHeaderDesc + wTotalLength; UINT uCount = 0; // return this interface's sum of descriptor lengths // starting from this header until (and not including) the first endpoint while (( PUCHAR )commonDesc + sizeof (USB_COMMON_DESCRIPTOR) < descEnd && ( PUCHAR )commonDesc + commonDesc->bLength <= descEnd) { if (commonDesc->bDescriptorType == USB_ENDPOINT_DESCRIPTOR_TYPE) break ; uCount += commonDesc->bLength; commonDesc = (PUSB_COMMON_DESCRIPTOR) (( PUCHAR ) commonDesc + commonDesc->bLength); } return (uCount); } /***************************************************************************** ValidateTerminalID() *****************************************************************************/ BOOL ValidateTerminalID( UINT uTerminalID ) { UNREFERENCED_PARAMETER(uTerminalID); return (TRUE); } |
Our Services
-
What our customers say about us?
Read our customer testimonials to find out why our clients keep returning for their projects.
View Testimonials