libcamera 0.7.0

Safe Rust bindings for libcamera
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
use std::ops::{Deref, DerefMut};
use num_enum::{IntoPrimitive, TryFromPrimitive};
#[allow(unused_imports)]
use crate::control::{Control, Property, ControlEntry, DynControlEntry};
use crate::control_value::{ControlValue, ControlValueError};
#[allow(unused_imports)]
use crate::geometry::{Rectangle, Point, Size};
#[allow(unused_imports)]
use libcamera_sys::*;
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(u32)]
pub enum ControlId {
    /// Enable or disable the AEGC algorithm. When this control is set to true,
    /// both ExposureTimeMode and AnalogueGainMode are set to auto, and if this
    /// control is set to false then both are set to manual.
    ///
    /// If ExposureTimeMode or AnalogueGainMode are also set in the same
    /// request as AeEnable, then the modes supplied by ExposureTimeMode or
    /// AnalogueGainMode will take precedence.
    ///
    /// \sa ExposureTimeMode AnalogueGainMode
    AeEnable = AE_ENABLE,
    /// Report the AEGC algorithm state.
    ///
    /// The AEGC algorithm computes the exposure time and the analogue gain
    /// to be applied to the image sensor.
    ///
    /// The AEGC algorithm behaviour is controlled by the ExposureTimeMode and
    /// AnalogueGainMode controls, which allow applications to decide how
    /// the exposure time and gain are computed, in Auto or Manual mode,
    /// independently from one another.
    ///
    /// The AeState control reports the AEGC algorithm state through a single
    /// value and describes it as a single computation block which computes
    /// both the exposure time and the analogue gain values.
    ///
    /// When both the exposure time and analogue gain values are configured to
    /// be in Manual mode, the AEGC algorithm is quiescent and does not actively
    /// compute any value and the AeState control will report AeStateIdle.
    ///
    /// When at least the exposure time or analogue gain are configured to be
    /// computed by the AEGC algorithm, the AeState control will report if the
    /// algorithm has converged to stable values for all of the controls set
    /// to be computed in Auto mode.
    ///
    /// \sa AnalogueGainMode
    /// \sa ExposureTimeMode
    AeState = AE_STATE,
    /// Specify a metering mode for the AE algorithm to use.
    ///
    /// The metering modes determine which parts of the image are used to
    /// determine the scene brightness. Metering modes may be platform specific
    /// and not all metering modes may be supported.
    AeMeteringMode = AE_METERING_MODE,
    /// Specify a constraint mode for the AE algorithm to use.
    ///
    /// The constraint modes determine how the measured scene brightness is
    /// adjusted to reach the desired target exposure. Constraint modes may be
    /// platform specific, and not all constraint modes may be supported.
    AeConstraintMode = AE_CONSTRAINT_MODE,
    /// Specify an exposure mode for the AE algorithm to use.
    ///
    /// The exposure modes specify how the desired total exposure is divided
    /// between the exposure time and the sensor's analogue gain. They are
    /// platform specific, and not all exposure modes may be supported.
    ///
    /// When one of AnalogueGainMode or ExposureTimeMode is set to Manual,
    /// the fixed values will override any choices made by AeExposureMode.
    ///
    /// \sa AnalogueGainMode
    /// \sa ExposureTimeMode
    AeExposureMode = AE_EXPOSURE_MODE,
    /// Specify an Exposure Value (EV) parameter.
    ///
    /// The EV parameter will only be applied if the AE algorithm is currently
    /// enabled, that is, at least one of AnalogueGainMode and ExposureTimeMode
    /// are in Auto mode.
    ///
    /// By convention EV adjusts the exposure as log2. For example
    /// EV = [-2, -1, -0.5, 0, 0.5, 1, 2] results in an exposure adjustment
    /// of [1/4x, 1/2x, 1/sqrt(2)x, 1x, sqrt(2)x, 2x, 4x].
    ///
    /// \sa AnalogueGainMode
    /// \sa ExposureTimeMode
    ExposureValue = EXPOSURE_VALUE,
    /// Exposure time for the frame applied in the sensor device.
    ///
    /// This value is specified in micro-seconds.
    ///
    /// This control will only take effect if ExposureTimeMode is Manual. If
    /// this control is set when ExposureTimeMode is Auto, the value will be
    /// ignored and will not be retained.
    ///
    /// When reported in metadata, this control indicates what exposure time
    /// was used for the current frame, regardless of ExposureTimeMode.
    /// ExposureTimeMode will indicate the source of the exposure time value,
    /// whether it came from the AE algorithm or not.
    ///
    /// \sa AnalogueGain
    /// \sa ExposureTimeMode
    ExposureTime = EXPOSURE_TIME,
    /// Controls the source of the exposure time that is applied to the image
    /// sensor.
    ///
    /// When set to Auto, the AE algorithm computes the exposure time and
    /// configures the image sensor accordingly. When set to Manual, the value
    /// of the ExposureTime control is used.
    ///
    /// When transitioning from Auto to Manual mode and no ExposureTime control
    /// is provided by the application, the last value computed by the AE
    /// algorithm when the mode was Auto will be used. If the ExposureTimeMode
    /// was never set to Auto (either because the camera started in Manual mode,
    /// or Auto is not supported by the camera), the camera should use a
    /// best-effort default value.
    ///
    /// If ExposureTimeModeManual is supported, the ExposureTime control must
    /// also be supported.
    ///
    /// Cameras that support manual control of the sensor shall support manual
    /// mode for both ExposureTimeMode and AnalogueGainMode, and shall expose
    /// the ExposureTime and AnalogueGain controls. If the camera also has an
    /// AEGC implementation, both ExposureTimeMode and AnalogueGainMode shall
    /// support both manual and auto mode. If auto mode is available, it shall
    /// be the default mode. These rules do not apply to black box cameras
    /// such as UVC cameras, where the available gain and exposure modes are
    /// completely dependent on what the device exposes.
    ///
    /// \par Flickerless exposure mode transitions
    ///
    /// Applications that wish to transition from ExposureTimeModeAuto to direct
    /// control of the exposure time without causing extra flicker can do so by
    /// selecting an ExposureTime value as close as possible to the last value
    /// computed by the auto exposure algorithm in order to avoid any visible
    /// flickering.
    ///
    /// To select the correct value to use as ExposureTime value, applications
    /// should accommodate the natural delay in applying controls caused by the
    /// capture pipeline frame depth.
    ///
    /// When switching to manual exposure mode, applications should not
    /// immediately specify an ExposureTime value in the same request where
    /// ExposureTimeMode is set to Manual. They should instead wait for the
    /// first Request where ExposureTimeMode is reported as
    /// ExposureTimeModeManual in the Request metadata, and use the reported
    /// ExposureTime to populate the control value in the next Request to be
    /// queued to the Camera.
    ///
    /// The implementation of the auto-exposure algorithm should equally try to
    /// minimize flickering and when transitioning from manual exposure mode to
    /// auto exposure use the last value provided by the application as starting
    /// point.
    ///
    /// 1. Start with ExposureTimeMode set to Auto
    ///
    /// 2. Set ExposureTimeMode to Manual
    ///
    /// 3. Wait for the first completed request that has ExposureTimeMode
    /// set to Manual
    ///
    /// 4. Copy the value reported in ExposureTime into a new request, and
    /// submit it
    ///
    /// 5. Proceed to run manual exposure time as desired
    ///
    /// \sa ExposureTime
    ExposureTimeMode = EXPOSURE_TIME_MODE,
    /// Analogue gain value applied in the sensor device.
    ///
    /// The value of the control specifies the gain multiplier applied to all
    /// colour channels. This value cannot be lower than 1.0.
    ///
    /// This control will only take effect if AnalogueGainMode is Manual. If
    /// this control is set when AnalogueGainMode is Auto, the value will be
    /// ignored and will not be retained.
    ///
    /// When reported in metadata, this control indicates what analogue gain
    /// was used for the current request, regardless of AnalogueGainMode.
    /// AnalogueGainMode will indicate the source of the analogue gain value,
    /// whether it came from the AEGC algorithm or not.
    ///
    /// \sa ExposureTime
    /// \sa AnalogueGainMode
    AnalogueGain = ANALOGUE_GAIN,
    /// Controls the source of the analogue gain that is applied to the image
    /// sensor.
    ///
    /// When set to Auto, the AEGC algorithm computes the analogue gain and
    /// configures the image sensor accordingly. When set to Manual, the value
    /// of the AnalogueGain control is used.
    ///
    /// When transitioning from Auto to Manual mode and no AnalogueGain control
    /// is provided by the application, the last value computed by the AEGC
    /// algorithm when the mode was Auto will be used. If the AnalogueGainMode
    /// was never set to Auto (either because the camera started in Manual mode,
    /// or Auto is not supported by the camera), the camera should use a
    /// best-effort default value.
    ///
    /// If AnalogueGainModeManual is supported, the AnalogueGain control must
    /// also be supported.
    ///
    /// For cameras where we have control over the ISP, both ExposureTimeMode
    /// and AnalogueGainMode are expected to support manual mode, and both
    /// controls (as well as ExposureTimeMode and AnalogueGain) are expected to
    /// be present. If the camera also has an AEGC implementation, both
    /// ExposureTimeMode and AnalogueGainMode shall support both manual and
    /// auto mode. If auto mode is available, it shall be the default mode.
    /// These rules do not apply to black box cameras such as UVC cameras,
    /// where the available gain and exposure modes are completely dependent on
    /// what the hardware exposes.
    ///
    /// The same procedure described for performing flickerless transitions in
    /// the ExposureTimeMode control documentation can be applied to analogue
    /// gain.
    ///
    /// \sa ExposureTimeMode
    /// \sa AnalogueGain
    AnalogueGainMode = ANALOGUE_GAIN_MODE,
    /// Set the flicker avoidance mode for AGC/AEC.
    ///
    /// The flicker mode determines whether, and how, the AGC/AEC algorithm
    /// attempts to hide flicker effects caused by the duty cycle of artificial
    /// lighting.
    ///
    /// Although implementation dependent, many algorithms for "flicker
    /// avoidance" work by restricting this exposure time to integer multiples
    /// of the cycle period, wherever possible.
    ///
    /// Implementations may not support all of the flicker modes listed below.
    ///
    /// By default the system will start in FlickerAuto mode if this is
    /// supported, otherwise the flicker mode will be set to FlickerOff.
    AeFlickerMode = AE_FLICKER_MODE,
    /// Manual flicker period in microseconds.
    ///
    /// This value sets the current flicker period to avoid. It is used when
    /// AeFlickerMode is set to FlickerManual.
    ///
    /// To cancel 50Hz mains flicker, this should be set to 10000 (corresponding
    /// to 100Hz), or 8333 (120Hz) for 60Hz mains.
    ///
    /// Setting the mode to FlickerManual when no AeFlickerPeriod has ever been
    /// set means that no flicker cancellation occurs (until the value of this
    /// control is updated).
    ///
    /// Switching to modes other than FlickerManual has no effect on the
    /// value of the AeFlickerPeriod control.
    ///
    /// \sa AeFlickerMode
    AeFlickerPeriod = AE_FLICKER_PERIOD,
    /// Flicker period detected in microseconds.
    ///
    /// The value reported here indicates the currently detected flicker
    /// period, or zero if no flicker at all is detected.
    ///
    /// When AeFlickerMode is set to FlickerAuto, there may be a period during
    /// which the value reported here remains zero. Once a non-zero value is
    /// reported, then this is the flicker period that has been detected and is
    /// now being cancelled.
    ///
    /// In the case of 50Hz mains flicker, the value would be 10000
    /// (corresponding to 100Hz), or 8333 (120Hz) for 60Hz mains flicker.
    ///
    /// It is implementation dependent whether the system can continue to detect
    /// flicker of different periods when another frequency is already being
    /// cancelled.
    ///
    /// \sa AeFlickerMode
    AeFlickerDetected = AE_FLICKER_DETECTED,
    /// Specify a fixed brightness parameter.
    ///
    /// Positive values (up to 1.0) produce brighter images; negative values
    /// (up to -1.0) produce darker images and 0.0 leaves pixels unchanged.
    Brightness = BRIGHTNESS,
    /// Specify a fixed contrast parameter.
    ///
    /// Normal contrast is given by the value 1.0; larger values produce images
    /// with more contrast.
    Contrast = CONTRAST,
    /// Report an estimate of the current illuminance level in lux.
    ///
    /// The Lux control can only be returned in metadata.
    Lux = LUX,
    /// Enable or disable the AWB.
    ///
    /// When AWB is enabled, the algorithm estimates the colour temperature of
    /// the scene and computes colour gains and the colour correction matrix
    /// automatically. The computed colour temperature, gains and correction
    /// matrix are reported in metadata. The corresponding controls are ignored
    /// if set in a request.
    ///
    /// When AWB is disabled, the colour temperature, gains and correction
    /// matrix are not updated automatically and can be set manually in
    /// requests.
    ///
    /// \sa ColourCorrectionMatrix
    /// \sa ColourGains
    /// \sa ColourTemperature
    AwbEnable = AWB_ENABLE,
    /// Specify the range of illuminants to use for the AWB algorithm.
    ///
    /// The modes supported are platform specific, and not all modes may be
    /// supported.
    AwbMode = AWB_MODE,
    /// Report the lock status of a running AWB algorithm.
    ///
    /// If the AWB algorithm is locked the value shall be set to true, if it's
    /// converging it shall be set to false. If the AWB algorithm is not
    /// running the control shall not be present in the metadata control list.
    ///
    /// \sa AwbEnable
    AwbLocked = AWB_LOCKED,
    /// Pair of gain values for the Red and Blue colour channels, in that
    /// order.
    ///
    /// ColourGains can only be applied in a Request when the AWB is disabled.
    /// If ColourGains is set in a request but ColourTemperature is not, the
    /// implementation shall calculate and set the ColourTemperature based on
    /// the ColourGains.
    ///
    /// \sa AwbEnable
    /// \sa ColourTemperature
    ColourGains = COLOUR_GAINS,
    /// ColourTemperature of the frame, in kelvin.
    ///
    /// ColourTemperature can only be applied in a Request when the AWB is
    /// disabled.
    ///
    /// If ColourTemperature is set in a request but ColourGains is not, the
    /// implementation shall calculate and set the ColourGains based on the
    /// given ColourTemperature. If ColourTemperature is set (either directly,
    /// or indirectly by setting ColourGains) but ColourCorrectionMatrix is not,
    /// the ColourCorrectionMatrix is updated based on the ColourTemperature.
    ///
    /// The ColourTemperature used to process the frame is reported in metadata.
    ///
    /// \sa AwbEnable
    /// \sa ColourCorrectionMatrix
    /// \sa ColourGains
    ColourTemperature = COLOUR_TEMPERATURE,
    /// Specify a fixed saturation parameter.
    ///
    /// Normal saturation is given by the value 1.0; larger values produce more
    /// saturated colours; 0.0 produces a greyscale image.
    Saturation = SATURATION,
    /// Reports the sensor black levels used for processing a frame.
    ///
    /// The values are in the order R, Gr, Gb, B. They are returned as numbers
    /// out of a 16-bit pixel range (as if pixels ranged from 0 to 65535). The
    /// SensorBlackLevels control can only be returned in metadata.
    SensorBlackLevels = SENSOR_BLACK_LEVELS,
    /// Intensity of the sharpening applied to the image.
    ///
    /// A value of 0.0 means no sharpening. The minimum value means
    /// minimal sharpening, and shall be 0.0 unless the camera can't
    /// disable sharpening completely. The default value shall give a
    /// "reasonable" level of sharpening, suitable for most use cases.
    /// The maximum value may apply extremely high levels of sharpening,
    /// higher than anyone could reasonably want. Negative values are
    /// not allowed. Note also that sharpening is not applied to raw
    /// streams.
    Sharpness = SHARPNESS,
    /// Reports a Figure of Merit (FoM) to indicate how in-focus the frame is.
    ///
    /// A larger FocusFoM value indicates a more in-focus frame. This singular
    /// value may be based on a combination of statistics gathered from
    /// multiple focus regions within an image. The number of focus regions and
    /// method of combination is platform dependent. In this respect, it is not
    /// necessarily aimed at providing a way to implement a focus algorithm by
    /// the application, rather an indication of how in-focus a frame is.
    FocusFoM = FOCUS_FO_M,
    /// The 3x3 matrix that converts camera RGB to sRGB within the imaging
    /// pipeline.
    ///
    /// This should describe the matrix that is used after pixels have been
    /// white-balanced, but before any gamma transformation. The 3x3 matrix is
    /// stored in conventional reading order in an array of 9 floating point
    /// values.
    ///
    /// ColourCorrectionMatrix can only be applied in a Request when the AWB is
    /// disabled.
    ///
    /// \sa AwbEnable
    /// \sa ColourTemperature
    ColourCorrectionMatrix = COLOUR_CORRECTION_MATRIX,
    /// Sets the image portion that will be scaled to form the whole of
    /// the final output image.
    ///
    /// The (x,y) location of this rectangle is relative to the
    /// PixelArrayActiveAreas that is being used. The units remain native
    /// sensor pixels, even if the sensor is being used in a binning or
    /// skipping mode.
    ///
    /// This control is only present when the pipeline supports scaling. Its
    /// maximum valid value is given by the properties::ScalerCropMaximum
    /// property, and the two can be used to implement digital zoom.
    ScalerCrop = SCALER_CROP,
    /// Digital gain value applied during the processing steps applied
    /// to the image as captured from the sensor.
    ///
    /// The global digital gain factor is applied to all the colour channels
    /// of the RAW image. Different pipeline models are free to
    /// specify how the global gain factor applies to each separate
    /// channel.
    ///
    /// If an imaging pipeline applies digital gain in distinct
    /// processing steps, this value indicates their total sum.
    /// Pipelines are free to decide how to adjust each processing
    /// step to respect the received gain factor and shall report
    /// their total value in the request metadata.
    DigitalGain = DIGITAL_GAIN,
    /// The instantaneous frame duration from start of frame exposure to start
    /// of next exposure, expressed in microseconds.
    ///
    /// This control is meant to be returned in metadata.
    FrameDuration = FRAME_DURATION,
    /// The minimum and maximum (in that order) frame duration, expressed in
    /// microseconds.
    ///
    /// When provided by applications, the control specifies the sensor frame
    /// duration interval the pipeline has to use. This limits the largest
    /// exposure time the sensor can use. For example, if a maximum frame
    /// duration of 33ms is requested (corresponding to 30 frames per second),
    /// the sensor will not be able to raise the exposure time above 33ms.
    /// A fixed frame duration is achieved by setting the minimum and maximum
    /// values to be the same. Setting both values to 0 reverts to using the
    /// camera defaults.
    ///
    /// The maximum frame duration provides the absolute limit to the exposure
    /// time computed by the AE algorithm and it overrides any exposure mode
    /// setting specified with controls::AeExposureMode. Similarly, when a
    /// manual exposure time is set through controls::ExposureTime, it also
    /// gets clipped to the limits set by this control. When reported in
    /// metadata, the control expresses the minimum and maximum frame durations
    /// used after being clipped to the sensor provided frame duration limits.
    ///
    /// \sa AeExposureMode
    /// \sa ExposureTime
    ///
    /// \todo Define how to calculate the capture frame rate by
    /// defining controls to report additional delays introduced by
    /// the capture pipeline or post-processing stages (ie JPEG
    /// conversion, frame scaling).
    ///
    /// \todo Provide an explicit definition of default control values, for
    /// this and all other controls.
    FrameDurationLimits = FRAME_DURATION_LIMITS,
    /// Temperature measure from the camera sensor in Celsius.
    ///
    /// This value is typically obtained by a thermal sensor present on-die or
    /// in the camera module. The range of reported temperatures is device
    /// dependent.
    ///
    /// The SensorTemperature control will only be returned in metadata if a
    /// thermal sensor is present.
    SensorTemperature = SENSOR_TEMPERATURE,
    /// The time when the first row of the image sensor active array is exposed.
    ///
    /// The timestamp, expressed in nanoseconds, represents a monotonically
    /// increasing counter since the system boot time, as defined by the
    /// Linux-specific CLOCK_BOOTTIME clock id.
    ///
    /// The SensorTimestamp control can only be returned in metadata.
    ///
    /// \todo Define how the sensor timestamp has to be used in the reprocessing
    /// use case.
    SensorTimestamp = SENSOR_TIMESTAMP,
    /// The mode of the AF (autofocus) algorithm.
    ///
    /// An implementation may choose not to implement all the modes.
    AfMode = AF_MODE,
    /// The range of focus distances that is scanned.
    ///
    /// An implementation may choose not to implement all the options here.
    AfRange = AF_RANGE,
    /// Determine whether the AF is to move the lens as quickly as possible or
    /// more steadily.
    ///
    /// For example, during video recording it may be desirable not to move the
    /// lens too abruptly, but when in a preview mode (waiting for a still
    /// capture) it may be helpful to move the lens as quickly as is reasonably
    /// possible.
    AfSpeed = AF_SPEED,
    /// The parts of the image used by the AF algorithm to measure focus.
    AfMetering = AF_METERING,
    /// The focus windows used by the AF algorithm when AfMetering is set to
    /// AfMeteringWindows.
    ///
    /// The units used are pixels within the rectangle returned by the
    /// ScalerCropMaximum property.
    ///
    /// In order to be activated, a rectangle must be programmed with non-zero
    /// width and height. Internally, these rectangles are intersected with the
    /// ScalerCropMaximum rectangle. If the window becomes empty after this
    /// operation, then the window is ignored. If all the windows end up being
    /// ignored, then the behaviour is platform dependent.
    ///
    /// On platforms that support the ScalerCrop control (for implementing
    /// digital zoom, for example), no automatic recalculation or adjustment of
    /// AF windows is performed internally if the ScalerCrop is changed. If any
    /// window lies outside the output image after the scaler crop has been
    /// applied, it is up to the application to recalculate them.
    ///
    /// The details of how the windows are used are platform dependent. We note
    /// that when there is more than one AF window, a typical implementation
    /// might find the optimal focus position for each one and finally select
    /// the window where the focal distance for the objects shown in that part
    /// of the image are closest to the camera.
    AfWindows = AF_WINDOWS,
    /// Start an autofocus scan.
    ///
    /// This control starts an autofocus scan when AfMode is set to AfModeAuto,
    /// and is ignored if AfMode is set to AfModeManual or AfModeContinuous. It
    /// can also be used to terminate a scan early.
    AfTrigger = AF_TRIGGER,
    /// Pause lens movements when in continuous autofocus mode.
    ///
    /// This control has no effect except when in continuous autofocus mode
    /// (AfModeContinuous). It can be used to pause any lens movements while
    /// (for example) images are captured. The algorithm remains inactive
    /// until it is instructed to resume.
    AfPause = AF_PAUSE,
    /// Set and report the focus lens position.
    ///
    /// This control instructs the lens to move to a particular position and
    /// also reports back the position of the lens for each frame.
    ///
    /// The LensPosition control is ignored unless the AfMode is set to
    /// AfModeManual, though the value is reported back unconditionally in all
    /// modes.
    ///
    /// This value, which is generally a non-integer, is the reciprocal of the
    /// focal distance in metres, also known as dioptres. That is, to set a
    /// focal distance D, the lens position LP is given by
    ///
    /// \f$LP = \frac{1\mathrm{m}}{D}\f$
    ///
    /// For example:
    ///
    /// - 0 moves the lens to infinity.
    /// - 0.5 moves the lens to focus on objects 2m away.
    /// - 2 moves the lens to focus on objects 50cm away.
    /// - And larger values will focus the lens closer.
    ///
    /// The default value of the control should indicate a good general
    /// position for the lens, often corresponding to the hyperfocal distance
    /// (the closest position for which objects at infinity are still
    /// acceptably sharp). The minimum will often be zero (meaning infinity),
    /// and the maximum value defines the closest focus position.
    ///
    /// \todo Define a property to report the Hyperfocal distance of calibrated
    /// lenses.
    LensPosition = LENS_POSITION,
    /// The current state of the AF algorithm.
    ///
    /// This control reports the current state of the AF algorithm in
    /// conjunction with the reported AfMode value and (in continuous AF mode)
    /// the AfPauseState value. The possible state changes are described below,
    /// though we note the following state transitions that occur when the
    /// AfMode is changed.
    ///
    /// If the AfMode is set to AfModeManual, then the AfState will always
    /// report AfStateIdle (even if the lens is subsequently moved). Changing
    /// to the AfModeManual state does not initiate any lens movement.
    ///
    /// If the AfMode is set to AfModeAuto then the AfState will report
    /// AfStateIdle. However, if AfModeAuto and AfTriggerStart are sent
    /// together then AfState will omit AfStateIdle and move straight to
    /// AfStateScanning (and start a scan).
    ///
    /// If the AfMode is set to AfModeContinuous then the AfState will
    /// initially report AfStateScanning.
    AfState = AF_STATE,
    /// Report whether the autofocus is currently running, paused or pausing.
    ///
    /// This control is only applicable in continuous (AfModeContinuous) mode,
    /// and reports whether the algorithm is currently running, paused or
    /// pausing (that is, will pause as soon as any in-progress scan
    /// completes).
    ///
    /// Any change to AfMode will cause AfPauseStateRunning to be reported.
    AfPauseState = AF_PAUSE_STATE,
    /// Set the mode to be used for High Dynamic Range (HDR) imaging.
    ///
    /// HDR techniques typically include multiple exposure, image fusion and
    /// tone mapping techniques to improve the dynamic range of the resulting
    /// images.
    ///
    /// When using an HDR mode, images are captured with different sets of AGC
    /// settings called HDR channels. Channels indicate in particular the type
    /// of exposure (short, medium or long) used to capture the raw image,
    /// before fusion. Each HDR image is tagged with the corresponding channel
    /// using the HdrChannel control.
    ///
    /// \sa HdrChannel
    HdrMode = HDR_MODE,
    /// The HDR channel used to capture the frame.
    ///
    /// This value is reported back to the application so that it can discover
    /// whether this capture corresponds to the short or long exposure image
    /// (or any other image used by the HDR procedure). An application can
    /// monitor the HDR channel to discover when the differently exposed images
    /// have arrived.
    ///
    /// This metadata is only available when an HDR mode has been enabled.
    ///
    /// \sa HdrMode
    HdrChannel = HDR_CHANNEL,
    /// Specify a fixed gamma value.
    ///
    /// The default gamma value must be 2.2 which closely mimics sRGB gamma.
    /// Note that this is camera gamma, so it is applied as 1.0/gamma.
    Gamma = GAMMA,
    /// Enable or disable the debug metadata.
    DebugMetadataEnable = DEBUG_METADATA_ENABLE,
    /// Control for AE metering trigger. Currently identical to
    /// ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER.
    ///
    /// Whether the camera device will trigger a precapture metering sequence
    /// when it processes this request.
    #[cfg(feature = "vendor_draft")]
    AePrecaptureTrigger = AE_PRECAPTURE_TRIGGER,
    /// Control to select the noise reduction algorithm mode. Currently
    /// identical to ANDROID_NOISE_REDUCTION_MODE.
    ///
    ///  Mode of operation for the noise reduction algorithm.
    #[cfg(feature = "vendor_draft")]
    NoiseReductionMode = NOISE_REDUCTION_MODE,
    /// Control to select the color correction aberration mode. Currently
    /// identical to ANDROID_COLOR_CORRECTION_ABERRATION_MODE.
    ///
    ///  Mode of operation for the chromatic aberration correction algorithm.
    #[cfg(feature = "vendor_draft")]
    ColorCorrectionAberrationMode = COLOR_CORRECTION_ABERRATION_MODE,
    /// Control to report the current AWB algorithm state. Currently identical
    /// to ANDROID_CONTROL_AWB_STATE.
    ///
    ///  Current state of the AWB algorithm.
    #[cfg(feature = "vendor_draft")]
    AwbState = AWB_STATE,
    /// Control to report the time between the start of exposure of the first
    /// row and the start of exposure of the last row. Currently identical to
    /// ANDROID_SENSOR_ROLLING_SHUTTER_SKEW
    #[cfg(feature = "vendor_draft")]
    SensorRollingShutterSkew = SENSOR_ROLLING_SHUTTER_SKEW,
    /// Control to report if the lens shading map is available. Currently
    /// identical to ANDROID_STATISTICS_LENS_SHADING_MAP_MODE.
    #[cfg(feature = "vendor_draft")]
    LensShadingMapMode = LENS_SHADING_MAP_MODE,
    /// Specifies the number of pipeline stages the frame went through from when
    /// it was exposed to when the final completed result was available to the
    /// framework. Always less than or equal to PipelineMaxDepth. Currently
    /// identical to ANDROID_REQUEST_PIPELINE_DEPTH.
    ///
    /// The typical value for this control is 3 as a frame is first exposed,
    /// captured and then processed in a single pass through the ISP. Any
    /// additional processing step performed after the ISP pass (in example face
    /// detection, additional format conversions etc) count as an additional
    /// pipeline stage.
    #[cfg(feature = "vendor_draft")]
    PipelineDepth = PIPELINE_DEPTH,
    /// The maximum number of frames that can occur after a request (different
    /// than the previous) has been submitted, and before the result's state
    /// becomes synchronized. A value of -1 indicates unknown latency, and 0
    /// indicates per-frame control. Currently identical to
    /// ANDROID_SYNC_MAX_LATENCY.
    #[cfg(feature = "vendor_draft")]
    MaxLatency = MAX_LATENCY,
    /// Control to select the test pattern mode. Currently identical to
    /// ANDROID_SENSOR_TEST_PATTERN_MODE.
    #[cfg(feature = "vendor_draft")]
    TestPatternMode = TEST_PATTERN_MODE,
    /// Control to select the face detection mode used by the pipeline.
    ///
    /// Currently identical to ANDROID_STATISTICS_FACE_DETECT_MODE.
    ///
    /// \sa FaceDetectFaceRectangles
    /// \sa FaceDetectFaceScores
    /// \sa FaceDetectFaceLandmarks
    /// \sa FaceDetectFaceIds
    #[cfg(feature = "vendor_draft")]
    FaceDetectMode = FACE_DETECT_MODE,
    /// Boundary rectangles of the detected faces. The number of values is
    /// the number of detected faces.
    ///
    /// The FaceDetectFaceRectangles control can only be returned in metadata.
    ///
    /// Currently identical to ANDROID_STATISTICS_FACE_RECTANGLES.
    #[cfg(feature = "vendor_draft")]
    FaceDetectFaceRectangles = FACE_DETECT_FACE_RECTANGLES,
    /// Confidence score of each of the detected faces. The range of score is
    /// [0, 100]. The number of values should be the number of faces reported
    /// in FaceDetectFaceRectangles.
    ///
    /// The FaceDetectFaceScores control can only be returned in metadata.
    ///
    /// Currently identical to ANDROID_STATISTICS_FACE_SCORES.
    #[cfg(feature = "vendor_draft")]
    FaceDetectFaceScores = FACE_DETECT_FACE_SCORES,
    /// Array of human face landmark coordinates in format [..., left_eye_i,
    /// right_eye_i, mouth_i, left_eye_i+1, ...], with i = index of face. The
    /// number of values should be 3 * the number of faces reported in
    /// FaceDetectFaceRectangles.
    ///
    /// The FaceDetectFaceLandmarks control can only be returned in metadata.
    ///
    /// Currently identical to ANDROID_STATISTICS_FACE_LANDMARKS.
    #[cfg(feature = "vendor_draft")]
    FaceDetectFaceLandmarks = FACE_DETECT_FACE_LANDMARKS,
    /// Each detected face is given a unique ID that is valid for as long as the
    /// face is visible to the camera device. A face that leaves the field of
    /// view and later returns may be assigned a new ID. The number of values
    /// should be the number of faces reported in FaceDetectFaceRectangles.
    ///
    /// The FaceDetectFaceIds control can only be returned in metadata.
    ///
    /// Currently identical to ANDROID_STATISTICS_FACE_IDS.
    #[cfg(feature = "vendor_draft")]
    FaceDetectFaceIds = FACE_DETECT_FACE_IDS,
    /// Toggles the Raspberry Pi IPA to output the hardware generated statistics.
    ///
    /// When this control is set to true, the IPA outputs a binary dump of the
    /// hardware generated statistics through the Request metadata in the
    /// Bcm2835StatsOutput control.
    ///
    /// \sa Bcm2835StatsOutput
    #[cfg(feature = "vendor_rpi")]
    StatsOutputEnable = STATS_OUTPUT_ENABLE,
    /// Span of the BCM2835 ISP generated statistics for the current frame.
    ///
    /// This is sent in the Request metadata if the StatsOutputEnable is set to
    /// true.  The statistics struct definition can be found in
    /// include/linux/bcm2835-isp.h.
    ///
    /// \sa StatsOutputEnable
    #[cfg(feature = "vendor_rpi")]
    Bcm2835StatsOutput = BCM2835_STATS_OUTPUT,
    /// An array of rectangles, where each singular value has identical
    /// functionality to the ScalerCrop control. This control allows the
    /// Raspberry Pi pipeline handler to control individual scaler crops per
    /// output stream.
    ///
    /// The order of rectangles passed into the control must match the order of
    /// streams configured by the application. The pipeline handler will only
    /// configure crop retangles up-to the number of output streams configured.
    /// All subsequent rectangles passed into this control are ignored by the
    /// pipeline handler.
    ///
    /// If both rpi::ScalerCrops and ScalerCrop controls are present in a
    /// ControlList, the latter is discarded, and crops are obtained from this
    /// control.
    ///
    /// Note that using different crop rectangles for each output stream with
    /// this control is only applicable on the Pi5/PiSP platform. This control
    /// should also be considered temporary/draft and will be replaced with
    /// official libcamera API support for per-stream controls in the future.
    ///
    /// \sa ScalerCrop
    #[cfg(feature = "vendor_rpi")]
    ScalerCrops = SCALER_CROPS,
    /// Span of the PiSP Frontend ISP generated statistics for the current
    /// frame. This is sent in the Request metadata if the StatsOutputEnable is
    /// set to true. The statistics struct definition can be found in
    /// https://github.com/raspberrypi/libpisp/blob/main/src/libpisp/frontend/pisp_statistics.h
    ///
    /// \sa StatsOutputEnable
    #[cfg(feature = "vendor_rpi")]
    PispStatsOutput = PISP_STATS_OUTPUT,
}
impl ControlId {
    pub fn id(&self) -> u32 {
        u32::from(*self)
    }
    pub fn description(&self) -> &'static str {
        match self {
            ControlId::AeEnable => {
                "Enable or disable the AEGC algorithm. When this control is set to true,
both ExposureTimeMode and AnalogueGainMode are set to auto, and if this
control is set to false then both are set to manual.

If ExposureTimeMode or AnalogueGainMode are also set in the same
request as AeEnable, then the modes supplied by ExposureTimeMode or
AnalogueGainMode will take precedence.

\\sa ExposureTimeMode AnalogueGainMode
"
            }
            ControlId::AeState => {
                "Report the AEGC algorithm state.

The AEGC algorithm computes the exposure time and the analogue gain
to be applied to the image sensor.

The AEGC algorithm behaviour is controlled by the ExposureTimeMode and
AnalogueGainMode controls, which allow applications to decide how
the exposure time and gain are computed, in Auto or Manual mode,
independently from one another.

The AeState control reports the AEGC algorithm state through a single
value and describes it as a single computation block which computes
both the exposure time and the analogue gain values.

When both the exposure time and analogue gain values are configured to
be in Manual mode, the AEGC algorithm is quiescent and does not actively
compute any value and the AeState control will report AeStateIdle.

When at least the exposure time or analogue gain are configured to be
computed by the AEGC algorithm, the AeState control will report if the
algorithm has converged to stable values for all of the controls set
to be computed in Auto mode.

\\sa AnalogueGainMode
\\sa ExposureTimeMode
"
            }
            ControlId::AeMeteringMode => {
                "Specify a metering mode for the AE algorithm to use.

The metering modes determine which parts of the image are used to
determine the scene brightness. Metering modes may be platform specific
and not all metering modes may be supported.
"
            }
            ControlId::AeConstraintMode => {
                "Specify a constraint mode for the AE algorithm to use.

The constraint modes determine how the measured scene brightness is
adjusted to reach the desired target exposure. Constraint modes may be
platform specific, and not all constraint modes may be supported.
"
            }
            ControlId::AeExposureMode => {
                "Specify an exposure mode for the AE algorithm to use.

The exposure modes specify how the desired total exposure is divided
between the exposure time and the sensor's analogue gain. They are
platform specific, and not all exposure modes may be supported.

When one of AnalogueGainMode or ExposureTimeMode is set to Manual,
the fixed values will override any choices made by AeExposureMode.

\\sa AnalogueGainMode
\\sa ExposureTimeMode
"
            }
            ControlId::ExposureValue => {
                "Specify an Exposure Value (EV) parameter.

The EV parameter will only be applied if the AE algorithm is currently
enabled, that is, at least one of AnalogueGainMode and ExposureTimeMode
are in Auto mode.

By convention EV adjusts the exposure as log2. For example
EV = [-2, -1, -0.5, 0, 0.5, 1, 2] results in an exposure adjustment
of [1/4x, 1/2x, 1/sqrt(2)x, 1x, sqrt(2)x, 2x, 4x].

\\sa AnalogueGainMode
\\sa ExposureTimeMode
"
            }
            ControlId::ExposureTime => {
                "Exposure time for the frame applied in the sensor device.

This value is specified in micro-seconds.

This control will only take effect if ExposureTimeMode is Manual. If
this control is set when ExposureTimeMode is Auto, the value will be
ignored and will not be retained.

When reported in metadata, this control indicates what exposure time
was used for the current frame, regardless of ExposureTimeMode.
ExposureTimeMode will indicate the source of the exposure time value,
whether it came from the AE algorithm or not.

\\sa AnalogueGain
\\sa ExposureTimeMode
"
            }
            ControlId::ExposureTimeMode => {
                "Controls the source of the exposure time that is applied to the image
sensor.

When set to Auto, the AE algorithm computes the exposure time and
configures the image sensor accordingly. When set to Manual, the value
of the ExposureTime control is used.

When transitioning from Auto to Manual mode and no ExposureTime control
is provided by the application, the last value computed by the AE
algorithm when the mode was Auto will be used. If the ExposureTimeMode
was never set to Auto (either because the camera started in Manual mode,
or Auto is not supported by the camera), the camera should use a
best-effort default value.

If ExposureTimeModeManual is supported, the ExposureTime control must
also be supported.

Cameras that support manual control of the sensor shall support manual
mode for both ExposureTimeMode and AnalogueGainMode, and shall expose
the ExposureTime and AnalogueGain controls. If the camera also has an
AEGC implementation, both ExposureTimeMode and AnalogueGainMode shall
support both manual and auto mode. If auto mode is available, it shall
be the default mode. These rules do not apply to black box cameras
such as UVC cameras, where the available gain and exposure modes are
completely dependent on what the device exposes.

\\par Flickerless exposure mode transitions

Applications that wish to transition from ExposureTimeModeAuto to direct
control of the exposure time without causing extra flicker can do so by
selecting an ExposureTime value as close as possible to the last value
computed by the auto exposure algorithm in order to avoid any visible
flickering.

To select the correct value to use as ExposureTime value, applications
should accommodate the natural delay in applying controls caused by the
capture pipeline frame depth.

When switching to manual exposure mode, applications should not
immediately specify an ExposureTime value in the same request where
ExposureTimeMode is set to Manual. They should instead wait for the
first Request where ExposureTimeMode is reported as
ExposureTimeModeManual in the Request metadata, and use the reported
ExposureTime to populate the control value in the next Request to be
queued to the Camera.

The implementation of the auto-exposure algorithm should equally try to
minimize flickering and when transitioning from manual exposure mode to
auto exposure use the last value provided by the application as starting
point.

1. Start with ExposureTimeMode set to Auto

2. Set ExposureTimeMode to Manual

3. Wait for the first completed request that has ExposureTimeMode
set to Manual

4. Copy the value reported in ExposureTime into a new request, and
submit it

5. Proceed to run manual exposure time as desired

\\sa ExposureTime
"
            }
            ControlId::AnalogueGain => {
                "Analogue gain value applied in the sensor device.

The value of the control specifies the gain multiplier applied to all
colour channels. This value cannot be lower than 1.0.

This control will only take effect if AnalogueGainMode is Manual. If
this control is set when AnalogueGainMode is Auto, the value will be
ignored and will not be retained.

When reported in metadata, this control indicates what analogue gain
was used for the current request, regardless of AnalogueGainMode.
AnalogueGainMode will indicate the source of the analogue gain value,
whether it came from the AEGC algorithm or not.

\\sa ExposureTime
\\sa AnalogueGainMode
"
            }
            ControlId::AnalogueGainMode => {
                "Controls the source of the analogue gain that is applied to the image
sensor.

When set to Auto, the AEGC algorithm computes the analogue gain and
configures the image sensor accordingly. When set to Manual, the value
of the AnalogueGain control is used.

When transitioning from Auto to Manual mode and no AnalogueGain control
is provided by the application, the last value computed by the AEGC
algorithm when the mode was Auto will be used. If the AnalogueGainMode
was never set to Auto (either because the camera started in Manual mode,
or Auto is not supported by the camera), the camera should use a
best-effort default value.

If AnalogueGainModeManual is supported, the AnalogueGain control must
also be supported.

For cameras where we have control over the ISP, both ExposureTimeMode
and AnalogueGainMode are expected to support manual mode, and both
controls (as well as ExposureTimeMode and AnalogueGain) are expected to
be present. If the camera also has an AEGC implementation, both
ExposureTimeMode and AnalogueGainMode shall support both manual and
auto mode. If auto mode is available, it shall be the default mode.
These rules do not apply to black box cameras such as UVC cameras,
where the available gain and exposure modes are completely dependent on
what the hardware exposes.

The same procedure described for performing flickerless transitions in
the ExposureTimeMode control documentation can be applied to analogue
gain.

\\sa ExposureTimeMode
\\sa AnalogueGain
"
            }
            ControlId::AeFlickerMode => {
                "Set the flicker avoidance mode for AGC/AEC.

The flicker mode determines whether, and how, the AGC/AEC algorithm
attempts to hide flicker effects caused by the duty cycle of artificial
lighting.

Although implementation dependent, many algorithms for \"flicker
avoidance\" work by restricting this exposure time to integer multiples
of the cycle period, wherever possible.

Implementations may not support all of the flicker modes listed below.

By default the system will start in FlickerAuto mode if this is
supported, otherwise the flicker mode will be set to FlickerOff.
"
            }
            ControlId::AeFlickerPeriod => {
                "Manual flicker period in microseconds.

This value sets the current flicker period to avoid. It is used when
AeFlickerMode is set to FlickerManual.

To cancel 50Hz mains flicker, this should be set to 10000 (corresponding
to 100Hz), or 8333 (120Hz) for 60Hz mains.

Setting the mode to FlickerManual when no AeFlickerPeriod has ever been
set means that no flicker cancellation occurs (until the value of this
control is updated).

Switching to modes other than FlickerManual has no effect on the
value of the AeFlickerPeriod control.

\\sa AeFlickerMode
"
            }
            ControlId::AeFlickerDetected => {
                "Flicker period detected in microseconds.

The value reported here indicates the currently detected flicker
period, or zero if no flicker at all is detected.

When AeFlickerMode is set to FlickerAuto, there may be a period during
which the value reported here remains zero. Once a non-zero value is
reported, then this is the flicker period that has been detected and is
now being cancelled.

In the case of 50Hz mains flicker, the value would be 10000
(corresponding to 100Hz), or 8333 (120Hz) for 60Hz mains flicker.

It is implementation dependent whether the system can continue to detect
flicker of different periods when another frequency is already being
cancelled.

\\sa AeFlickerMode
"
            }
            ControlId::Brightness => {
                "Specify a fixed brightness parameter.

Positive values (up to 1.0) produce brighter images; negative values
(up to -1.0) produce darker images and 0.0 leaves pixels unchanged.
"
            }
            ControlId::Contrast => {
                "Specify a fixed contrast parameter.

Normal contrast is given by the value 1.0; larger values produce images
with more contrast.
"
            }
            ControlId::Lux => {
                "Report an estimate of the current illuminance level in lux.

The Lux control can only be returned in metadata.
"
            }
            ControlId::AwbEnable => {
                "Enable or disable the AWB.

When AWB is enabled, the algorithm estimates the colour temperature of
the scene and computes colour gains and the colour correction matrix
automatically. The computed colour temperature, gains and correction
matrix are reported in metadata. The corresponding controls are ignored
if set in a request.

When AWB is disabled, the colour temperature, gains and correction
matrix are not updated automatically and can be set manually in
requests.

\\sa ColourCorrectionMatrix
\\sa ColourGains
\\sa ColourTemperature
"
            }
            ControlId::AwbMode => {
                "Specify the range of illuminants to use for the AWB algorithm.

The modes supported are platform specific, and not all modes may be
supported.
"
            }
            ControlId::AwbLocked => {
                "Report the lock status of a running AWB algorithm.

If the AWB algorithm is locked the value shall be set to true, if it's
converging it shall be set to false. If the AWB algorithm is not
running the control shall not be present in the metadata control list.

\\sa AwbEnable
"
            }
            ControlId::ColourGains => {
                "Pair of gain values for the Red and Blue colour channels, in that
order.

ColourGains can only be applied in a Request when the AWB is disabled.
If ColourGains is set in a request but ColourTemperature is not, the
implementation shall calculate and set the ColourTemperature based on
the ColourGains.

\\sa AwbEnable
\\sa ColourTemperature
"
            }
            ControlId::ColourTemperature => {
                "ColourTemperature of the frame, in kelvin.

ColourTemperature can only be applied in a Request when the AWB is
disabled.

If ColourTemperature is set in a request but ColourGains is not, the
implementation shall calculate and set the ColourGains based on the
given ColourTemperature. If ColourTemperature is set (either directly,
or indirectly by setting ColourGains) but ColourCorrectionMatrix is not,
the ColourCorrectionMatrix is updated based on the ColourTemperature.

The ColourTemperature used to process the frame is reported in metadata.

\\sa AwbEnable
\\sa ColourCorrectionMatrix
\\sa ColourGains
"
            }
            ControlId::Saturation => {
                "Specify a fixed saturation parameter.

Normal saturation is given by the value 1.0; larger values produce more
saturated colours; 0.0 produces a greyscale image.
"
            }
            ControlId::SensorBlackLevels => {
                "Reports the sensor black levels used for processing a frame.

The values are in the order R, Gr, Gb, B. They are returned as numbers
out of a 16-bit pixel range (as if pixels ranged from 0 to 65535). The
SensorBlackLevels control can only be returned in metadata.
"
            }
            ControlId::Sharpness => {
                "Intensity of the sharpening applied to the image.

A value of 0.0 means no sharpening. The minimum value means
minimal sharpening, and shall be 0.0 unless the camera can't
disable sharpening completely. The default value shall give a
\"reasonable\" level of sharpening, suitable for most use cases.
The maximum value may apply extremely high levels of sharpening,
higher than anyone could reasonably want. Negative values are
not allowed. Note also that sharpening is not applied to raw
streams.
"
            }
            ControlId::FocusFoM => {
                "Reports a Figure of Merit (FoM) to indicate how in-focus the frame is.

A larger FocusFoM value indicates a more in-focus frame. This singular
value may be based on a combination of statistics gathered from
multiple focus regions within an image. The number of focus regions and
method of combination is platform dependent. In this respect, it is not
necessarily aimed at providing a way to implement a focus algorithm by
the application, rather an indication of how in-focus a frame is.
"
            }
            ControlId::ColourCorrectionMatrix => {
                "The 3x3 matrix that converts camera RGB to sRGB within the imaging
pipeline.

This should describe the matrix that is used after pixels have been
white-balanced, but before any gamma transformation. The 3x3 matrix is
stored in conventional reading order in an array of 9 floating point
values.

ColourCorrectionMatrix can only be applied in a Request when the AWB is 
disabled.

\\sa AwbEnable
\\sa ColourTemperature
"
            }
            ControlId::ScalerCrop => {
                "Sets the image portion that will be scaled to form the whole of
the final output image.

The (x,y) location of this rectangle is relative to the
PixelArrayActiveAreas that is being used. The units remain native
sensor pixels, even if the sensor is being used in a binning or
skipping mode.

This control is only present when the pipeline supports scaling. Its
maximum valid value is given by the properties::ScalerCropMaximum
property, and the two can be used to implement digital zoom.
"
            }
            ControlId::DigitalGain => {
                "Digital gain value applied during the processing steps applied
to the image as captured from the sensor.

The global digital gain factor is applied to all the colour channels
of the RAW image. Different pipeline models are free to
specify how the global gain factor applies to each separate
channel.

If an imaging pipeline applies digital gain in distinct
processing steps, this value indicates their total sum.
Pipelines are free to decide how to adjust each processing
step to respect the received gain factor and shall report
their total value in the request metadata.
"
            }
            ControlId::FrameDuration => {
                "The instantaneous frame duration from start of frame exposure to start
of next exposure, expressed in microseconds.

This control is meant to be returned in metadata.
"
            }
            ControlId::FrameDurationLimits => {
                "The minimum and maximum (in that order) frame duration, expressed in
microseconds.

When provided by applications, the control specifies the sensor frame
duration interval the pipeline has to use. This limits the largest
exposure time the sensor can use. For example, if a maximum frame
duration of 33ms is requested (corresponding to 30 frames per second),
the sensor will not be able to raise the exposure time above 33ms.
A fixed frame duration is achieved by setting the minimum and maximum
values to be the same. Setting both values to 0 reverts to using the
camera defaults.

The maximum frame duration provides the absolute limit to the exposure
time computed by the AE algorithm and it overrides any exposure mode
setting specified with controls::AeExposureMode. Similarly, when a
manual exposure time is set through controls::ExposureTime, it also
gets clipped to the limits set by this control. When reported in
metadata, the control expresses the minimum and maximum frame durations
used after being clipped to the sensor provided frame duration limits.

\\sa AeExposureMode
\\sa ExposureTime

\\todo Define how to calculate the capture frame rate by
defining controls to report additional delays introduced by
the capture pipeline or post-processing stages (ie JPEG
conversion, frame scaling).

\\todo Provide an explicit definition of default control values, for
this and all other controls.
"
            }
            ControlId::SensorTemperature => {
                "Temperature measure from the camera sensor in Celsius.

This value is typically obtained by a thermal sensor present on-die or
in the camera module. The range of reported temperatures is device
dependent.

The SensorTemperature control will only be returned in metadata if a
thermal sensor is present.
"
            }
            ControlId::SensorTimestamp => {
                "The time when the first row of the image sensor active array is exposed.

The timestamp, expressed in nanoseconds, represents a monotonically
increasing counter since the system boot time, as defined by the
Linux-specific CLOCK_BOOTTIME clock id.

The SensorTimestamp control can only be returned in metadata.

\\todo Define how the sensor timestamp has to be used in the reprocessing
use case.
"
            }
            ControlId::AfMode => {
                "The mode of the AF (autofocus) algorithm.

An implementation may choose not to implement all the modes.
"
            }
            ControlId::AfRange => {
                "The range of focus distances that is scanned.

An implementation may choose not to implement all the options here.
"
            }
            ControlId::AfSpeed => {
                "Determine whether the AF is to move the lens as quickly as possible or
more steadily.

For example, during video recording it may be desirable not to move the
lens too abruptly, but when in a preview mode (waiting for a still
capture) it may be helpful to move the lens as quickly as is reasonably
possible.
"
            }
            ControlId::AfMetering => {
                "The parts of the image used by the AF algorithm to measure focus.
"
            }
            ControlId::AfWindows => {
                "The focus windows used by the AF algorithm when AfMetering is set to
AfMeteringWindows.

The units used are pixels within the rectangle returned by the
ScalerCropMaximum property.

In order to be activated, a rectangle must be programmed with non-zero
width and height. Internally, these rectangles are intersected with the
ScalerCropMaximum rectangle. If the window becomes empty after this
operation, then the window is ignored. If all the windows end up being
ignored, then the behaviour is platform dependent.

On platforms that support the ScalerCrop control (for implementing
digital zoom, for example), no automatic recalculation or adjustment of
AF windows is performed internally if the ScalerCrop is changed. If any
window lies outside the output image after the scaler crop has been
applied, it is up to the application to recalculate them.

The details of how the windows are used are platform dependent. We note
that when there is more than one AF window, a typical implementation
might find the optimal focus position for each one and finally select
the window where the focal distance for the objects shown in that part
of the image are closest to the camera.
"
            }
            ControlId::AfTrigger => {
                "Start an autofocus scan.

This control starts an autofocus scan when AfMode is set to AfModeAuto,
and is ignored if AfMode is set to AfModeManual or AfModeContinuous. It
can also be used to terminate a scan early.
"
            }
            ControlId::AfPause => {
                "Pause lens movements when in continuous autofocus mode.

This control has no effect except when in continuous autofocus mode
(AfModeContinuous). It can be used to pause any lens movements while
(for example) images are captured. The algorithm remains inactive
until it is instructed to resume.
"
            }
            ControlId::LensPosition => {
                "Set and report the focus lens position.

This control instructs the lens to move to a particular position and
also reports back the position of the lens for each frame.

The LensPosition control is ignored unless the AfMode is set to
AfModeManual, though the value is reported back unconditionally in all
modes.

This value, which is generally a non-integer, is the reciprocal of the
focal distance in metres, also known as dioptres. That is, to set a
focal distance D, the lens position LP is given by

\\f$LP = \\frac{1\\mathrm{m}}{D}\\f$

For example:

- 0 moves the lens to infinity.
- 0.5 moves the lens to focus on objects 2m away.
- 2 moves the lens to focus on objects 50cm away.
- And larger values will focus the lens closer.

The default value of the control should indicate a good general
position for the lens, often corresponding to the hyperfocal distance
(the closest position for which objects at infinity are still
acceptably sharp). The minimum will often be zero (meaning infinity),
and the maximum value defines the closest focus position.

\\todo Define a property to report the Hyperfocal distance of calibrated
lenses.
"
            }
            ControlId::AfState => {
                "The current state of the AF algorithm.

This control reports the current state of the AF algorithm in
conjunction with the reported AfMode value and (in continuous AF mode)
the AfPauseState value. The possible state changes are described below,
though we note the following state transitions that occur when the
AfMode is changed.

If the AfMode is set to AfModeManual, then the AfState will always
report AfStateIdle (even if the lens is subsequently moved). Changing
to the AfModeManual state does not initiate any lens movement.

If the AfMode is set to AfModeAuto then the AfState will report
AfStateIdle. However, if AfModeAuto and AfTriggerStart are sent
together then AfState will omit AfStateIdle and move straight to
AfStateScanning (and start a scan).

If the AfMode is set to AfModeContinuous then the AfState will
initially report AfStateScanning.
"
            }
            ControlId::AfPauseState => {
                "Report whether the autofocus is currently running, paused or pausing.

This control is only applicable in continuous (AfModeContinuous) mode,
and reports whether the algorithm is currently running, paused or
pausing (that is, will pause as soon as any in-progress scan
completes).

Any change to AfMode will cause AfPauseStateRunning to be reported.
"
            }
            ControlId::HdrMode => {
                "Set the mode to be used for High Dynamic Range (HDR) imaging.

HDR techniques typically include multiple exposure, image fusion and
tone mapping techniques to improve the dynamic range of the resulting
images.

When using an HDR mode, images are captured with different sets of AGC
settings called HDR channels. Channels indicate in particular the type
of exposure (short, medium or long) used to capture the raw image,
before fusion. Each HDR image is tagged with the corresponding channel
using the HdrChannel control.

\\sa HdrChannel
"
            }
            ControlId::HdrChannel => {
                "The HDR channel used to capture the frame.

This value is reported back to the application so that it can discover
whether this capture corresponds to the short or long exposure image
(or any other image used by the HDR procedure). An application can
monitor the HDR channel to discover when the differently exposed images
have arrived.

This metadata is only available when an HDR mode has been enabled.

\\sa HdrMode
"
            }
            ControlId::Gamma => {
                "Specify a fixed gamma value.

The default gamma value must be 2.2 which closely mimics sRGB gamma.
Note that this is camera gamma, so it is applied as 1.0/gamma.
"
            }
            ControlId::DebugMetadataEnable => "Enable or disable the debug metadata.
",
            #[cfg(feature = "vendor_draft")]
            ControlId::AePrecaptureTrigger => {
                "Control for AE metering trigger. Currently identical to
ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER.

Whether the camera device will trigger a precapture metering sequence
when it processes this request.
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::NoiseReductionMode => {
                "Control to select the noise reduction algorithm mode. Currently
identical to ANDROID_NOISE_REDUCTION_MODE.

 Mode of operation for the noise reduction algorithm.
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::ColorCorrectionAberrationMode => {
                "Control to select the color correction aberration mode. Currently
identical to ANDROID_COLOR_CORRECTION_ABERRATION_MODE.

 Mode of operation for the chromatic aberration correction algorithm.
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::AwbState => {
                "Control to report the current AWB algorithm state. Currently identical
to ANDROID_CONTROL_AWB_STATE.

 Current state of the AWB algorithm.
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::SensorRollingShutterSkew => {
                "Control to report the time between the start of exposure of the first
row and the start of exposure of the last row. Currently identical to
ANDROID_SENSOR_ROLLING_SHUTTER_SKEW
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::LensShadingMapMode => {
                "Control to report if the lens shading map is available. Currently
identical to ANDROID_STATISTICS_LENS_SHADING_MAP_MODE.
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::PipelineDepth => {
                "Specifies the number of pipeline stages the frame went through from when
it was exposed to when the final completed result was available to the
framework. Always less than or equal to PipelineMaxDepth. Currently
identical to ANDROID_REQUEST_PIPELINE_DEPTH.

The typical value for this control is 3 as a frame is first exposed,
captured and then processed in a single pass through the ISP. Any
additional processing step performed after the ISP pass (in example face
detection, additional format conversions etc) count as an additional
pipeline stage.
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::MaxLatency => {
                "The maximum number of frames that can occur after a request (different
than the previous) has been submitted, and before the result's state
becomes synchronized. A value of -1 indicates unknown latency, and 0
indicates per-frame control. Currently identical to
ANDROID_SYNC_MAX_LATENCY.
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::TestPatternMode => {
                "Control to select the test pattern mode. Currently identical to
ANDROID_SENSOR_TEST_PATTERN_MODE.
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::FaceDetectMode => {
                "Control to select the face detection mode used by the pipeline.

Currently identical to ANDROID_STATISTICS_FACE_DETECT_MODE.

\\sa FaceDetectFaceRectangles
\\sa FaceDetectFaceScores
\\sa FaceDetectFaceLandmarks
\\sa FaceDetectFaceIds
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::FaceDetectFaceRectangles => {
                "Boundary rectangles of the detected faces. The number of values is
the number of detected faces.

The FaceDetectFaceRectangles control can only be returned in metadata.

Currently identical to ANDROID_STATISTICS_FACE_RECTANGLES.
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::FaceDetectFaceScores => {
                "Confidence score of each of the detected faces. The range of score is
[0, 100]. The number of values should be the number of faces reported
in FaceDetectFaceRectangles.

The FaceDetectFaceScores control can only be returned in metadata.

Currently identical to ANDROID_STATISTICS_FACE_SCORES.
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::FaceDetectFaceLandmarks => {
                "Array of human face landmark coordinates in format [..., left_eye_i,
right_eye_i, mouth_i, left_eye_i+1, ...], with i = index of face. The
number of values should be 3 * the number of faces reported in
FaceDetectFaceRectangles.

The FaceDetectFaceLandmarks control can only be returned in metadata.

Currently identical to ANDROID_STATISTICS_FACE_LANDMARKS.
"
            }
            #[cfg(feature = "vendor_draft")]
            ControlId::FaceDetectFaceIds => {
                "Each detected face is given a unique ID that is valid for as long as the
face is visible to the camera device. A face that leaves the field of
view and later returns may be assigned a new ID. The number of values
should be the number of faces reported in FaceDetectFaceRectangles.

The FaceDetectFaceIds control can only be returned in metadata.

Currently identical to ANDROID_STATISTICS_FACE_IDS.
"
            }
            #[cfg(feature = "vendor_rpi")]
            ControlId::StatsOutputEnable => {
                "Toggles the Raspberry Pi IPA to output the hardware generated statistics.

When this control is set to true, the IPA outputs a binary dump of the
hardware generated statistics through the Request metadata in the
Bcm2835StatsOutput control.

\\sa Bcm2835StatsOutput
"
            }
            #[cfg(feature = "vendor_rpi")]
            ControlId::Bcm2835StatsOutput => {
                "Span of the BCM2835 ISP generated statistics for the current frame.

This is sent in the Request metadata if the StatsOutputEnable is set to
true.  The statistics struct definition can be found in
include/linux/bcm2835-isp.h.

\\sa StatsOutputEnable
"
            }
            #[cfg(feature = "vendor_rpi")]
            ControlId::ScalerCrops => {
                "An array of rectangles, where each singular value has identical
functionality to the ScalerCrop control. This control allows the
Raspberry Pi pipeline handler to control individual scaler crops per
output stream.

The order of rectangles passed into the control must match the order of
streams configured by the application. The pipeline handler will only
configure crop retangles up-to the number of output streams configured.
All subsequent rectangles passed into this control are ignored by the
pipeline handler.

If both rpi::ScalerCrops and ScalerCrop controls are present in a
ControlList, the latter is discarded, and crops are obtained from this
control.

Note that using different crop rectangles for each output stream with
this control is only applicable on the Pi5/PiSP platform. This control
should also be considered temporary/draft and will be replaced with
official libcamera API support for per-stream controls in the future.

\\sa ScalerCrop
"
            }
            #[cfg(feature = "vendor_rpi")]
            ControlId::PispStatsOutput => {
                "Span of the PiSP Frontend ISP generated statistics for the current
frame. This is sent in the Request metadata if the StatsOutputEnable is
set to true. The statistics struct definition can be found in
https://github.com/raspberrypi/libpisp/blob/main/src/libpisp/frontend/pisp_statistics.h

\\sa StatsOutputEnable
"
            }
        }
    }
}
/// Enable or disable the AEGC algorithm. When this control is set to true,
/// both ExposureTimeMode and AnalogueGainMode are set to auto, and if this
/// control is set to false then both are set to manual.
///
/// If ExposureTimeMode or AnalogueGainMode are also set in the same
/// request as AeEnable, then the modes supplied by ExposureTimeMode or
/// AnalogueGainMode will take precedence.
///
/// \sa ExposureTimeMode AnalogueGainMode
#[derive(Debug, Clone)]
pub struct AeEnable(pub bool);
impl Deref for AeEnable {
    type Target = bool;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for AeEnable {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for AeEnable {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<bool>::try_from(value)?))
    }
}
impl From<AeEnable> for ControlValue {
    fn from(val: AeEnable) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for AeEnable {
    const ID: u32 = ControlId::AeEnable as _;
}
impl Control for AeEnable {}
/// Report the AEGC algorithm state.
///
/// The AEGC algorithm computes the exposure time and the analogue gain
/// to be applied to the image sensor.
///
/// The AEGC algorithm behaviour is controlled by the ExposureTimeMode and
/// AnalogueGainMode controls, which allow applications to decide how
/// the exposure time and gain are computed, in Auto or Manual mode,
/// independently from one another.
///
/// The AeState control reports the AEGC algorithm state through a single
/// value and describes it as a single computation block which computes
/// both the exposure time and the analogue gain values.
///
/// When both the exposure time and analogue gain values are configured to
/// be in Manual mode, the AEGC algorithm is quiescent and does not actively
/// compute any value and the AeState control will report AeStateIdle.
///
/// When at least the exposure time or analogue gain are configured to be
/// computed by the AEGC algorithm, the AeState control will report if the
/// algorithm has converged to stable values for all of the controls set
/// to be computed in Auto mode.
///
/// \sa AnalogueGainMode
/// \sa ExposureTimeMode
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AeState {
    /// The AEGC algorithm is inactive.
    ///
    /// This state is returned when both AnalogueGainMode and
    /// ExposureTimeMode are set to Manual and the algorithm is not
    /// actively computing any value.
    Idle = 0,
    /// The AEGC algorithm is actively computing new values, for either the
    /// exposure time or the analogue gain, but has not converged to a
    /// stable result yet.
    ///
    /// This state is returned if at least one of AnalogueGainMode or
    /// ExposureTimeMode is auto and the algorithm hasn't converged yet.
    ///
    /// The AEGC algorithm converges once stable values are computed for
    /// all of the controls set to be computed in Auto mode. Once the
    /// algorithm converges the state is moved to AeStateConverged.
    Searching = 1,
    /// The AEGC algorithm has converged.
    ///
    /// This state is returned if at least one of AnalogueGainMode or
    /// ExposureTimeMode is Auto, and the AEGC algorithm has converged to a
    /// stable value.
    ///
    /// If the measurements move too far away from the convergence point
    /// then the AEGC algorithm might start adjusting again, in which case
    /// the state is moved to AeStateSearching.
    Converged = 2,
}
impl TryFrom<ControlValue> for AeState {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AeState> for ControlValue {
    fn from(val: AeState) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AeState {
    const ID: u32 = ControlId::AeState as _;
}
impl Control for AeState {}
/// Specify a metering mode for the AE algorithm to use.
///
/// The metering modes determine which parts of the image are used to
/// determine the scene brightness. Metering modes may be platform specific
/// and not all metering modes may be supported.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AeMeteringMode {
    /// Centre-weighted metering mode.
    MeteringCentreWeighted = 0,
    /// Spot metering mode.
    MeteringSpot = 1,
    /// Matrix metering mode.
    MeteringMatrix = 2,
    /// Custom metering mode.
    MeteringCustom = 3,
}
impl TryFrom<ControlValue> for AeMeteringMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AeMeteringMode> for ControlValue {
    fn from(val: AeMeteringMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AeMeteringMode {
    const ID: u32 = ControlId::AeMeteringMode as _;
}
impl Control for AeMeteringMode {}
/// Specify a constraint mode for the AE algorithm to use.
///
/// The constraint modes determine how the measured scene brightness is
/// adjusted to reach the desired target exposure. Constraint modes may be
/// platform specific, and not all constraint modes may be supported.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AeConstraintMode {
    /// Default constraint mode.
    ///
    /// This mode aims to balance the exposure of different parts of the
    /// image so as to reach a reasonable average level. However, highlights
    /// in the image may appear over-exposed and lowlights may appear
    /// under-exposed.
    ConstraintNormal = 0,
    /// Highlight constraint mode.
    ///
    /// This mode adjusts the exposure levels in order to try and avoid
    /// over-exposing the brightest parts (highlights) of an image.
    /// Other non-highlight parts of the image may appear under-exposed.
    ConstraintHighlight = 1,
    /// Shadows constraint mode.
    ///
    /// This mode adjusts the exposure levels in order to try and avoid
    /// under-exposing the dark parts (shadows) of an image. Other normally
    /// exposed parts of the image may appear over-exposed.
    ConstraintShadows = 2,
    /// Custom constraint mode.
    ConstraintCustom = 3,
}
impl TryFrom<ControlValue> for AeConstraintMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AeConstraintMode> for ControlValue {
    fn from(val: AeConstraintMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AeConstraintMode {
    const ID: u32 = ControlId::AeConstraintMode as _;
}
impl Control for AeConstraintMode {}
/// Specify an exposure mode for the AE algorithm to use.
///
/// The exposure modes specify how the desired total exposure is divided
/// between the exposure time and the sensor's analogue gain. They are
/// platform specific, and not all exposure modes may be supported.
///
/// When one of AnalogueGainMode or ExposureTimeMode is set to Manual,
/// the fixed values will override any choices made by AeExposureMode.
///
/// \sa AnalogueGainMode
/// \sa ExposureTimeMode
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AeExposureMode {
    /// Default exposure mode.
    ExposureNormal = 0,
    /// Exposure mode allowing only short exposure times.
    ExposureShort = 1,
    /// Exposure mode allowing long exposure times.
    ExposureLong = 2,
    /// Custom exposure mode.
    ExposureCustom = 3,
}
impl TryFrom<ControlValue> for AeExposureMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AeExposureMode> for ControlValue {
    fn from(val: AeExposureMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AeExposureMode {
    const ID: u32 = ControlId::AeExposureMode as _;
}
impl Control for AeExposureMode {}
/// Specify an Exposure Value (EV) parameter.
///
/// The EV parameter will only be applied if the AE algorithm is currently
/// enabled, that is, at least one of AnalogueGainMode and ExposureTimeMode
/// are in Auto mode.
///
/// By convention EV adjusts the exposure as log2. For example
/// EV = [-2, -1, -0.5, 0, 0.5, 1, 2] results in an exposure adjustment
/// of [1/4x, 1/2x, 1/sqrt(2)x, 1x, sqrt(2)x, 2x, 4x].
///
/// \sa AnalogueGainMode
/// \sa ExposureTimeMode
#[derive(Debug, Clone)]
pub struct ExposureValue(pub f32);
impl Deref for ExposureValue {
    type Target = f32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for ExposureValue {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for ExposureValue {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<f32>::try_from(value)?))
    }
}
impl From<ExposureValue> for ControlValue {
    fn from(val: ExposureValue) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for ExposureValue {
    const ID: u32 = ControlId::ExposureValue as _;
}
impl Control for ExposureValue {}
/// Exposure time for the frame applied in the sensor device.
///
/// This value is specified in micro-seconds.
///
/// This control will only take effect if ExposureTimeMode is Manual. If
/// this control is set when ExposureTimeMode is Auto, the value will be
/// ignored and will not be retained.
///
/// When reported in metadata, this control indicates what exposure time
/// was used for the current frame, regardless of ExposureTimeMode.
/// ExposureTimeMode will indicate the source of the exposure time value,
/// whether it came from the AE algorithm or not.
///
/// \sa AnalogueGain
/// \sa ExposureTimeMode
#[derive(Debug, Clone)]
pub struct ExposureTime(pub i32);
impl Deref for ExposureTime {
    type Target = i32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for ExposureTime {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for ExposureTime {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<i32>::try_from(value)?))
    }
}
impl From<ExposureTime> for ControlValue {
    fn from(val: ExposureTime) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for ExposureTime {
    const ID: u32 = ControlId::ExposureTime as _;
}
impl Control for ExposureTime {}
/// Controls the source of the exposure time that is applied to the image
/// sensor.
///
/// When set to Auto, the AE algorithm computes the exposure time and
/// configures the image sensor accordingly. When set to Manual, the value
/// of the ExposureTime control is used.
///
/// When transitioning from Auto to Manual mode and no ExposureTime control
/// is provided by the application, the last value computed by the AE
/// algorithm when the mode was Auto will be used. If the ExposureTimeMode
/// was never set to Auto (either because the camera started in Manual mode,
/// or Auto is not supported by the camera), the camera should use a
/// best-effort default value.
///
/// If ExposureTimeModeManual is supported, the ExposureTime control must
/// also be supported.
///
/// Cameras that support manual control of the sensor shall support manual
/// mode for both ExposureTimeMode and AnalogueGainMode, and shall expose
/// the ExposureTime and AnalogueGain controls. If the camera also has an
/// AEGC implementation, both ExposureTimeMode and AnalogueGainMode shall
/// support both manual and auto mode. If auto mode is available, it shall
/// be the default mode. These rules do not apply to black box cameras
/// such as UVC cameras, where the available gain and exposure modes are
/// completely dependent on what the device exposes.
///
/// \par Flickerless exposure mode transitions
///
/// Applications that wish to transition from ExposureTimeModeAuto to direct
/// control of the exposure time without causing extra flicker can do so by
/// selecting an ExposureTime value as close as possible to the last value
/// computed by the auto exposure algorithm in order to avoid any visible
/// flickering.
///
/// To select the correct value to use as ExposureTime value, applications
/// should accommodate the natural delay in applying controls caused by the
/// capture pipeline frame depth.
///
/// When switching to manual exposure mode, applications should not
/// immediately specify an ExposureTime value in the same request where
/// ExposureTimeMode is set to Manual. They should instead wait for the
/// first Request where ExposureTimeMode is reported as
/// ExposureTimeModeManual in the Request metadata, and use the reported
/// ExposureTime to populate the control value in the next Request to be
/// queued to the Camera.
///
/// The implementation of the auto-exposure algorithm should equally try to
/// minimize flickering and when transitioning from manual exposure mode to
/// auto exposure use the last value provided by the application as starting
/// point.
///
/// 1. Start with ExposureTimeMode set to Auto
///
/// 2. Set ExposureTimeMode to Manual
///
/// 3. Wait for the first completed request that has ExposureTimeMode
/// set to Manual
///
/// 4. Copy the value reported in ExposureTime into a new request, and
/// submit it
///
/// 5. Proceed to run manual exposure time as desired
///
/// \sa ExposureTime
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum ExposureTimeMode {
    /// The exposure time will be calculated automatically and set by the
    /// AE algorithm.
    ///
    /// If ExposureTime is set while this mode is active, it will be
    /// ignored, and its value will not be retained.
    ///
    /// When transitioning from Manual to Auto mode, the AEGC should start
    /// its adjustments based on the last set manual ExposureTime value.
    Auto = 0,
    /// The exposure time will not be updated by the AE algorithm.
    ///
    /// When transitioning from Auto to Manual mode, the last computed
    /// exposure value is used until a new value is specified through the
    /// ExposureTime control. If an ExposureTime value is specified in the
    /// same request where the ExposureTimeMode is changed from Auto to
    /// Manual, the provided ExposureTime is applied immediately.
    Manual = 1,
}
impl TryFrom<ControlValue> for ExposureTimeMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<ExposureTimeMode> for ControlValue {
    fn from(val: ExposureTimeMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for ExposureTimeMode {
    const ID: u32 = ControlId::ExposureTimeMode as _;
}
impl Control for ExposureTimeMode {}
/// Analogue gain value applied in the sensor device.
///
/// The value of the control specifies the gain multiplier applied to all
/// colour channels. This value cannot be lower than 1.0.
///
/// This control will only take effect if AnalogueGainMode is Manual. If
/// this control is set when AnalogueGainMode is Auto, the value will be
/// ignored and will not be retained.
///
/// When reported in metadata, this control indicates what analogue gain
/// was used for the current request, regardless of AnalogueGainMode.
/// AnalogueGainMode will indicate the source of the analogue gain value,
/// whether it came from the AEGC algorithm or not.
///
/// \sa ExposureTime
/// \sa AnalogueGainMode
#[derive(Debug, Clone)]
pub struct AnalogueGain(pub f32);
impl Deref for AnalogueGain {
    type Target = f32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for AnalogueGain {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for AnalogueGain {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<f32>::try_from(value)?))
    }
}
impl From<AnalogueGain> for ControlValue {
    fn from(val: AnalogueGain) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for AnalogueGain {
    const ID: u32 = ControlId::AnalogueGain as _;
}
impl Control for AnalogueGain {}
/// Controls the source of the analogue gain that is applied to the image
/// sensor.
///
/// When set to Auto, the AEGC algorithm computes the analogue gain and
/// configures the image sensor accordingly. When set to Manual, the value
/// of the AnalogueGain control is used.
///
/// When transitioning from Auto to Manual mode and no AnalogueGain control
/// is provided by the application, the last value computed by the AEGC
/// algorithm when the mode was Auto will be used. If the AnalogueGainMode
/// was never set to Auto (either because the camera started in Manual mode,
/// or Auto is not supported by the camera), the camera should use a
/// best-effort default value.
///
/// If AnalogueGainModeManual is supported, the AnalogueGain control must
/// also be supported.
///
/// For cameras where we have control over the ISP, both ExposureTimeMode
/// and AnalogueGainMode are expected to support manual mode, and both
/// controls (as well as ExposureTimeMode and AnalogueGain) are expected to
/// be present. If the camera also has an AEGC implementation, both
/// ExposureTimeMode and AnalogueGainMode shall support both manual and
/// auto mode. If auto mode is available, it shall be the default mode.
/// These rules do not apply to black box cameras such as UVC cameras,
/// where the available gain and exposure modes are completely dependent on
/// what the hardware exposes.
///
/// The same procedure described for performing flickerless transitions in
/// the ExposureTimeMode control documentation can be applied to analogue
/// gain.
///
/// \sa ExposureTimeMode
/// \sa AnalogueGain
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AnalogueGainMode {
    /// The analogue gain will be calculated automatically and set by the
    /// AEGC algorithm.
    ///
    /// If AnalogueGain is set while this mode is active, it will be
    /// ignored, and it will also not be retained.
    ///
    /// When transitioning from Manual to Auto mode, the AEGC should start
    /// its adjustments based on the last set manual AnalogueGain value.
    Auto = 0,
    /// The analogue gain will not be updated by the AEGC algorithm.
    ///
    /// When transitioning from Auto to Manual mode, the last computed
    /// gain value is used until a new value is specified through the
    /// AnalogueGain control. If an AnalogueGain value is specified in the
    /// same request where the AnalogueGainMode is changed from Auto to
    /// Manual, the provided AnalogueGain is applied immediately.
    Manual = 1,
}
impl TryFrom<ControlValue> for AnalogueGainMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AnalogueGainMode> for ControlValue {
    fn from(val: AnalogueGainMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AnalogueGainMode {
    const ID: u32 = ControlId::AnalogueGainMode as _;
}
impl Control for AnalogueGainMode {}
/// Set the flicker avoidance mode for AGC/AEC.
///
/// The flicker mode determines whether, and how, the AGC/AEC algorithm
/// attempts to hide flicker effects caused by the duty cycle of artificial
/// lighting.
///
/// Although implementation dependent, many algorithms for "flicker
/// avoidance" work by restricting this exposure time to integer multiples
/// of the cycle period, wherever possible.
///
/// Implementations may not support all of the flicker modes listed below.
///
/// By default the system will start in FlickerAuto mode if this is
/// supported, otherwise the flicker mode will be set to FlickerOff.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AeFlickerMode {
    /// No flicker avoidance is performed.
    FlickerOff = 0,
    /// Manual flicker avoidance.
    ///
    /// Suppress flicker effects caused by lighting running with a period
    /// specified by the AeFlickerPeriod control.
    /// \sa AeFlickerPeriod
    FlickerManual = 1,
    /// Automatic flicker period detection and avoidance.
    ///
    /// The system will automatically determine the most likely value of
    /// flicker period, and avoid flicker of this frequency. Once flicker
    /// is being corrected, it is implementation dependent whether the
    /// system is still able to detect a change in the flicker period.
    /// \sa AeFlickerDetected
    FlickerAuto = 2,
}
impl TryFrom<ControlValue> for AeFlickerMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AeFlickerMode> for ControlValue {
    fn from(val: AeFlickerMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AeFlickerMode {
    const ID: u32 = ControlId::AeFlickerMode as _;
}
impl Control for AeFlickerMode {}
/// Manual flicker period in microseconds.
///
/// This value sets the current flicker period to avoid. It is used when
/// AeFlickerMode is set to FlickerManual.
///
/// To cancel 50Hz mains flicker, this should be set to 10000 (corresponding
/// to 100Hz), or 8333 (120Hz) for 60Hz mains.
///
/// Setting the mode to FlickerManual when no AeFlickerPeriod has ever been
/// set means that no flicker cancellation occurs (until the value of this
/// control is updated).
///
/// Switching to modes other than FlickerManual has no effect on the
/// value of the AeFlickerPeriod control.
///
/// \sa AeFlickerMode
#[derive(Debug, Clone)]
pub struct AeFlickerPeriod(pub i32);
impl Deref for AeFlickerPeriod {
    type Target = i32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for AeFlickerPeriod {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for AeFlickerPeriod {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<i32>::try_from(value)?))
    }
}
impl From<AeFlickerPeriod> for ControlValue {
    fn from(val: AeFlickerPeriod) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for AeFlickerPeriod {
    const ID: u32 = ControlId::AeFlickerPeriod as _;
}
impl Control for AeFlickerPeriod {}
/// Flicker period detected in microseconds.
///
/// The value reported here indicates the currently detected flicker
/// period, or zero if no flicker at all is detected.
///
/// When AeFlickerMode is set to FlickerAuto, there may be a period during
/// which the value reported here remains zero. Once a non-zero value is
/// reported, then this is the flicker period that has been detected and is
/// now being cancelled.
///
/// In the case of 50Hz mains flicker, the value would be 10000
/// (corresponding to 100Hz), or 8333 (120Hz) for 60Hz mains flicker.
///
/// It is implementation dependent whether the system can continue to detect
/// flicker of different periods when another frequency is already being
/// cancelled.
///
/// \sa AeFlickerMode
#[derive(Debug, Clone)]
pub struct AeFlickerDetected(pub i32);
impl Deref for AeFlickerDetected {
    type Target = i32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for AeFlickerDetected {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for AeFlickerDetected {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<i32>::try_from(value)?))
    }
}
impl From<AeFlickerDetected> for ControlValue {
    fn from(val: AeFlickerDetected) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for AeFlickerDetected {
    const ID: u32 = ControlId::AeFlickerDetected as _;
}
impl Control for AeFlickerDetected {}
/// Specify a fixed brightness parameter.
///
/// Positive values (up to 1.0) produce brighter images; negative values
/// (up to -1.0) produce darker images and 0.0 leaves pixels unchanged.
#[derive(Debug, Clone)]
pub struct Brightness(pub f32);
impl Deref for Brightness {
    type Target = f32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for Brightness {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for Brightness {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<f32>::try_from(value)?))
    }
}
impl From<Brightness> for ControlValue {
    fn from(val: Brightness) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for Brightness {
    const ID: u32 = ControlId::Brightness as _;
}
impl Control for Brightness {}
/// Specify a fixed contrast parameter.
///
/// Normal contrast is given by the value 1.0; larger values produce images
/// with more contrast.
#[derive(Debug, Clone)]
pub struct Contrast(pub f32);
impl Deref for Contrast {
    type Target = f32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for Contrast {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for Contrast {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<f32>::try_from(value)?))
    }
}
impl From<Contrast> for ControlValue {
    fn from(val: Contrast) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for Contrast {
    const ID: u32 = ControlId::Contrast as _;
}
impl Control for Contrast {}
/// Report an estimate of the current illuminance level in lux.
///
/// The Lux control can only be returned in metadata.
#[derive(Debug, Clone)]
pub struct Lux(pub f32);
impl Deref for Lux {
    type Target = f32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for Lux {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for Lux {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<f32>::try_from(value)?))
    }
}
impl From<Lux> for ControlValue {
    fn from(val: Lux) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for Lux {
    const ID: u32 = ControlId::Lux as _;
}
impl Control for Lux {}
/// Enable or disable the AWB.
///
/// When AWB is enabled, the algorithm estimates the colour temperature of
/// the scene and computes colour gains and the colour correction matrix
/// automatically. The computed colour temperature, gains and correction
/// matrix are reported in metadata. The corresponding controls are ignored
/// if set in a request.
///
/// When AWB is disabled, the colour temperature, gains and correction
/// matrix are not updated automatically and can be set manually in
/// requests.
///
/// \sa ColourCorrectionMatrix
/// \sa ColourGains
/// \sa ColourTemperature
#[derive(Debug, Clone)]
pub struct AwbEnable(pub bool);
impl Deref for AwbEnable {
    type Target = bool;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for AwbEnable {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for AwbEnable {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<bool>::try_from(value)?))
    }
}
impl From<AwbEnable> for ControlValue {
    fn from(val: AwbEnable) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for AwbEnable {
    const ID: u32 = ControlId::AwbEnable as _;
}
impl Control for AwbEnable {}
/// Specify the range of illuminants to use for the AWB algorithm.
///
/// The modes supported are platform specific, and not all modes may be
/// supported.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AwbMode {
    /// Search over the whole colour temperature range.
    AwbAuto = 0,
    /// Incandescent AWB lamp mode.
    AwbIncandescent = 1,
    /// Tungsten AWB lamp mode.
    AwbTungsten = 2,
    /// Fluorescent AWB lamp mode.
    AwbFluorescent = 3,
    /// Indoor AWB lighting mode.
    AwbIndoor = 4,
    /// Daylight AWB lighting mode.
    AwbDaylight = 5,
    /// Cloudy AWB lighting mode.
    AwbCloudy = 6,
    /// Custom AWB mode.
    AwbCustom = 7,
}
impl TryFrom<ControlValue> for AwbMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AwbMode> for ControlValue {
    fn from(val: AwbMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AwbMode {
    const ID: u32 = ControlId::AwbMode as _;
}
impl Control for AwbMode {}
/// Report the lock status of a running AWB algorithm.
///
/// If the AWB algorithm is locked the value shall be set to true, if it's
/// converging it shall be set to false. If the AWB algorithm is not
/// running the control shall not be present in the metadata control list.
///
/// \sa AwbEnable
#[derive(Debug, Clone)]
pub struct AwbLocked(pub bool);
impl Deref for AwbLocked {
    type Target = bool;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for AwbLocked {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for AwbLocked {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<bool>::try_from(value)?))
    }
}
impl From<AwbLocked> for ControlValue {
    fn from(val: AwbLocked) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for AwbLocked {
    const ID: u32 = ControlId::AwbLocked as _;
}
impl Control for AwbLocked {}
/// Pair of gain values for the Red and Blue colour channels, in that
/// order.
///
/// ColourGains can only be applied in a Request when the AWB is disabled.
/// If ColourGains is set in a request but ColourTemperature is not, the
/// implementation shall calculate and set the ColourTemperature based on
/// the ColourGains.
///
/// \sa AwbEnable
/// \sa ColourTemperature
#[derive(Debug, Clone)]
pub struct ColourGains(pub [f32; 2]);
impl Deref for ColourGains {
    type Target = [f32; 2];
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for ColourGains {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for ColourGains {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<[f32; 2]>::try_from(value)?))
    }
}
impl From<ColourGains> for ControlValue {
    fn from(val: ColourGains) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for ColourGains {
    const ID: u32 = ControlId::ColourGains as _;
}
impl Control for ColourGains {}
/// ColourTemperature of the frame, in kelvin.
///
/// ColourTemperature can only be applied in a Request when the AWB is
/// disabled.
///
/// If ColourTemperature is set in a request but ColourGains is not, the
/// implementation shall calculate and set the ColourGains based on the
/// given ColourTemperature. If ColourTemperature is set (either directly,
/// or indirectly by setting ColourGains) but ColourCorrectionMatrix is not,
/// the ColourCorrectionMatrix is updated based on the ColourTemperature.
///
/// The ColourTemperature used to process the frame is reported in metadata.
///
/// \sa AwbEnable
/// \sa ColourCorrectionMatrix
/// \sa ColourGains
#[derive(Debug, Clone)]
pub struct ColourTemperature(pub i32);
impl Deref for ColourTemperature {
    type Target = i32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for ColourTemperature {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for ColourTemperature {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<i32>::try_from(value)?))
    }
}
impl From<ColourTemperature> for ControlValue {
    fn from(val: ColourTemperature) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for ColourTemperature {
    const ID: u32 = ControlId::ColourTemperature as _;
}
impl Control for ColourTemperature {}
/// Specify a fixed saturation parameter.
///
/// Normal saturation is given by the value 1.0; larger values produce more
/// saturated colours; 0.0 produces a greyscale image.
#[derive(Debug, Clone)]
pub struct Saturation(pub f32);
impl Deref for Saturation {
    type Target = f32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for Saturation {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for Saturation {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<f32>::try_from(value)?))
    }
}
impl From<Saturation> for ControlValue {
    fn from(val: Saturation) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for Saturation {
    const ID: u32 = ControlId::Saturation as _;
}
impl Control for Saturation {}
/// Reports the sensor black levels used for processing a frame.
///
/// The values are in the order R, Gr, Gb, B. They are returned as numbers
/// out of a 16-bit pixel range (as if pixels ranged from 0 to 65535). The
/// SensorBlackLevels control can only be returned in metadata.
#[derive(Debug, Clone)]
pub struct SensorBlackLevels(pub [i32; 4]);
impl Deref for SensorBlackLevels {
    type Target = [i32; 4];
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for SensorBlackLevels {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for SensorBlackLevels {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<[i32; 4]>::try_from(value)?))
    }
}
impl From<SensorBlackLevels> for ControlValue {
    fn from(val: SensorBlackLevels) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for SensorBlackLevels {
    const ID: u32 = ControlId::SensorBlackLevels as _;
}
impl Control for SensorBlackLevels {}
/// Intensity of the sharpening applied to the image.
///
/// A value of 0.0 means no sharpening. The minimum value means
/// minimal sharpening, and shall be 0.0 unless the camera can't
/// disable sharpening completely. The default value shall give a
/// "reasonable" level of sharpening, suitable for most use cases.
/// The maximum value may apply extremely high levels of sharpening,
/// higher than anyone could reasonably want. Negative values are
/// not allowed. Note also that sharpening is not applied to raw
/// streams.
#[derive(Debug, Clone)]
pub struct Sharpness(pub f32);
impl Deref for Sharpness {
    type Target = f32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for Sharpness {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for Sharpness {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<f32>::try_from(value)?))
    }
}
impl From<Sharpness> for ControlValue {
    fn from(val: Sharpness) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for Sharpness {
    const ID: u32 = ControlId::Sharpness as _;
}
impl Control for Sharpness {}
/// Reports a Figure of Merit (FoM) to indicate how in-focus the frame is.
///
/// A larger FocusFoM value indicates a more in-focus frame. This singular
/// value may be based on a combination of statistics gathered from
/// multiple focus regions within an image. The number of focus regions and
/// method of combination is platform dependent. In this respect, it is not
/// necessarily aimed at providing a way to implement a focus algorithm by
/// the application, rather an indication of how in-focus a frame is.
#[derive(Debug, Clone)]
pub struct FocusFoM(pub i32);
impl Deref for FocusFoM {
    type Target = i32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for FocusFoM {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for FocusFoM {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<i32>::try_from(value)?))
    }
}
impl From<FocusFoM> for ControlValue {
    fn from(val: FocusFoM) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for FocusFoM {
    const ID: u32 = ControlId::FocusFoM as _;
}
impl Control for FocusFoM {}
/// The 3x3 matrix that converts camera RGB to sRGB within the imaging
/// pipeline.
///
/// This should describe the matrix that is used after pixels have been
/// white-balanced, but before any gamma transformation. The 3x3 matrix is
/// stored in conventional reading order in an array of 9 floating point
/// values.
///
/// ColourCorrectionMatrix can only be applied in a Request when the AWB is
/// disabled.
///
/// \sa AwbEnable
/// \sa ColourTemperature
#[derive(Debug, Clone)]
pub struct ColourCorrectionMatrix(pub [[f32; 3]; 3]);
impl Deref for ColourCorrectionMatrix {
    type Target = [[f32; 3]; 3];
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for ColourCorrectionMatrix {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for ColourCorrectionMatrix {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<[[f32; 3]; 3]>::try_from(value)?))
    }
}
impl From<ColourCorrectionMatrix> for ControlValue {
    fn from(val: ColourCorrectionMatrix) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for ColourCorrectionMatrix {
    const ID: u32 = ControlId::ColourCorrectionMatrix as _;
}
impl Control for ColourCorrectionMatrix {}
/// Sets the image portion that will be scaled to form the whole of
/// the final output image.
///
/// The (x,y) location of this rectangle is relative to the
/// PixelArrayActiveAreas that is being used. The units remain native
/// sensor pixels, even if the sensor is being used in a binning or
/// skipping mode.
///
/// This control is only present when the pipeline supports scaling. Its
/// maximum valid value is given by the properties::ScalerCropMaximum
/// property, and the two can be used to implement digital zoom.
#[derive(Debug, Clone)]
pub struct ScalerCrop(pub Rectangle);
impl Deref for ScalerCrop {
    type Target = Rectangle;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for ScalerCrop {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for ScalerCrop {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<Rectangle>::try_from(value)?))
    }
}
impl From<ScalerCrop> for ControlValue {
    fn from(val: ScalerCrop) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for ScalerCrop {
    const ID: u32 = ControlId::ScalerCrop as _;
}
impl Control for ScalerCrop {}
/// Digital gain value applied during the processing steps applied
/// to the image as captured from the sensor.
///
/// The global digital gain factor is applied to all the colour channels
/// of the RAW image. Different pipeline models are free to
/// specify how the global gain factor applies to each separate
/// channel.
///
/// If an imaging pipeline applies digital gain in distinct
/// processing steps, this value indicates their total sum.
/// Pipelines are free to decide how to adjust each processing
/// step to respect the received gain factor and shall report
/// their total value in the request metadata.
#[derive(Debug, Clone)]
pub struct DigitalGain(pub f32);
impl Deref for DigitalGain {
    type Target = f32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for DigitalGain {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for DigitalGain {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<f32>::try_from(value)?))
    }
}
impl From<DigitalGain> for ControlValue {
    fn from(val: DigitalGain) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for DigitalGain {
    const ID: u32 = ControlId::DigitalGain as _;
}
impl Control for DigitalGain {}
/// The instantaneous frame duration from start of frame exposure to start
/// of next exposure, expressed in microseconds.
///
/// This control is meant to be returned in metadata.
#[derive(Debug, Clone)]
pub struct FrameDuration(pub i64);
impl Deref for FrameDuration {
    type Target = i64;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for FrameDuration {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for FrameDuration {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<i64>::try_from(value)?))
    }
}
impl From<FrameDuration> for ControlValue {
    fn from(val: FrameDuration) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for FrameDuration {
    const ID: u32 = ControlId::FrameDuration as _;
}
impl Control for FrameDuration {}
/// The minimum and maximum (in that order) frame duration, expressed in
/// microseconds.
///
/// When provided by applications, the control specifies the sensor frame
/// duration interval the pipeline has to use. This limits the largest
/// exposure time the sensor can use. For example, if a maximum frame
/// duration of 33ms is requested (corresponding to 30 frames per second),
/// the sensor will not be able to raise the exposure time above 33ms.
/// A fixed frame duration is achieved by setting the minimum and maximum
/// values to be the same. Setting both values to 0 reverts to using the
/// camera defaults.
///
/// The maximum frame duration provides the absolute limit to the exposure
/// time computed by the AE algorithm and it overrides any exposure mode
/// setting specified with controls::AeExposureMode. Similarly, when a
/// manual exposure time is set through controls::ExposureTime, it also
/// gets clipped to the limits set by this control. When reported in
/// metadata, the control expresses the minimum and maximum frame durations
/// used after being clipped to the sensor provided frame duration limits.
///
/// \sa AeExposureMode
/// \sa ExposureTime
///
/// \todo Define how to calculate the capture frame rate by
/// defining controls to report additional delays introduced by
/// the capture pipeline or post-processing stages (ie JPEG
/// conversion, frame scaling).
///
/// \todo Provide an explicit definition of default control values, for
/// this and all other controls.
#[derive(Debug, Clone)]
pub struct FrameDurationLimits(pub [i64; 2]);
impl Deref for FrameDurationLimits {
    type Target = [i64; 2];
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for FrameDurationLimits {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for FrameDurationLimits {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<[i64; 2]>::try_from(value)?))
    }
}
impl From<FrameDurationLimits> for ControlValue {
    fn from(val: FrameDurationLimits) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for FrameDurationLimits {
    const ID: u32 = ControlId::FrameDurationLimits as _;
}
impl Control for FrameDurationLimits {}
/// Temperature measure from the camera sensor in Celsius.
///
/// This value is typically obtained by a thermal sensor present on-die or
/// in the camera module. The range of reported temperatures is device
/// dependent.
///
/// The SensorTemperature control will only be returned in metadata if a
/// thermal sensor is present.
#[derive(Debug, Clone)]
pub struct SensorTemperature(pub f32);
impl Deref for SensorTemperature {
    type Target = f32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for SensorTemperature {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for SensorTemperature {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<f32>::try_from(value)?))
    }
}
impl From<SensorTemperature> for ControlValue {
    fn from(val: SensorTemperature) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for SensorTemperature {
    const ID: u32 = ControlId::SensorTemperature as _;
}
impl Control for SensorTemperature {}
/// The time when the first row of the image sensor active array is exposed.
///
/// The timestamp, expressed in nanoseconds, represents a monotonically
/// increasing counter since the system boot time, as defined by the
/// Linux-specific CLOCK_BOOTTIME clock id.
///
/// The SensorTimestamp control can only be returned in metadata.
///
/// \todo Define how the sensor timestamp has to be used in the reprocessing
/// use case.
#[derive(Debug, Clone)]
pub struct SensorTimestamp(pub i64);
impl Deref for SensorTimestamp {
    type Target = i64;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for SensorTimestamp {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for SensorTimestamp {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<i64>::try_from(value)?))
    }
}
impl From<SensorTimestamp> for ControlValue {
    fn from(val: SensorTimestamp) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for SensorTimestamp {
    const ID: u32 = ControlId::SensorTimestamp as _;
}
impl Control for SensorTimestamp {}
/// The mode of the AF (autofocus) algorithm.
///
/// An implementation may choose not to implement all the modes.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AfMode {
    /// The AF algorithm is in manual mode.
    ///
    /// In this mode it will never perform any action nor move the lens of
    /// its own accord, but an application can specify the desired lens
    /// position using the LensPosition control. The AfState will always
    /// report AfStateIdle.
    ///
    /// If the camera is started in AfModeManual, it will move the focus
    /// lens to the position specified by the LensPosition control.
    ///
    /// This mode is the recommended default value for the AfMode control.
    /// External cameras (as reported by the Location property set to
    /// CameraLocationExternal) may use a different default value.
    Manual = 0,
    /// The AF algorithm is in auto mode.
    ///
    /// In this mode the algorithm will never move the lens or change state
    /// unless the AfTrigger control is used. The AfTrigger control can be
    /// used to initiate a focus scan, the results of which will be
    /// reported by AfState.
    ///
    /// If the autofocus algorithm is moved from AfModeAuto to another mode
    /// while a scan is in progress, the scan is cancelled immediately,
    /// without waiting for the scan to finish.
    ///
    /// When first entering this mode the AfState will report AfStateIdle.
    /// When a trigger control is sent, AfState will report AfStateScanning
    /// for a period before spontaneously changing to AfStateFocused or
    /// AfStateFailed, depending on the outcome of the scan. It will remain
    /// in this state until another scan is initiated by the AfTrigger
    /// control. If a scan is cancelled (without changing to another mode),
    /// AfState will return to AfStateIdle.
    Auto = 1,
    /// The AF algorithm is in continuous mode.
    ///
    /// In this mode the lens can re-start a scan spontaneously at any
    /// moment, without any user intervention. The AfState still reports
    /// whether the algorithm is currently scanning or not, though the
    /// application has no ability to initiate or cancel scans, nor to move
    /// the lens for itself.
    ///
    /// However, applications can pause the AF algorithm from continuously
    /// scanning by using the AfPause control. This allows video or still
    /// images to be captured whilst guaranteeing that the focus is fixed.
    ///
    /// When set to AfModeContinuous, the system will immediately initiate a
    /// scan so AfState will report AfStateScanning, and will settle on one
    /// of AfStateFocused or AfStateFailed, depending on the scan result.
    Continuous = 2,
}
impl TryFrom<ControlValue> for AfMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AfMode> for ControlValue {
    fn from(val: AfMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AfMode {
    const ID: u32 = ControlId::AfMode as _;
}
impl Control for AfMode {}
/// The range of focus distances that is scanned.
///
/// An implementation may choose not to implement all the options here.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AfRange {
    /// A wide range of focus distances is scanned.
    ///
    /// Scanned distances cover all the way from infinity down to close
    /// distances, though depending on the implementation, possibly not
    /// including the very closest macro positions.
    Normal = 0,
    /// Only close distances are scanned.
    Macro = 1,
    /// The full range of focus distances is scanned.
    ///
    /// This range is similar to AfRangeNormal but includes the very
    /// closest macro positions.
    Full = 2,
}
impl TryFrom<ControlValue> for AfRange {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AfRange> for ControlValue {
    fn from(val: AfRange) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AfRange {
    const ID: u32 = ControlId::AfRange as _;
}
impl Control for AfRange {}
/// Determine whether the AF is to move the lens as quickly as possible or
/// more steadily.
///
/// For example, during video recording it may be desirable not to move the
/// lens too abruptly, but when in a preview mode (waiting for a still
/// capture) it may be helpful to move the lens as quickly as is reasonably
/// possible.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AfSpeed {
    /// Move the lens at its usual speed.
    Normal = 0,
    /// Move the lens more quickly.
    Fast = 1,
}
impl TryFrom<ControlValue> for AfSpeed {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AfSpeed> for ControlValue {
    fn from(val: AfSpeed) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AfSpeed {
    const ID: u32 = ControlId::AfSpeed as _;
}
impl Control for AfSpeed {}
/// The parts of the image used by the AF algorithm to measure focus.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AfMetering {
    /// Let the AF algorithm decide for itself where it will measure focus.
    Auto = 0,
    /// Use the rectangles defined by the AfWindows control to measure focus.
    ///
    /// If no windows are specified the behaviour is platform dependent.
    Windows = 1,
}
impl TryFrom<ControlValue> for AfMetering {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AfMetering> for ControlValue {
    fn from(val: AfMetering) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AfMetering {
    const ID: u32 = ControlId::AfMetering as _;
}
impl Control for AfMetering {}
/// The focus windows used by the AF algorithm when AfMetering is set to
/// AfMeteringWindows.
///
/// The units used are pixels within the rectangle returned by the
/// ScalerCropMaximum property.
///
/// In order to be activated, a rectangle must be programmed with non-zero
/// width and height. Internally, these rectangles are intersected with the
/// ScalerCropMaximum rectangle. If the window becomes empty after this
/// operation, then the window is ignored. If all the windows end up being
/// ignored, then the behaviour is platform dependent.
///
/// On platforms that support the ScalerCrop control (for implementing
/// digital zoom, for example), no automatic recalculation or adjustment of
/// AF windows is performed internally if the ScalerCrop is changed. If any
/// window lies outside the output image after the scaler crop has been
/// applied, it is up to the application to recalculate them.
///
/// The details of how the windows are used are platform dependent. We note
/// that when there is more than one AF window, a typical implementation
/// might find the optimal focus position for each one and finally select
/// the window where the focal distance for the objects shown in that part
/// of the image are closest to the camera.
#[derive(Debug, Clone)]
pub struct AfWindows(pub Vec<Rectangle>);
impl Deref for AfWindows {
    type Target = Vec<Rectangle>;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for AfWindows {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for AfWindows {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<Vec<Rectangle>>::try_from(value)?))
    }
}
impl From<AfWindows> for ControlValue {
    fn from(val: AfWindows) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for AfWindows {
    const ID: u32 = ControlId::AfWindows as _;
}
impl Control for AfWindows {}
/// Start an autofocus scan.
///
/// This control starts an autofocus scan when AfMode is set to AfModeAuto,
/// and is ignored if AfMode is set to AfModeManual or AfModeContinuous. It
/// can also be used to terminate a scan early.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AfTrigger {
    /// Start an AF scan.
    ///
    /// Setting the control to AfTriggerStart is ignored if a scan is in
    /// progress.
    Start = 0,
    /// Cancel an AF scan.
    ///
    /// This does not cause the lens to move anywhere else. Ignored if no
    /// scan is in progress.
    Cancel = 1,
}
impl TryFrom<ControlValue> for AfTrigger {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AfTrigger> for ControlValue {
    fn from(val: AfTrigger) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AfTrigger {
    const ID: u32 = ControlId::AfTrigger as _;
}
impl Control for AfTrigger {}
/// Pause lens movements when in continuous autofocus mode.
///
/// This control has no effect except when in continuous autofocus mode
/// (AfModeContinuous). It can be used to pause any lens movements while
/// (for example) images are captured. The algorithm remains inactive
/// until it is instructed to resume.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AfPause {
    /// Pause the continuous autofocus algorithm immediately.
    ///
    /// The autofocus algorithm is paused whether or not any kind of scan
    /// is underway. AfPauseState will subsequently report
    /// AfPauseStatePaused. AfState may report any of AfStateScanning,
    /// AfStateFocused or AfStateFailed, depending on the algorithm's state
    /// when it received this control.
    Immediate = 0,
    /// Pause the continuous autofocus algorithm at the end of the scan.
    ///
    /// This is similar to AfPauseImmediate, and if the AfState is
    /// currently reporting AfStateFocused or AfStateFailed it will remain
    /// in that state and AfPauseState will report AfPauseStatePaused.
    ///
    /// However, if the algorithm is scanning (AfStateScanning),
    /// AfPauseState will report AfPauseStatePausing until the scan is
    /// finished, at which point AfState will report one of AfStateFocused
    /// or AfStateFailed, and AfPauseState will change to
    /// AfPauseStatePaused.
    Deferred = 1,
    /// Resume continuous autofocus operation.
    ///
    /// The algorithm starts again from exactly where it left off, and
    /// AfPauseState will report AfPauseStateRunning.
    Resume = 2,
}
impl TryFrom<ControlValue> for AfPause {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AfPause> for ControlValue {
    fn from(val: AfPause) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AfPause {
    const ID: u32 = ControlId::AfPause as _;
}
impl Control for AfPause {}
/// Set and report the focus lens position.
///
/// This control instructs the lens to move to a particular position and
/// also reports back the position of the lens for each frame.
///
/// The LensPosition control is ignored unless the AfMode is set to
/// AfModeManual, though the value is reported back unconditionally in all
/// modes.
///
/// This value, which is generally a non-integer, is the reciprocal of the
/// focal distance in metres, also known as dioptres. That is, to set a
/// focal distance D, the lens position LP is given by
///
/// \f$LP = \frac{1\mathrm{m}}{D}\f$
///
/// For example:
///
/// - 0 moves the lens to infinity.
/// - 0.5 moves the lens to focus on objects 2m away.
/// - 2 moves the lens to focus on objects 50cm away.
/// - And larger values will focus the lens closer.
///
/// The default value of the control should indicate a good general
/// position for the lens, often corresponding to the hyperfocal distance
/// (the closest position for which objects at infinity are still
/// acceptably sharp). The minimum will often be zero (meaning infinity),
/// and the maximum value defines the closest focus position.
///
/// \todo Define a property to report the Hyperfocal distance of calibrated
/// lenses.
#[derive(Debug, Clone)]
pub struct LensPosition(pub f32);
impl Deref for LensPosition {
    type Target = f32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for LensPosition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for LensPosition {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<f32>::try_from(value)?))
    }
}
impl From<LensPosition> for ControlValue {
    fn from(val: LensPosition) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for LensPosition {
    const ID: u32 = ControlId::LensPosition as _;
}
impl Control for LensPosition {}
/// The current state of the AF algorithm.
///
/// This control reports the current state of the AF algorithm in
/// conjunction with the reported AfMode value and (in continuous AF mode)
/// the AfPauseState value. The possible state changes are described below,
/// though we note the following state transitions that occur when the
/// AfMode is changed.
///
/// If the AfMode is set to AfModeManual, then the AfState will always
/// report AfStateIdle (even if the lens is subsequently moved). Changing
/// to the AfModeManual state does not initiate any lens movement.
///
/// If the AfMode is set to AfModeAuto then the AfState will report
/// AfStateIdle. However, if AfModeAuto and AfTriggerStart are sent
/// together then AfState will omit AfStateIdle and move straight to
/// AfStateScanning (and start a scan).
///
/// If the AfMode is set to AfModeContinuous then the AfState will
/// initially report AfStateScanning.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AfState {
    /// The AF algorithm is in manual mode (AfModeManual) or in auto mode
    /// (AfModeAuto) and a scan has not yet been triggered, or an
    /// in-progress scan was cancelled.
    Idle = 0,
    /// The AF algorithm is in auto mode (AfModeAuto), and a scan has been
    /// started using the AfTrigger control.
    ///
    /// The scan can be cancelled by sending AfTriggerCancel at which point
    /// the algorithm will either move back to AfStateIdle or, if the scan
    /// actually completes before the cancel request is processed, to one
    /// of AfStateFocused or AfStateFailed.
    ///
    /// Alternatively the AF algorithm could be in continuous mode
    /// (AfModeContinuous) at which point it may enter this state
    /// spontaneously whenever it determines that a rescan is needed.
    Scanning = 1,
    /// The AF algorithm is in auto (AfModeAuto) or continuous
    /// (AfModeContinuous) mode and a scan has completed with the result
    /// that the algorithm believes the image is now in focus.
    Focused = 2,
    /// The AF algorithm is in auto (AfModeAuto) or continuous
    /// (AfModeContinuous) mode and a scan has completed with the result
    /// that the algorithm did not find a good focus position.
    Failed = 3,
}
impl TryFrom<ControlValue> for AfState {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AfState> for ControlValue {
    fn from(val: AfState) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AfState {
    const ID: u32 = ControlId::AfState as _;
}
impl Control for AfState {}
/// Report whether the autofocus is currently running, paused or pausing.
///
/// This control is only applicable in continuous (AfModeContinuous) mode,
/// and reports whether the algorithm is currently running, paused or
/// pausing (that is, will pause as soon as any in-progress scan
/// completes).
///
/// Any change to AfMode will cause AfPauseStateRunning to be reported.
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AfPauseState {
    /// Continuous AF is running and the algorithm may restart a scan
    /// spontaneously.
    Running = 0,
    /// Continuous AF has been sent an AfPauseDeferred control, and will
    /// pause as soon as any in-progress scan completes.
    ///
    /// When the scan completes, the AfPauseState control will report
    /// AfPauseStatePaused. No new scans will be start spontaneously until
    /// the AfPauseResume control is sent.
    Pausing = 1,
    /// Continuous AF is paused.
    ///
    /// No further state changes or lens movements will occur until the
    /// AfPauseResume control is sent.
    Paused = 2,
}
impl TryFrom<ControlValue> for AfPauseState {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<AfPauseState> for ControlValue {
    fn from(val: AfPauseState) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for AfPauseState {
    const ID: u32 = ControlId::AfPauseState as _;
}
impl Control for AfPauseState {}
/// Set the mode to be used for High Dynamic Range (HDR) imaging.
///
/// HDR techniques typically include multiple exposure, image fusion and
/// tone mapping techniques to improve the dynamic range of the resulting
/// images.
///
/// When using an HDR mode, images are captured with different sets of AGC
/// settings called HDR channels. Channels indicate in particular the type
/// of exposure (short, medium or long) used to capture the raw image,
/// before fusion. Each HDR image is tagged with the corresponding channel
/// using the HdrChannel control.
///
/// \sa HdrChannel
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum HdrMode {
    /// HDR is disabled.
    ///
    /// Metadata for this frame will not include the HdrChannel control.
    Off = 0,
    /// Multiple exposures will be generated in an alternating fashion.
    ///
    /// The multiple exposures will not be merged together and will be
    /// returned to the application as they are. Each image will be tagged
    /// with the correct HDR channel, indicating what kind of exposure it
    /// is. The tag should be the same as in the HdrModeMultiExposure case.
    ///
    /// The expectation is that an application using this mode would merge
    /// the frames to create HDR images for itself if it requires them.
    MultiExposureUnmerged = 1,
    /// Multiple exposures will be generated and merged to create HDR
    /// images.
    ///
    /// Each image will be tagged with the HDR channel (long, medium or
    /// short) that arrived and which caused this image to be output.
    ///
    /// Systems that use two channels for HDR will return images tagged
    /// alternately as the short and long channel. Systems that use three
    /// channels for HDR will cycle through the short, medium and long
    /// channel before repeating.
    MultiExposure = 2,
    /// Multiple frames all at a single exposure will be used to create HDR
    /// images.
    ///
    /// These images should be reported as all corresponding to the HDR
    /// short channel.
    SingleExposure = 3,
    /// Multiple frames will be combined to produce "night mode" images.
    ///
    /// It is up to the implementation exactly which HDR channels it uses,
    /// and the images will all be tagged accordingly with the correct HDR
    /// channel information.
    Night = 4,
}
impl TryFrom<ControlValue> for HdrMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<HdrMode> for ControlValue {
    fn from(val: HdrMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for HdrMode {
    const ID: u32 = ControlId::HdrMode as _;
}
impl Control for HdrMode {}
/// The HDR channel used to capture the frame.
///
/// This value is reported back to the application so that it can discover
/// whether this capture corresponds to the short or long exposure image
/// (or any other image used by the HDR procedure). An application can
/// monitor the HDR channel to discover when the differently exposed images
/// have arrived.
///
/// This metadata is only available when an HDR mode has been enabled.
///
/// \sa HdrMode
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum HdrChannel {
    /// This image does not correspond to any of the captures used to create
    /// an HDR image.
    None = 0,
    /// This is a short exposure image.
    Short = 1,
    /// This is a medium exposure image.
    Medium = 2,
    /// This is a long exposure image.
    Long = 3,
}
impl TryFrom<ControlValue> for HdrChannel {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
impl From<HdrChannel> for ControlValue {
    fn from(val: HdrChannel) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
impl ControlEntry for HdrChannel {
    const ID: u32 = ControlId::HdrChannel as _;
}
impl Control for HdrChannel {}
/// Specify a fixed gamma value.
///
/// The default gamma value must be 2.2 which closely mimics sRGB gamma.
/// Note that this is camera gamma, so it is applied as 1.0/gamma.
#[derive(Debug, Clone)]
pub struct Gamma(pub f32);
impl Deref for Gamma {
    type Target = f32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for Gamma {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for Gamma {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<f32>::try_from(value)?))
    }
}
impl From<Gamma> for ControlValue {
    fn from(val: Gamma) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for Gamma {
    const ID: u32 = ControlId::Gamma as _;
}
impl Control for Gamma {}
/// Enable or disable the debug metadata.
#[derive(Debug, Clone)]
pub struct DebugMetadataEnable(pub bool);
impl Deref for DebugMetadataEnable {
    type Target = bool;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl DerefMut for DebugMetadataEnable {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TryFrom<ControlValue> for DebugMetadataEnable {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<bool>::try_from(value)?))
    }
}
impl From<DebugMetadataEnable> for ControlValue {
    fn from(val: DebugMetadataEnable) -> Self {
        ControlValue::from(val.0)
    }
}
impl ControlEntry for DebugMetadataEnable {
    const ID: u32 = ControlId::DebugMetadataEnable as _;
}
impl Control for DebugMetadataEnable {}
/// Control for AE metering trigger. Currently identical to
/// ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER.
///
/// Whether the camera device will trigger a precapture metering sequence
/// when it processes this request.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AePrecaptureTrigger {
    /// The trigger is idle.
    Idle = 0,
    /// The pre-capture AE metering is started by the camera.
    Start = 1,
    /// The camera will cancel any active or completed metering sequence.
    /// The AE algorithm is reset to its initial state.
    Cancel = 2,
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for AePrecaptureTrigger {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<AePrecaptureTrigger> for ControlValue {
    fn from(val: AePrecaptureTrigger) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for AePrecaptureTrigger {
    const ID: u32 = ControlId::AePrecaptureTrigger as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for AePrecaptureTrigger {}
/// Control to select the noise reduction algorithm mode. Currently
/// identical to ANDROID_NOISE_REDUCTION_MODE.
///
///  Mode of operation for the noise reduction algorithm.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum NoiseReductionMode {
    /// No noise reduction is applied
    Off = 0,
    /// Noise reduction is applied without reducing the frame rate.
    Fast = 1,
    /// High quality noise reduction at the expense of frame rate.
    HighQuality = 2,
    /// Minimal noise reduction is applied without reducing the frame rate.
    Minimal = 3,
    /// Noise reduction is applied at different levels to different streams.
    ZSL = 4,
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for NoiseReductionMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<NoiseReductionMode> for ControlValue {
    fn from(val: NoiseReductionMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for NoiseReductionMode {
    const ID: u32 = ControlId::NoiseReductionMode as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for NoiseReductionMode {}
/// Control to select the color correction aberration mode. Currently
/// identical to ANDROID_COLOR_CORRECTION_ABERRATION_MODE.
///
///  Mode of operation for the chromatic aberration correction algorithm.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum ColorCorrectionAberrationMode {
    /// No aberration correction is applied.
    ColorCorrectionAberrationOff = 0,
    /// Aberration correction will not slow down the frame rate.
    ColorCorrectionAberrationFast = 1,
    /// High quality aberration correction which might reduce the frame
    /// rate.
    ColorCorrectionAberrationHighQuality = 2,
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for ColorCorrectionAberrationMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<ColorCorrectionAberrationMode> for ControlValue {
    fn from(val: ColorCorrectionAberrationMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for ColorCorrectionAberrationMode {
    const ID: u32 = ControlId::ColorCorrectionAberrationMode as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for ColorCorrectionAberrationMode {}
/// Control to report the current AWB algorithm state. Currently identical
/// to ANDROID_CONTROL_AWB_STATE.
///
///  Current state of the AWB algorithm.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum AwbState {
    /// The AWB algorithm is inactive.
    Inactive = 0,
    /// The AWB algorithm has not converged yet.
    Searching = 1,
    /// The AWB algorithm has converged.
    AwbConverged = 2,
    /// The AWB algorithm is locked.
    AwbLocked = 3,
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for AwbState {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<AwbState> for ControlValue {
    fn from(val: AwbState) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for AwbState {
    const ID: u32 = ControlId::AwbState as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for AwbState {}
/// Control to report the time between the start of exposure of the first
/// row and the start of exposure of the last row. Currently identical to
/// ANDROID_SENSOR_ROLLING_SHUTTER_SKEW
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone)]
pub struct SensorRollingShutterSkew(pub i64);
#[cfg(feature = "vendor_draft")]
impl Deref for SensorRollingShutterSkew {
    type Target = i64;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl DerefMut for SensorRollingShutterSkew {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for SensorRollingShutterSkew {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<i64>::try_from(value)?))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<SensorRollingShutterSkew> for ControlValue {
    fn from(val: SensorRollingShutterSkew) -> Self {
        ControlValue::from(val.0)
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for SensorRollingShutterSkew {
    const ID: u32 = ControlId::SensorRollingShutterSkew as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for SensorRollingShutterSkew {}
/// Control to report if the lens shading map is available. Currently
/// identical to ANDROID_STATISTICS_LENS_SHADING_MAP_MODE.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum LensShadingMapMode {
    /// No lens shading map mode is available.
    Off = 0,
    /// The lens shading map mode is available.
    On = 1,
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for LensShadingMapMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<LensShadingMapMode> for ControlValue {
    fn from(val: LensShadingMapMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for LensShadingMapMode {
    const ID: u32 = ControlId::LensShadingMapMode as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for LensShadingMapMode {}
/// Specifies the number of pipeline stages the frame went through from when
/// it was exposed to when the final completed result was available to the
/// framework. Always less than or equal to PipelineMaxDepth. Currently
/// identical to ANDROID_REQUEST_PIPELINE_DEPTH.
///
/// The typical value for this control is 3 as a frame is first exposed,
/// captured and then processed in a single pass through the ISP. Any
/// additional processing step performed after the ISP pass (in example face
/// detection, additional format conversions etc) count as an additional
/// pipeline stage.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone)]
pub struct PipelineDepth(pub i32);
#[cfg(feature = "vendor_draft")]
impl Deref for PipelineDepth {
    type Target = i32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl DerefMut for PipelineDepth {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for PipelineDepth {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<i32>::try_from(value)?))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<PipelineDepth> for ControlValue {
    fn from(val: PipelineDepth) -> Self {
        ControlValue::from(val.0)
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for PipelineDepth {
    const ID: u32 = ControlId::PipelineDepth as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for PipelineDepth {}
/// The maximum number of frames that can occur after a request (different
/// than the previous) has been submitted, and before the result's state
/// becomes synchronized. A value of -1 indicates unknown latency, and 0
/// indicates per-frame control. Currently identical to
/// ANDROID_SYNC_MAX_LATENCY.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone)]
pub struct MaxLatency(pub i32);
#[cfg(feature = "vendor_draft")]
impl Deref for MaxLatency {
    type Target = i32;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl DerefMut for MaxLatency {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for MaxLatency {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<i32>::try_from(value)?))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<MaxLatency> for ControlValue {
    fn from(val: MaxLatency) -> Self {
        ControlValue::from(val.0)
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for MaxLatency {
    const ID: u32 = ControlId::MaxLatency as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for MaxLatency {}
/// Control to select the test pattern mode. Currently identical to
/// ANDROID_SENSOR_TEST_PATTERN_MODE.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum TestPatternMode {
    /// No test pattern mode is used. The camera device returns frames from
    /// the image sensor.
    Off = 0,
    /// Each pixel in [R, G_even, G_odd, B] is replaced by its respective
    /// color channel provided in test pattern data.
    /// \todo Add control for test pattern data.
    SolidColor = 1,
    /// All pixel data is replaced with an 8-bar color pattern. The vertical
    /// bars (left-to-right) are as follows; white, yellow, cyan, green,
    /// magenta, red, blue and black. Each bar should take up 1/8 of the
    /// sensor pixel array width. When this is not possible, the bar size
    /// should be rounded down to the nearest integer and the pattern can
    /// repeat on the right side. Each bar's height must always take up the
    /// full sensor pixel array height.
    ColorBars = 2,
    /// The test pattern is similar to TestPatternModeColorBars,
    /// except that each bar should start at its specified color at the top
    /// and fade to gray at the bottom. Furthermore each bar is further
    /// subdevided into a left and right half. The left half should have a
    /// smooth gradient, and the right half should have a quantized
    /// gradient. In particular, the right half's should consist of blocks
    /// of the same color for 1/16th active sensor pixel array width. The
    /// least significant bits in the quantized gradient should be copied
    /// from the most significant bits of the smooth gradient. The height of
    /// each bar should always be a multiple of 128. When this is not the
    /// case, the pattern should repeat at the bottom of the image.
    ColorBarsFadeToGray = 3,
    /// All pixel data is replaced by a pseudo-random sequence generated
    /// from a PN9 512-bit sequence (typically implemented in hardware with
    /// a linear feedback shift register). The generator should be reset at
    /// the beginning of each frame, and thus each subsequent raw frame with
    /// this test pattern should be exactly the same as the last.
    Pn9 = 4,
    /// The first custom test pattern. All custom patterns that are
    /// available only on this camera device are at least this numeric
    /// value. All of the custom test patterns will be static (that is the
    /// raw image must not vary from frame to frame).
    Custom1 = 256,
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for TestPatternMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<TestPatternMode> for ControlValue {
    fn from(val: TestPatternMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for TestPatternMode {
    const ID: u32 = ControlId::TestPatternMode as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for TestPatternMode {}
/// Control to select the face detection mode used by the pipeline.
///
/// Currently identical to ANDROID_STATISTICS_FACE_DETECT_MODE.
///
/// \sa FaceDetectFaceRectangles
/// \sa FaceDetectFaceScores
/// \sa FaceDetectFaceLandmarks
/// \sa FaceDetectFaceIds
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone, Copy, Eq, PartialEq, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum FaceDetectMode {
    /// Pipeline doesn't perform face detection and doesn't report any
    /// control related to face detection.
    Off = 0,
    /// Pipeline performs face detection and reports the
    /// FaceDetectFaceRectangles and FaceDetectFaceScores controls for each
    /// detected face. FaceDetectFaceLandmarks and FaceDetectFaceIds are
    /// optional.
    Simple = 1,
    /// Pipeline performs face detection and reports all the controls
    /// related to face detection including FaceDetectFaceRectangles,
    /// FaceDetectFaceScores, FaceDetectFaceLandmarks, and
    /// FaceDeteceFaceIds for each detected face.
    Full = 2,
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for FaceDetectMode {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Self::try_from(i32::try_from(value.clone())?)
            .map_err(|_| ControlValueError::UnknownVariant(value))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<FaceDetectMode> for ControlValue {
    fn from(val: FaceDetectMode) -> Self {
        ControlValue::from(<i32>::from(val))
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for FaceDetectMode {
    const ID: u32 = ControlId::FaceDetectMode as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for FaceDetectMode {}
/// Boundary rectangles of the detected faces. The number of values is
/// the number of detected faces.
///
/// The FaceDetectFaceRectangles control can only be returned in metadata.
///
/// Currently identical to ANDROID_STATISTICS_FACE_RECTANGLES.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone)]
pub struct FaceDetectFaceRectangles(pub Vec<Rectangle>);
#[cfg(feature = "vendor_draft")]
impl Deref for FaceDetectFaceRectangles {
    type Target = Vec<Rectangle>;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl DerefMut for FaceDetectFaceRectangles {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for FaceDetectFaceRectangles {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<Vec<Rectangle>>::try_from(value)?))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<FaceDetectFaceRectangles> for ControlValue {
    fn from(val: FaceDetectFaceRectangles) -> Self {
        ControlValue::from(val.0)
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for FaceDetectFaceRectangles {
    const ID: u32 = ControlId::FaceDetectFaceRectangles as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for FaceDetectFaceRectangles {}
/// Confidence score of each of the detected faces. The range of score is
/// [0, 100]. The number of values should be the number of faces reported
/// in FaceDetectFaceRectangles.
///
/// The FaceDetectFaceScores control can only be returned in metadata.
///
/// Currently identical to ANDROID_STATISTICS_FACE_SCORES.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone)]
pub struct FaceDetectFaceScores(pub Vec<u8>);
#[cfg(feature = "vendor_draft")]
impl Deref for FaceDetectFaceScores {
    type Target = Vec<u8>;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl DerefMut for FaceDetectFaceScores {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for FaceDetectFaceScores {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<Vec<u8>>::try_from(value)?))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<FaceDetectFaceScores> for ControlValue {
    fn from(val: FaceDetectFaceScores) -> Self {
        ControlValue::from(val.0)
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for FaceDetectFaceScores {
    const ID: u32 = ControlId::FaceDetectFaceScores as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for FaceDetectFaceScores {}
/// Array of human face landmark coordinates in format [..., left_eye_i,
/// right_eye_i, mouth_i, left_eye_i+1, ...], with i = index of face. The
/// number of values should be 3 * the number of faces reported in
/// FaceDetectFaceRectangles.
///
/// The FaceDetectFaceLandmarks control can only be returned in metadata.
///
/// Currently identical to ANDROID_STATISTICS_FACE_LANDMARKS.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone)]
pub struct FaceDetectFaceLandmarks(pub Vec<Point>);
#[cfg(feature = "vendor_draft")]
impl Deref for FaceDetectFaceLandmarks {
    type Target = Vec<Point>;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl DerefMut for FaceDetectFaceLandmarks {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for FaceDetectFaceLandmarks {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<Vec<Point>>::try_from(value)?))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<FaceDetectFaceLandmarks> for ControlValue {
    fn from(val: FaceDetectFaceLandmarks) -> Self {
        ControlValue::from(val.0)
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for FaceDetectFaceLandmarks {
    const ID: u32 = ControlId::FaceDetectFaceLandmarks as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for FaceDetectFaceLandmarks {}
/// Each detected face is given a unique ID that is valid for as long as the
/// face is visible to the camera device. A face that leaves the field of
/// view and later returns may be assigned a new ID. The number of values
/// should be the number of faces reported in FaceDetectFaceRectangles.
///
/// The FaceDetectFaceIds control can only be returned in metadata.
///
/// Currently identical to ANDROID_STATISTICS_FACE_IDS.
#[cfg(feature = "vendor_draft")]
#[derive(Debug, Clone)]
pub struct FaceDetectFaceIds(pub Vec<i32>);
#[cfg(feature = "vendor_draft")]
impl Deref for FaceDetectFaceIds {
    type Target = Vec<i32>;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl DerefMut for FaceDetectFaceIds {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
#[cfg(feature = "vendor_draft")]
impl TryFrom<ControlValue> for FaceDetectFaceIds {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<Vec<i32>>::try_from(value)?))
    }
}
#[cfg(feature = "vendor_draft")]
impl From<FaceDetectFaceIds> for ControlValue {
    fn from(val: FaceDetectFaceIds) -> Self {
        ControlValue::from(val.0)
    }
}
#[cfg(feature = "vendor_draft")]
impl ControlEntry for FaceDetectFaceIds {
    const ID: u32 = ControlId::FaceDetectFaceIds as _;
}
#[cfg(feature = "vendor_draft")]
impl Control for FaceDetectFaceIds {}
/// Toggles the Raspberry Pi IPA to output the hardware generated statistics.
///
/// When this control is set to true, the IPA outputs a binary dump of the
/// hardware generated statistics through the Request metadata in the
/// Bcm2835StatsOutput control.
///
/// \sa Bcm2835StatsOutput
#[cfg(feature = "vendor_rpi")]
#[derive(Debug, Clone)]
pub struct StatsOutputEnable(pub bool);
#[cfg(feature = "vendor_rpi")]
impl Deref for StatsOutputEnable {
    type Target = bool;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[cfg(feature = "vendor_rpi")]
impl DerefMut for StatsOutputEnable {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
#[cfg(feature = "vendor_rpi")]
impl TryFrom<ControlValue> for StatsOutputEnable {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<bool>::try_from(value)?))
    }
}
#[cfg(feature = "vendor_rpi")]
impl From<StatsOutputEnable> for ControlValue {
    fn from(val: StatsOutputEnable) -> Self {
        ControlValue::from(val.0)
    }
}
#[cfg(feature = "vendor_rpi")]
impl ControlEntry for StatsOutputEnable {
    const ID: u32 = ControlId::StatsOutputEnable as _;
}
#[cfg(feature = "vendor_rpi")]
impl Control for StatsOutputEnable {}
/// Span of the BCM2835 ISP generated statistics for the current frame.
///
/// This is sent in the Request metadata if the StatsOutputEnable is set to
/// true.  The statistics struct definition can be found in
/// include/linux/bcm2835-isp.h.
///
/// \sa StatsOutputEnable
#[cfg(feature = "vendor_rpi")]
#[derive(Debug, Clone)]
pub struct Bcm2835StatsOutput(pub Vec<u8>);
#[cfg(feature = "vendor_rpi")]
impl Deref for Bcm2835StatsOutput {
    type Target = Vec<u8>;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[cfg(feature = "vendor_rpi")]
impl DerefMut for Bcm2835StatsOutput {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
#[cfg(feature = "vendor_rpi")]
impl TryFrom<ControlValue> for Bcm2835StatsOutput {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<Vec<u8>>::try_from(value)?))
    }
}
#[cfg(feature = "vendor_rpi")]
impl From<Bcm2835StatsOutput> for ControlValue {
    fn from(val: Bcm2835StatsOutput) -> Self {
        ControlValue::from(val.0)
    }
}
#[cfg(feature = "vendor_rpi")]
impl ControlEntry for Bcm2835StatsOutput {
    const ID: u32 = ControlId::Bcm2835StatsOutput as _;
}
#[cfg(feature = "vendor_rpi")]
impl Control for Bcm2835StatsOutput {}
/// An array of rectangles, where each singular value has identical
/// functionality to the ScalerCrop control. This control allows the
/// Raspberry Pi pipeline handler to control individual scaler crops per
/// output stream.
///
/// The order of rectangles passed into the control must match the order of
/// streams configured by the application. The pipeline handler will only
/// configure crop retangles up-to the number of output streams configured.
/// All subsequent rectangles passed into this control are ignored by the
/// pipeline handler.
///
/// If both rpi::ScalerCrops and ScalerCrop controls are present in a
/// ControlList, the latter is discarded, and crops are obtained from this
/// control.
///
/// Note that using different crop rectangles for each output stream with
/// this control is only applicable on the Pi5/PiSP platform. This control
/// should also be considered temporary/draft and will be replaced with
/// official libcamera API support for per-stream controls in the future.
///
/// \sa ScalerCrop
#[cfg(feature = "vendor_rpi")]
#[derive(Debug, Clone)]
pub struct ScalerCrops(pub Vec<Rectangle>);
#[cfg(feature = "vendor_rpi")]
impl Deref for ScalerCrops {
    type Target = Vec<Rectangle>;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[cfg(feature = "vendor_rpi")]
impl DerefMut for ScalerCrops {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
#[cfg(feature = "vendor_rpi")]
impl TryFrom<ControlValue> for ScalerCrops {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<Vec<Rectangle>>::try_from(value)?))
    }
}
#[cfg(feature = "vendor_rpi")]
impl From<ScalerCrops> for ControlValue {
    fn from(val: ScalerCrops) -> Self {
        ControlValue::from(val.0)
    }
}
#[cfg(feature = "vendor_rpi")]
impl ControlEntry for ScalerCrops {
    const ID: u32 = ControlId::ScalerCrops as _;
}
#[cfg(feature = "vendor_rpi")]
impl Control for ScalerCrops {}
/// Span of the PiSP Frontend ISP generated statistics for the current
/// frame. This is sent in the Request metadata if the StatsOutputEnable is
/// set to true. The statistics struct definition can be found in
/// https://github.com/raspberrypi/libpisp/blob/main/src/libpisp/frontend/pisp_statistics.h
///
/// \sa StatsOutputEnable
#[cfg(feature = "vendor_rpi")]
#[derive(Debug, Clone)]
pub struct PispStatsOutput(pub Vec<u8>);
#[cfg(feature = "vendor_rpi")]
impl Deref for PispStatsOutput {
    type Target = Vec<u8>;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[cfg(feature = "vendor_rpi")]
impl DerefMut for PispStatsOutput {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
#[cfg(feature = "vendor_rpi")]
impl TryFrom<ControlValue> for PispStatsOutput {
    type Error = ControlValueError;
    fn try_from(value: ControlValue) -> Result<Self, Self::Error> {
        Ok(Self(<Vec<u8>>::try_from(value)?))
    }
}
#[cfg(feature = "vendor_rpi")]
impl From<PispStatsOutput> for ControlValue {
    fn from(val: PispStatsOutput) -> Self {
        ControlValue::from(val.0)
    }
}
#[cfg(feature = "vendor_rpi")]
impl ControlEntry for PispStatsOutput {
    const ID: u32 = ControlId::PispStatsOutput as _;
}
#[cfg(feature = "vendor_rpi")]
impl Control for PispStatsOutput {}
pub fn make_dyn(
    id: ControlId,
    val: ControlValue,
) -> Result<Box<dyn DynControlEntry>, ControlValueError> {
    match id {
        ControlId::AeEnable => Ok(Box::new(AeEnable::try_from(val)?)),
        ControlId::AeState => Ok(Box::new(AeState::try_from(val)?)),
        ControlId::AeMeteringMode => Ok(Box::new(AeMeteringMode::try_from(val)?)),
        ControlId::AeConstraintMode => Ok(Box::new(AeConstraintMode::try_from(val)?)),
        ControlId::AeExposureMode => Ok(Box::new(AeExposureMode::try_from(val)?)),
        ControlId::ExposureValue => Ok(Box::new(ExposureValue::try_from(val)?)),
        ControlId::ExposureTime => Ok(Box::new(ExposureTime::try_from(val)?)),
        ControlId::ExposureTimeMode => Ok(Box::new(ExposureTimeMode::try_from(val)?)),
        ControlId::AnalogueGain => Ok(Box::new(AnalogueGain::try_from(val)?)),
        ControlId::AnalogueGainMode => Ok(Box::new(AnalogueGainMode::try_from(val)?)),
        ControlId::AeFlickerMode => Ok(Box::new(AeFlickerMode::try_from(val)?)),
        ControlId::AeFlickerPeriod => Ok(Box::new(AeFlickerPeriod::try_from(val)?)),
        ControlId::AeFlickerDetected => Ok(Box::new(AeFlickerDetected::try_from(val)?)),
        ControlId::Brightness => Ok(Box::new(Brightness::try_from(val)?)),
        ControlId::Contrast => Ok(Box::new(Contrast::try_from(val)?)),
        ControlId::Lux => Ok(Box::new(Lux::try_from(val)?)),
        ControlId::AwbEnable => Ok(Box::new(AwbEnable::try_from(val)?)),
        ControlId::AwbMode => Ok(Box::new(AwbMode::try_from(val)?)),
        ControlId::AwbLocked => Ok(Box::new(AwbLocked::try_from(val)?)),
        ControlId::ColourGains => Ok(Box::new(ColourGains::try_from(val)?)),
        ControlId::ColourTemperature => Ok(Box::new(ColourTemperature::try_from(val)?)),
        ControlId::Saturation => Ok(Box::new(Saturation::try_from(val)?)),
        ControlId::SensorBlackLevels => Ok(Box::new(SensorBlackLevels::try_from(val)?)),
        ControlId::Sharpness => Ok(Box::new(Sharpness::try_from(val)?)),
        ControlId::FocusFoM => Ok(Box::new(FocusFoM::try_from(val)?)),
        ControlId::ColourCorrectionMatrix => {
            Ok(Box::new(ColourCorrectionMatrix::try_from(val)?))
        }
        ControlId::ScalerCrop => Ok(Box::new(ScalerCrop::try_from(val)?)),
        ControlId::DigitalGain => Ok(Box::new(DigitalGain::try_from(val)?)),
        ControlId::FrameDuration => Ok(Box::new(FrameDuration::try_from(val)?)),
        ControlId::FrameDurationLimits => {
            Ok(Box::new(FrameDurationLimits::try_from(val)?))
        }
        ControlId::SensorTemperature => Ok(Box::new(SensorTemperature::try_from(val)?)),
        ControlId::SensorTimestamp => Ok(Box::new(SensorTimestamp::try_from(val)?)),
        ControlId::AfMode => Ok(Box::new(AfMode::try_from(val)?)),
        ControlId::AfRange => Ok(Box::new(AfRange::try_from(val)?)),
        ControlId::AfSpeed => Ok(Box::new(AfSpeed::try_from(val)?)),
        ControlId::AfMetering => Ok(Box::new(AfMetering::try_from(val)?)),
        ControlId::AfWindows => Ok(Box::new(AfWindows::try_from(val)?)),
        ControlId::AfTrigger => Ok(Box::new(AfTrigger::try_from(val)?)),
        ControlId::AfPause => Ok(Box::new(AfPause::try_from(val)?)),
        ControlId::LensPosition => Ok(Box::new(LensPosition::try_from(val)?)),
        ControlId::AfState => Ok(Box::new(AfState::try_from(val)?)),
        ControlId::AfPauseState => Ok(Box::new(AfPauseState::try_from(val)?)),
        ControlId::HdrMode => Ok(Box::new(HdrMode::try_from(val)?)),
        ControlId::HdrChannel => Ok(Box::new(HdrChannel::try_from(val)?)),
        ControlId::Gamma => Ok(Box::new(Gamma::try_from(val)?)),
        ControlId::DebugMetadataEnable => {
            Ok(Box::new(DebugMetadataEnable::try_from(val)?))
        }
        #[cfg(feature = "vendor_draft")]
        ControlId::AePrecaptureTrigger => {
            Ok(Box::new(AePrecaptureTrigger::try_from(val)?))
        }
        #[cfg(feature = "vendor_draft")]
        ControlId::NoiseReductionMode => Ok(Box::new(NoiseReductionMode::try_from(val)?)),
        #[cfg(feature = "vendor_draft")]
        ControlId::ColorCorrectionAberrationMode => {
            Ok(Box::new(ColorCorrectionAberrationMode::try_from(val)?))
        }
        #[cfg(feature = "vendor_draft")]
        ControlId::AwbState => Ok(Box::new(AwbState::try_from(val)?)),
        #[cfg(feature = "vendor_draft")]
        ControlId::SensorRollingShutterSkew => {
            Ok(Box::new(SensorRollingShutterSkew::try_from(val)?))
        }
        #[cfg(feature = "vendor_draft")]
        ControlId::LensShadingMapMode => Ok(Box::new(LensShadingMapMode::try_from(val)?)),
        #[cfg(feature = "vendor_draft")]
        ControlId::PipelineDepth => Ok(Box::new(PipelineDepth::try_from(val)?)),
        #[cfg(feature = "vendor_draft")]
        ControlId::MaxLatency => Ok(Box::new(MaxLatency::try_from(val)?)),
        #[cfg(feature = "vendor_draft")]
        ControlId::TestPatternMode => Ok(Box::new(TestPatternMode::try_from(val)?)),
        #[cfg(feature = "vendor_draft")]
        ControlId::FaceDetectMode => Ok(Box::new(FaceDetectMode::try_from(val)?)),
        #[cfg(feature = "vendor_draft")]
        ControlId::FaceDetectFaceRectangles => {
            Ok(Box::new(FaceDetectFaceRectangles::try_from(val)?))
        }
        #[cfg(feature = "vendor_draft")]
        ControlId::FaceDetectFaceScores => {
            Ok(Box::new(FaceDetectFaceScores::try_from(val)?))
        }
        #[cfg(feature = "vendor_draft")]
        ControlId::FaceDetectFaceLandmarks => {
            Ok(Box::new(FaceDetectFaceLandmarks::try_from(val)?))
        }
        #[cfg(feature = "vendor_draft")]
        ControlId::FaceDetectFaceIds => Ok(Box::new(FaceDetectFaceIds::try_from(val)?)),
        #[cfg(feature = "vendor_rpi")]
        ControlId::StatsOutputEnable => Ok(Box::new(StatsOutputEnable::try_from(val)?)),
        #[cfg(feature = "vendor_rpi")]
        ControlId::Bcm2835StatsOutput => Ok(Box::new(Bcm2835StatsOutput::try_from(val)?)),
        #[cfg(feature = "vendor_rpi")]
        ControlId::ScalerCrops => Ok(Box::new(ScalerCrops::try_from(val)?)),
        #[cfg(feature = "vendor_rpi")]
        ControlId::PispStatsOutput => Ok(Box::new(PispStatsOutput::try_from(val)?)),
    }
}