objc2-av-foundation 0.3.2

Bindings to the AVFoundation framework
Documentation
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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

extern "C" {
    /// Posted when a device becomes available on the system.
    ///
    ///
    /// The notification object is an AVCaptureDevice instance representing the device that became available.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicewasconnectednotification?language=objc)
    pub static AVCaptureDeviceWasConnectedNotification: &'static NSNotificationName;
}

extern "C" {
    /// Posted when a device becomes unavailable on the system.
    ///
    ///
    /// The notification object is an AVCaptureDevice instance representing the device that became unavailable.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicewasdisconnectednotification?language=objc)
    pub static AVCaptureDeviceWasDisconnectedNotification: &'static NSNotificationName;
}

extern "C" {
    /// Posted when the instance of AVCaptureDevice has detected a substantial change to the video subject area.
    ///
    ///
    /// Clients may observe the AVCaptureDeviceSubjectAreaDidChangeNotification to know when an instance of AVCaptureDevice has detected a substantial change to the video subject area. This notification is only sent if you first set subjectAreaChangeMonitoringEnabled to YES.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicesubjectareadidchangenotification?language=objc)
    pub static AVCaptureDeviceSubjectAreaDidChangeNotification: &'static NSNotificationName;
}

extern_class!(
    /// An AVCaptureDevice represents a physical device that provides realtime input media data, such as video and audio.
    ///
    ///
    /// Each instance of AVCaptureDevice corresponds to a device, such as a camera or microphone. Instances of AVCaptureDevice cannot be created directly. An array of all currently available devices can also be obtained using the AVCaptureDeviceDiscoverySession. Devices can provide one or more streams of a given media type. Applications can search for devices matching desired criteria by using AVCaptureDeviceDiscoverySession, or may obtain a reference to the default device matching desired criteria by using +[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
    ///
    /// Instances of AVCaptureDevice can be used to provide media data to an AVCaptureSession by creating an AVCaptureDeviceInput with the device and adding that to the capture session.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevice?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVCaptureDevice;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for AVCaptureDevice {}
);

impl AVCaptureDevice {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        /// Returns an array of devices currently available for use as media input sources.
        ///
        ///
        /// Returns: An NSArray of AVCaptureDevice instances for each available device.
        ///
        ///
        /// This method returns an array of AVCaptureDevice instances for input devices currently connected and available for capture. The returned array contains all devices that are available at the time the method is called. Applications should observe AVCaptureDeviceWasConnectedNotification and AVCaptureDeviceWasDisconnectedNotification to be notified when the list of available devices has changed.
        #[deprecated = "Use AVCaptureDeviceDiscoverySession instead."]
        #[unsafe(method(devices))]
        #[unsafe(method_family = none)]
        pub unsafe fn devices() -> Retained<NSArray<AVCaptureDevice>>;

        #[cfg(feature = "AVMediaFormat")]
        /// Returns an array of devices currently available for use as sources of media with the given media type.
        ///
        ///
        /// Parameter `mediaType`: The media type, such as AVMediaTypeVideo, AVMediaTypeAudio, or AVMediaTypeMuxed, supported by each returned device.
        ///
        /// Returns: An NSArray of AVCaptureDevice instances for each available device.
        ///
        ///
        /// This method returns an array of AVCaptureDevice instances for input devices currently connected and available for capture that provide media of the given type. Media type constants are defined in AVMediaFormat.h. The returned array contains all devices that are available at the time the method is called. Applications should observe AVCaptureDeviceWasConnectedNotification and AVCaptureDeviceWasDisconnectedNotification to be notified when the list of available devices has changed.
        #[deprecated = "Use AVCaptureDeviceDiscoverySession instead."]
        #[unsafe(method(devicesWithMediaType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn devicesWithMediaType(
            media_type: &AVMediaType,
        ) -> Retained<NSArray<AVCaptureDevice>>;

        #[cfg(feature = "AVMediaFormat")]
        /// Returns an AVCaptureDevice instance for the default device of the given media type.
        ///
        ///
        /// Parameter `mediaType`: The media type, such as AVMediaTypeVideo, AVMediaTypeAudio, or AVMediaTypeMuxed, supported by the returned device.
        ///
        /// Returns: The default device with the given media type, or nil if no device with that media type exists.
        ///
        ///
        /// This method returns the default device of the given media type currently available on the system. For example, for AVMediaTypeVideo, this method will return the built in camera that is primarily used for capture and recording. Media type constants are defined in AVMediaFormat.h.
        #[unsafe(method(defaultDeviceWithMediaType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn defaultDeviceWithMediaType(
            media_type: &AVMediaType,
        ) -> Option<Retained<AVCaptureDevice>>;

        /// Returns an AVCaptureDevice instance with the given unique ID.
        ///
        ///
        /// Parameter `deviceUniqueID`: The unique ID of the device instance to be returned.
        ///
        /// Returns: An AVCaptureDevice instance with the given unique ID, or nil if no device with that unique ID is available.
        ///
        ///
        /// Every available capture device has a unique ID that persists on one system across device connections and disconnections, application restarts, and reboots of the system itself. This method can be used to recall or track the status of a specific device whose unique ID has previously been saved.
        #[unsafe(method(deviceWithUniqueID:))]
        #[unsafe(method_family = none)]
        pub unsafe fn deviceWithUniqueID(
            device_unique_id: &NSString,
        ) -> Option<Retained<AVCaptureDevice>>;

        /// An ID unique to the model of device corresponding to the receiver.
        ///
        ///
        /// Every available capture device has a unique ID that persists on one system across device connections and disconnections, application restarts, and reboots of the system itself. Applications can store the value returned by this property to recall or track the status of a specific device in the future.
        #[unsafe(method(uniqueID))]
        #[unsafe(method_family = none)]
        pub unsafe fn uniqueID(&self) -> Retained<NSString>;

        /// The model ID of the receiver.
        ///
        ///
        /// The value of this property is an identifier unique to all devices of the same model. The value is persistent across device connections and disconnections, and across different systems. For example, the model ID of the camera built in to two identical iPhone models will be the same even though they are different physical devices.
        #[unsafe(method(modelID))]
        #[unsafe(method_family = none)]
        pub unsafe fn modelID(&self) -> Retained<NSString>;

        /// A localized human-readable name for the receiver.
        ///
        ///
        /// This property can be used for displaying the name of a capture device in a user interface.
        #[unsafe(method(localizedName))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizedName(&self) -> Retained<NSString>;

        /// The human-readable manufacturer name for the receiver.
        ///
        ///
        /// This property can be used to identify capture devices from a particular manufacturer. All Apple devices return "Apple Inc.". Devices from third party manufacturers may return an empty string.
        #[unsafe(method(manufacturer))]
        #[unsafe(method_family = none)]
        pub unsafe fn manufacturer(&self) -> Retained<NSString>;

        /// The transport type of the receiver (e.g. USB, PCI, etc).
        ///
        ///
        /// This property can be used to discover the transport type of a capture device. Transport types are defined in
        /// <IOKit
        /// /audio/IOAudioTypes.h> as kIOAudioDeviceTransportType*.
        #[unsafe(method(transportType))]
        #[unsafe(method_family = none)]
        pub unsafe fn transportType(&self) -> i32;

        #[cfg(feature = "AVMediaFormat")]
        /// Returns whether the receiver provides media with the given media type.
        ///
        ///
        /// Parameter `mediaType`: A media type, such as AVMediaTypeVideo, AVMediaTypeAudio, or AVMediaTypeMuxed.
        ///
        /// Returns: YES if the device outputs the given media type, NO otherwise.
        ///
        ///
        /// Media type constants are defined in AVMediaFormat.h.
        #[unsafe(method(hasMediaType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn hasMediaType(&self, media_type: &AVMediaType) -> bool;

        /// Requests exclusive access to configure device hardware properties.
        ///
        ///
        /// Parameter `outError`: On return, if the device could not be locked, points to an NSError describing why the failure occurred.
        ///
        /// Returns: A BOOL indicating whether the device was successfully locked for configuration.
        ///
        ///
        /// In order to set hardware properties on an AVCaptureDevice, such as focusMode and exposureMode, clients must first acquire a lock on the device. Clients should only hold the device lock if they require settable device properties to remain unchanged. Holding the device lock unnecessarily may degrade capture quality in other applications sharing the device.
        #[unsafe(method(lockForConfiguration:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn lockForConfiguration(&self) -> Result<(), Retained<NSError>>;

        /// Release exclusive control over device hardware properties.
        ///
        ///
        /// This method should be called to match an invocation of lockForConfiguration: when an application no longer needs to keep device hardware properties from changing automatically.
        #[unsafe(method(unlockForConfiguration))]
        #[unsafe(method_family = none)]
        pub unsafe fn unlockForConfiguration(&self);

        #[cfg(feature = "AVCaptureSessionPreset")]
        /// Returns whether the receiver can be used in an AVCaptureSession configured with the given preset.
        ///
        ///
        /// Parameter `preset`: An AVCaptureSession preset.
        ///
        /// Returns: YES if the receiver can be used with the given preset, NO otherwise.
        ///
        ///
        /// An AVCaptureSession instance can be associated with a preset that configures its inputs and outputs to fulfill common use cases. This method can be used to determine if the receiver can be used in a capture session with the given preset. Presets are defined in AVCaptureSession.h.
        #[unsafe(method(supportsAVCaptureSessionPreset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportsAVCaptureSessionPreset(
            &self,
            preset: &AVCaptureSessionPreset,
        ) -> bool;

        /// Indicates whether the device is connected and available to the system.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the device represented by the receiver is connected and available for use as a capture device. Clients can key value observe the value of this property to be notified when a device is no longer available. When the value of this property becomes NO for a given instance, it will not become YES again. If the same physical device again becomes available to the system, it will be represented using a new instance of AVCaptureDevice.
        #[unsafe(method(isConnected))]
        #[unsafe(method_family = none)]
        pub unsafe fn isConnected(&self) -> bool;

        /// Indicates whether the device is in use by another application.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the device represented by the receiver is in use by another application. Clients can key value observe the value of this property to be notified when another app starts or stops using this device.
        #[unsafe(method(isInUseByAnotherApplication))]
        #[unsafe(method_family = none)]
        pub unsafe fn isInUseByAnotherApplication(&self) -> bool;

        /// Indicates whether the device is suspended.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the device represented by the receiver is currently suspended. Some devices disallow data capture due to a feature on the device. For example, isSuspended returns YES for the external iSight when its privacy iris is closed, or for the internal iSight on a notebook when the notebook's display is closed. Clients can key value observe the value of this property to be notified when the device becomes suspended or unsuspended.
        #[unsafe(method(isSuspended))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSuspended(&self) -> bool;

        /// An array of AVCaptureDevice objects physically linked to the receiver.
        ///
        ///
        /// The value of this property is an array of AVCaptureDevice objects that are a part of the same physical device as the receiver. For example, for the external iSight camera, linkedDevices returns an array containing an AVCaptureDevice for the external iSight microphone.
        #[unsafe(method(linkedDevices))]
        #[unsafe(method_family = none)]
        pub unsafe fn linkedDevices(&self) -> Retained<NSArray<AVCaptureDevice>>;

        /// An array of AVCaptureDeviceFormat objects supported by the receiver.
        ///
        ///
        /// This property can be used to enumerate the formats natively supported by the receiver. The capture device's activeFormat property may be set to one of the formats in this array. Clients can observe automatic changes to the receiver's formats by key value observing this property.
        #[unsafe(method(formats))]
        #[unsafe(method_family = none)]
        pub unsafe fn formats(&self) -> Retained<NSArray<AVCaptureDeviceFormat>>;

        /// The currently active format of the receiver.
        ///
        ///
        /// This property can be used to get or set the currently active device format.
        ///
        /// -setActiveFormat: throws an NSInvalidArgumentException if set to a format not present in the formats array.
        ///
        /// -setActiveFormat: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
        ///
        /// Clients can observe automatic changes to the receiver's activeFormat by key value observing this property.
        ///
        /// On iOS, use of AVCaptureDevice's setActiveFormat: and AVCaptureSession's setSessionPreset: are mutually exclusive. If you set a capture device's active format, the session to which it is attached changes its preset to AVCaptureSessionPresetInputPriority. Likewise if you set the AVCaptureSession's sessionPreset property, the session assumes control of its input devices, and configures their activeFormat appropriately. Note that audio devices do not expose any user-configurable formats on iOS. To configure audio input on iOS, you should use the AVAudioSession APIs instead (see AVAudioSession.h).
        ///
        /// The activeFormat, activeVideoMinFrameDuration, and activeVideoMaxFrameDuration properties may be set simultaneously by using AVCaptureSession's begin/commitConfiguration methods:
        ///
        /// [session beginConfiguration]; // the session to which the receiver's AVCaptureDeviceInput is added.
        /// if ( [device lockForConfiguration:
        /// &error
        /// ] ) {
        /// [device setActiveFormat:newFormat];
        /// [device setActiveVideoMinFrameDuration:newMinDuration];
        /// [device setActiveVideoMaxFrameDuration:newMaxDuration];
        /// [device unlockForConfiguration];
        /// }
        /// [session commitConfiguration]; // The new format and frame rates are applied together in commitConfiguration
        ///
        /// Note that when configuring a session to use an active format intended for high resolution still photography and applying one or more of the following operations to an AVCaptureVideoDataOutput, the system may not meet the target framerate: zoom, orientation changes, format conversion.
        #[unsafe(method(activeFormat))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeFormat(&self) -> Retained<AVCaptureDeviceFormat>;

        /// Setter for [`activeFormat`][Self::activeFormat].
        #[unsafe(method(setActiveFormat:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActiveFormat(&self, active_format: &AVCaptureDeviceFormat);

        #[cfg(feature = "objc2-core-media")]
        /// A property indicating the receiver's current active minimum frame duration (the reciprocal of its max frame rate).
        ///
        ///
        /// An AVCaptureDevice's activeVideoMinFrameDuration property is the reciprocal of its active maximum frame rate. To limit the max frame rate of the capture device, clients may set this property to a value supported by the receiver's activeFormat (see AVCaptureDeviceFormat's videoSupportedFrameRateRanges property). Clients may set this property's value to kCMTimeInvalid to return activeVideoMinFrameDuration to its default value for the given activeFormat.
        ///
        /// -setActiveVideoMinFrameDuration: throws an NSInvalidArgumentException if set to an unsupported value.
        ///
        /// -setActiveVideoMinFrameDuration: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
        ///
        /// Clients can observe automatic changes to the receiver's activeVideoMinFrameDuration by key value observing this property.
        ///
        /// On iOS, the receiver's activeVideoMinFrameDuration resets to its default value under the following conditions:
        /// - The receiver's activeFormat changes
        /// - The receiver's AVCaptureDeviceInput's session's sessionPreset changes
        /// - The receiver's AVCaptureDeviceInput is added to a session
        ///
        /// When exposureMode is AVCaptureExposureModeCustom, setting the activeVideoMinFrameDuration affects max frame rate, but not exposureDuration. You may use setExposureModeCustomWithDuration:ISO:completionHandler: to set a shorter exposureDuration than your activeVideoMinFrameDuration, if desired.
        ///
        /// When autoVideoFrameRateEnabled is true, setting activeVideoMinFrameDuration throws an NSInvalidArgumentException.
        #[unsafe(method(activeVideoMinFrameDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeVideoMinFrameDuration(&self) -> CMTime;

        #[cfg(feature = "objc2-core-media")]
        /// Setter for [`activeVideoMinFrameDuration`][Self::activeVideoMinFrameDuration].
        #[unsafe(method(setActiveVideoMinFrameDuration:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActiveVideoMinFrameDuration(
            &self,
            active_video_min_frame_duration: CMTime,
        );

        #[cfg(feature = "objc2-core-media")]
        /// A property indicating the receiver's current active maximum frame duration (the reciprocal of its min frame rate).
        ///
        ///
        /// An AVCaptureDevice's activeVideoMaxFrameDuration property is the reciprocal of its active minimum frame rate. To limit the min frame rate of the capture device, clients may set this property to a value supported by the receiver's activeFormat (see AVCaptureDeviceFormat's videoSupportedFrameRateRanges property). Clients may set this property's value to kCMTimeInvalid to return activeVideoMaxFrameDuration to its default value for the given activeFormat.
        ///
        /// -setActiveVideoMaxFrameDuration: throws an NSInvalidArgumentException if set to an unsupported value.
        ///
        /// -setActiveVideoMaxFrameDuration: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
        ///
        /// Clients can observe automatic changes to the receiver's activeVideoMaxFrameDuration by key value observing this property.
        ///
        /// On iOS, the receiver's activeVideoMaxFrameDuration resets to its default value under the following conditions:
        /// - The receiver's activeFormat changes
        /// - The receiver's AVCaptureDeviceInput's session's sessionPreset changes
        /// - The receiver's AVCaptureDeviceInput is added to a session
        ///
        /// When exposureMode is AVCaptureExposureModeCustom, frame rate and exposure duration are interrelated. If you call setExposureModeCustomWithDuration:ISO:completionHandler: with an exposureDuration longer than the current activeVideoMaxFrameDuration, the activeVideoMaxFrameDuration will be lengthened to accommodate the longer exposure time. Setting a shorter exposure duration does not automatically change the activeVideoMinFrameDuration or activeVideoMaxFrameDuration. To explicitly increase the frame rate in custom exposure mode, you must set the activeVideoMaxFrameDuration to a shorter value. If your new max frame duration is shorter than the current exposureDuration, the exposureDuration will shorten as well to accommodate the new frame rate.
        ///
        /// When autoVideoFrameRateEnabled is true, setting activeVideoMaxFrameDuration throws an NSInvalidArgumentException.
        #[unsafe(method(activeVideoMaxFrameDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeVideoMaxFrameDuration(&self) -> CMTime;

        #[cfg(feature = "objc2-core-media")]
        /// Setter for [`activeVideoMaxFrameDuration`][Self::activeVideoMaxFrameDuration].
        #[unsafe(method(setActiveVideoMaxFrameDuration:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActiveVideoMaxFrameDuration(
            &self,
            active_video_max_frame_duration: CMTime,
        );

        /// Whether the device's video frame rate (expressed as a duration) is currently locked.
        ///
        /// Returns `true` when an ``AVCaptureDeviceInput`` associated with the device has its ``AVCaptureDeviceInput/activeLockedVideoFrameDuration`` property set to something other than `kCMTimeInvalid`. See ``AVCaptureDeviceInput/activeLockedVideoFrameDuration`` for more information on video frame duration locking.
        #[unsafe(method(isVideoFrameDurationLocked))]
        #[unsafe(method_family = none)]
        pub unsafe fn isVideoFrameDurationLocked(&self) -> bool;

        #[cfg(feature = "objc2-core-media")]
        /// The maximum frame rate (expressed as a minimum duration) that can be set on an input associated with this device.
        ///
        /// `kCMTimeInvalid` is returned when the device or its current configuration does not support locked frame rate. Use ``AVCaptureDeviceInput/activeLockedVideoFrameDuration`` to set the locked frame rate on the input.
        #[unsafe(method(minSupportedLockedVideoFrameDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn minSupportedLockedVideoFrameDuration(&self) -> CMTime;

        /// Whether the device is following an external sync device.
        ///
        /// See ``AVCaptureDeviceInput/followExternalSyncDevice:videoFrameDuration:delegate:`` for more information on external sync.
        #[unsafe(method(isFollowingExternalSyncDevice))]
        #[unsafe(method_family = none)]
        pub unsafe fn isFollowingExternalSyncDevice(&self) -> bool;

        #[cfg(feature = "objc2-core-media")]
        /// The minimum frame duration that can be passed as the `videoFrameDuration` when directing your device input to follow an external sync device.
        ///
        /// Use this property as the minimum allowable frame duration to pass to ``AVCaptureDeviceInput/follow:externalSyncDevice:videoFrameDuration:delegate:`` when you want to follow an external sync device. This property returns `kCMTimeInvalid` when the device's' current configuration does not support external sync device following.
        #[unsafe(method(minSupportedExternalSyncFrameDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn minSupportedExternalSyncFrameDuration(&self) -> CMTime;

        /// Indicates whether the receiver should enable auto video frame rate.
        ///
        /// When you enable this property, the device automatically adjusts the active frame rate, depending on light level. Under low light conditions, it decreases the frame rate to properly expose the scene. For formats with a maximum frame rate of 30 fps, the device switches the frame rate between 30 - 24. For formats with a maximum frame rate of 60 fps, the device switches the frame rate between 60 - 30 - 24.
        ///
        /// Setting this property throws an `NSInvalidArgumentException` if the active format's ``AVCaptureDeviceFormat/autoVideoFrameRateSupported`` returns `false`. When you change the device's active format, this property resets to its default value of `false`.
        ///
        /// If you set this property to `true`, frame rate is under device control, and you may not set ``activeVideoMinFrameDuration`` or ``activeVideoMaxFrameDuration``. Doing so throws an `NSInvalidArgumentException`.
        ///
        /// - Note: Setting this property to `true` throws an `NSInvalidArgumentException` if ``videoFrameDurationLocked`` or ``followingExternalSyncDevice`` are `true`.
        #[unsafe(method(isAutoVideoFrameRateEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isAutoVideoFrameRateEnabled(&self) -> bool;

        /// Setter for [`isAutoVideoFrameRateEnabled`][Self::isAutoVideoFrameRateEnabled].
        #[unsafe(method(setAutoVideoFrameRateEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAutoVideoFrameRateEnabled(&self, auto_video_frame_rate_enabled: bool);

        /// An array of AVCaptureDeviceInputSource objects supported by the receiver.
        ///
        ///
        /// Some devices can capture data from one of multiple data sources (different input jacks on the same audio device, for example). For devices with multiple possible data sources, inputSources can be used to enumerate the possible choices. Clients can observe automatic changes to the receiver's inputSources by key value observing this property.
        #[unsafe(method(inputSources))]
        #[unsafe(method_family = none)]
        pub unsafe fn inputSources(&self) -> Retained<NSArray<AVCaptureDeviceInputSource>>;

        /// The currently active input source of the receiver.
        ///
        ///
        /// This property can be used to get or set the currently active device input source. -setActiveInputSource: throws an NSInvalidArgumentException if set to a value not present in the inputSources array. -setActiveInputSource: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's activeInputSource by key value observing this property.
        #[unsafe(method(activeInputSource))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeInputSource(&self) -> Option<Retained<AVCaptureDeviceInputSource>>;

        /// Setter for [`activeInputSource`][Self::activeInputSource].
        #[unsafe(method(setActiveInputSource:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActiveInputSource(
            &self,
            active_input_source: Option<&AVCaptureDeviceInputSource>,
        );
    );
}

/// Constants indicating the physical position of an AVCaptureDevice's hardware on the system.
///
///
/// Indicates that the device's position relative to the system hardware is unspecified.
///
/// Indicates that the device is physically located on the back of the system hardware.
///
/// Indicates that the device is physically located on the front of the system hardware.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedeviceposition?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureDevicePosition(pub NSInteger);
impl AVCaptureDevicePosition {
    #[doc(alias = "AVCaptureDevicePositionUnspecified")]
    pub const Unspecified: Self = Self(0);
    #[doc(alias = "AVCaptureDevicePositionBack")]
    pub const Back: Self = Self(1);
    #[doc(alias = "AVCaptureDevicePositionFront")]
    pub const Front: Self = Self(2);
}

unsafe impl Encode for AVCaptureDevicePosition {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureDevicePosition {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// AVCaptureDevicePosition.
impl AVCaptureDevice {
    extern_methods!(
        /// Indicates the physical position of an AVCaptureDevice's hardware on the system.
        ///
        ///
        /// The value of this property is an AVCaptureDevicePosition indicating where the receiver's device is physically located on the system hardware.
        #[unsafe(method(position))]
        #[unsafe(method_family = none)]
        pub unsafe fn position(&self) -> AVCaptureDevicePosition;
    );
}

/// AVCaptureDeviceType string constants
///
///
/// The AVCaptureDeviceType string constants are intended to be used in combination with the AVCaptureDeviceDiscoverySession class to obtain a list of devices matching certain search criteria.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetype?language=objc)
// NS_TYPED_ENUM
pub type AVCaptureDeviceType = NSString;

extern "C" {
    /// An external device type. On iPad, external devices are those that conform to the UVC (USB Video Class) specification.
    ///
    ///
    /// Starting in Mac Catalyst 17.0, apps may opt in for using AVCaptureDeviceTypeExternal by adding the following key to their Info.plist:
    /// <key
    /// >NSCameraUseExternalDeviceType
    /// </key
    /// >
    /// <true
    /// />
    /// Otherwise, external cameras on Mac Catalyst report that their device type is AVCaptureDeviceTypeBuiltInWideAngleCamera.
    ///
    /// Prior to visionOS 3.0, your app must have the `com.apple.developer.avfoundation.uvc-device-access` entitlement in order to discover and use devices of type `AVCaptureDeviceTypeExternal` on visionOS.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypeexternal?language=objc)
    pub static AVCaptureDeviceTypeExternal: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A microphone. On iOS and tvOS, only one AVCaptureDevice of type AVCaptureDeviceTypeMicrophone is exposed to the system. The audio routing subsystem decides which physical microphone to use, be it a built in microphone, a wired headset, an external microphone, etc. The microphone device's `localizedName` will change as the audio subsystem switches to a different physical device.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypemicrophone?language=objc)
    pub static AVCaptureDeviceTypeMicrophone: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A built-in wide angle camera device. These devices are suitable for general purpose use.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltinwideanglecamera?language=objc)
    pub static AVCaptureDeviceTypeBuiltInWideAngleCamera: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A built-in camera device with a longer focal length than a wide angle camera. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltintelephotocamera?language=objc)
    pub static AVCaptureDeviceTypeBuiltInTelephotoCamera: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A built-in camera device with a shorter focal length than a wide angle camera. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltinultrawidecamera?language=objc)
    pub static AVCaptureDeviceTypeBuiltInUltraWideCamera: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A device that consists of two fixed focal length cameras, one wide and one telephoto. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
    ///
    /// A device of this device type supports the following features:
    /// - Auto switching from one camera to the other when zoom factor, light level, and focus position allow this.
    /// - Higher quality zoom for still captures by fusing images from both cameras.
    /// - Depth data delivery by measuring the disparity of matched features between the wide and telephoto cameras.
    /// - Delivery of photos from constituent devices (wide and telephoto cameras) via a single photo capture request.
    ///
    /// A device of this device type does not support the following features:
    /// - AVCaptureExposureModeCustom and manual exposure bracketing.
    /// - Locking focus with a lens position other than AVCaptureLensPositionCurrent.
    /// - Locking auto white balance with device white balance gains other than AVCaptureWhiteBalanceGainsCurrent.
    ///
    /// Even when locked, exposure duration, ISO, aperture, white balance gains, or lens position may change when the device switches from one camera to the other. The overall exposure, white balance, and focus position however should be consistent.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltindualcamera?language=objc)
    pub static AVCaptureDeviceTypeBuiltInDualCamera: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A device that consists of two fixed focal length cameras, one ultra wide and one wide angle. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
    ///
    /// A device of this device type supports the following features:
    /// - Auto switching from one camera to the other when zoom factor, light level, and focus position allow this.
    /// - Depth data delivery by measuring the disparity of matched features between the ultra wide and wide cameras.
    /// - Delivery of photos from constituent devices (ultra wide and wide) via a single photo capture request.
    ///
    /// A device of this device type does not support the following features:
    /// - AVCaptureExposureModeCustom and manual exposure bracketing.
    /// - Locking focus with a lens position other than AVCaptureLensPositionCurrent.
    /// - Locking auto white balance with device white balance gains other than AVCaptureWhiteBalanceGainsCurrent.
    ///
    /// Even when locked, exposure duration, ISO, aperture, white balance gains, or lens position may change when the device switches from one camera to the other. The overall exposure, white balance, and focus position however should be consistent.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltindualwidecamera?language=objc)
    pub static AVCaptureDeviceTypeBuiltInDualWideCamera: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A device that consists of three fixed focal length cameras, one ultra wide, one wide angle, and one telephoto. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
    ///
    /// A device of this device type supports the following features:
    /// - Auto switching from one camera to the other when zoom factor, light level, and focus position allow this.
    /// - Delivery of photos from constituent devices (ultra wide, wide and telephoto cameras) via a single photo capture request.
    ///
    /// A device of this device type does not support the following features:
    /// - AVCaptureExposureModeCustom and manual exposure bracketing.
    /// - Locking focus with a lens position other than AVCaptureLensPositionCurrent.
    /// - Locking auto white balance with device white balance gains other than AVCaptureWhiteBalanceGainsCurrent.
    ///
    /// Even when locked, exposure duration, ISO, aperture, white balance gains, or lens position may change when the device switches from one camera to the other. The overall exposure, white balance, and focus position however should be consistent.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltintriplecamera?language=objc)
    pub static AVCaptureDeviceTypeBuiltInTripleCamera: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A device that consists of two cameras, one YUV and one Infrared. The infrared camera provides high quality depth information that is synchronized and perspective corrected to frames produced by the YUV camera. While the resolution of the depth data and YUV frames may differ, their field of view and aspect ratio always match. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltintruedepthcamera?language=objc)
    pub static AVCaptureDeviceTypeBuiltInTrueDepthCamera: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A device that consists of two cameras, one YUV and one LiDAR. The LiDAR camera provides high quality, high accuracy depth information by measuring the round trip of an artificial light signal emitted by a laser. The depth is synchronized and perspective corrected to frames produced by the paired YUV camera. While the resolution of the depth data and YUV frames may differ, their field of view and aspect ratio always match. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltinlidardepthcamera?language=objc)
    pub static AVCaptureDeviceTypeBuiltInLiDARDepthCamera: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A continuity camera device. These devices are suitable for general purpose use. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
    ///
    ///
    /// Starting in macOS 14.0 and Mac Catalyst 17.0, apps may opt in for using AVCaptureDeviceTypeContinuityCamera by adding the following key to their Info.plist:
    /// <key
    /// >NSCameraUseContinuityCameraDeviceType
    /// </key
    /// >
    /// <true
    /// />
    ///
    /// Otherwise, continuity cameras on macOS and Mac Catalyst report that their device type is AVCaptureDeviceTypeBuiltInWideAngleCamera.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypecontinuitycamera?language=objc)
    pub static AVCaptureDeviceTypeContinuityCamera: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A distortion corrected cut out from an ultra wide camera, made to approximate an overhead camera pointing at a desk. Supports multicam operation.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypedeskviewcamera?language=objc)
    pub static AVCaptureDeviceTypeDeskViewCamera: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A deprecated synonym for AVCaptureDeviceTypeExternal. Please use AVCaptureDeviceTypeExternal instead.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypeexternalunknown?language=objc)
    #[deprecated]
    pub static AVCaptureDeviceTypeExternalUnknown: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A deprecated synonym for AVCaptureDeviceTypeBuiltInDualCamera. Please use AVCaptureDeviceTypeBuiltInDualCamera instead.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltinduocamera?language=objc)
    #[deprecated = "Use AVCaptureDeviceTypeBuiltInDualCamera instead."]
    pub static AVCaptureDeviceTypeBuiltInDuoCamera: &'static AVCaptureDeviceType;
}

extern "C" {
    /// A deprecated synonym for AVCaptureDeviceTypeMicrophone. Please use AVCaptureDeviceTypeMicrophone instead.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltinmicrophone?language=objc)
    #[deprecated]
    pub static AVCaptureDeviceTypeBuiltInMicrophone: &'static AVCaptureDeviceType;
}

/// AVCaptureDeviceType.
impl AVCaptureDevice {
    extern_methods!(
        /// The type of the capture device.
        ///
        ///
        /// A capture device's type never changes.
        #[unsafe(method(deviceType))]
        #[unsafe(method_family = none)]
        pub unsafe fn deviceType(&self) -> Retained<AVCaptureDeviceType>;
    );
}

/// AVCaptureDefaultDevice.
impl AVCaptureDevice {
    extern_methods!(
        #[cfg(feature = "AVMediaFormat")]
        /// Returns an AVCaptureDevice instance for the default device of the given device type, media type, and position.
        ///
        ///
        /// Parameter `deviceType`: The device type supported by the returned device. It must be a valid AVCaptureDeviceType.
        ///
        /// Parameter `mediaType`: The media type, such as AVMediaTypeVideo, AVMediaTypeAudio, or AVMediaTypeMuxed, supported by the returned device. Pass nil to consider devices with any media type.
        ///
        /// Parameter `position`: The position supported by the returned device. Pass AVCaptureDevicePositionUnspecified to consider devices with any position.
        ///
        /// Returns: The default device with the given device type, media type and position or nil if no device with that media type exists and nil otherwise.
        ///
        ///
        /// This method returns the default device of the given combination of device type, media type, and position currently available on the system.
        #[unsafe(method(defaultDeviceWithDeviceType:mediaType:position:))]
        #[unsafe(method_family = none)]
        pub unsafe fn defaultDeviceWithDeviceType_mediaType_position(
            device_type: &AVCaptureDeviceType,
            media_type: Option<&AVMediaType>,
            position: AVCaptureDevicePosition,
        ) -> Option<Retained<AVCaptureDevice>>;
    );
}

/// AVCaptureDevicePreferredCamera.
impl AVCaptureDevice {
    extern_methods!(
        /// Settable property that specifies a user preferred camera.
        ///
        ///
        /// Setting this property allows an application to persist its user’s preferred camera across app launches and reboots. The property internally maintains a short history, so if your user’s most recent preferred camera is not currently connected, it still reports the next best choice. This property always returns a device that is present. If no camera is available nil is returned. Setting the property to nil has no effect.
        #[unsafe(method(userPreferredCamera))]
        #[unsafe(method_family = none)]
        pub unsafe fn userPreferredCamera() -> Option<Retained<AVCaptureDevice>>;

        /// Setter for [`userPreferredCamera`][Self::userPreferredCamera].
        #[unsafe(method(setUserPreferredCamera:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUserPreferredCamera(user_preferred_camera: Option<&AVCaptureDevice>);

        /// Specifies the best camera to use as determined by the system.
        ///
        ///
        /// Apple chooses the default value. This property incorporates userPreferredCamera as well as other factors, such as camera suspension and Apple cameras appearing that should be automatically chosen. The property may change spontaneously, such as when the preferred camera goes away. This property always returns a device that is present. If no camera is available nil is returned.
        ///
        /// Applications that adopt this API should always key-value observe this property and update their AVCaptureSession’s input device to reflect changes to the systemPreferredCamera. The application can still offer users the ability to pick a camera by setting userPreferredCamera, which will cause the systemPreferredCamera API to put the user’s choice first until either another Apple-preferred device becomes available or the machine is rebooted (after which it reverts to its original behavior of returning the internally determined best camera to use).
        ///
        /// If the application wishes to offer users a fully manual camera selection mode in addition to automatic camera selection, it is recommended to call setUserPreferredCamera: each time the user makes a camera selection, but ignore key-value observer updates to systemPreferredCamera while in manual selection mode.
        #[unsafe(method(systemPreferredCamera))]
        #[unsafe(method_family = none)]
        pub unsafe fn systemPreferredCamera() -> Option<Retained<AVCaptureDevice>>;
    );
}

/// AVCaptureDeviceSystemPressure.
impl AVCaptureDevice {
    extern_methods!(
        #[cfg(feature = "AVCaptureSystemPressure")]
        /// A key-value observable property indicating the capture device's current system pressure state.
        ///
        ///
        /// This property indicates whether the capture device is currently subject to an elevated system pressure condition. When system pressure reaches AVCaptureSystemPressureLevelShutdown, the capture device cannot continue to provide input, so the AVCaptureSession becomes interrupted until the pressured state abates. System pressure can be effectively mitigated by lowering the device's activeVideoMinFrameDuration in response to changes in the systemPressureState. Clients are encouraged to implement frame rate throttling to bring system pressure down if their capture use case can tolerate a reduced frame rate.
        #[unsafe(method(systemPressureState))]
        #[unsafe(method_family = none)]
        pub unsafe fn systemPressureState(&self) -> Retained<AVCaptureSystemPressureState>;
    );
}

/// These constants can be used to control when the virtual device is allowed to switch the active primary constituent device.
///
///
/// Indicates that the device does not support constituent device switching. This is reported for cameras that do not have more than one constituent device.
///
/// Automatically select the best camera for the current scene. In this mode there are no restrictions on when a camera switch can occur.
///
/// Restrict fallback camera selection to certain conditions (see AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions). Camera switches necessary to satisfy the requested video zoom factor are still allowed without restriction.
///
/// Lock camera switching to the active primary constituent device. Note that this restricts the minAvailableVideoZoomFactor to the switch-over zoom factor of the activePrimaryConstituentDevice (as reported in AVCaptureDevice.virtualDeviceSwitchOverVideoZoomFactors).
///
///
/// Virtual devices with multiple constituent video devices (such as the Dual Camera, Dual Wide Camera, or Triple Camera), consist of cameras that each have different properties such as focal length, maximum light sensitivity, and minimum focus distance. One of the constituent video devices is selected as the primary constituent device. For an AVCaptureSession, the primary constituent device produces for all outputs. For an AVCaptureMultiCamSession, the primary constituent device produces for all outputs connected to the virtual device's native AVCaptureDeviceInputPort (where its sourceDeviceType is equal to the virtual device's deviceType).
///
/// When the requested zoom factor can be achieved by multiple constituent cameras (see -virtualDeviceSwitchOverVideoZoomFactors), the virtual device chooses the best camera for the scene. The primary condition for this is the focal length; the camera with the longest focal length requires the least amount of digital upscaling and therefore normally provides the highest image quality. Secondary conditions are focus and exposure; when the scene requires focus or exposure to go beyond the limits of the active primary constituent device, a camera with a shorter focal length may be able to deliver a better quality image. Such a device is called a fallback primary constituent device. For example, a telephoto camera with a minimum focus distance of 40cm is not able to deliver a sharp image when the subject in the scene is closer than 40cm. For such a scene, the virtual device will switch to the wide-angle camera which typically has a smaller minimum focus distance and is able to achieve accurate focus on the subject. In this case the wide-angle camera is the fallback primary constitute device.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureprimaryconstituentdeviceswitchingbehavior?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCapturePrimaryConstituentDeviceSwitchingBehavior(pub NSInteger);
impl AVCapturePrimaryConstituentDeviceSwitchingBehavior {
    #[doc(alias = "AVCapturePrimaryConstituentDeviceSwitchingBehaviorUnsupported")]
    pub const Unsupported: Self = Self(0);
    #[doc(alias = "AVCapturePrimaryConstituentDeviceSwitchingBehaviorAuto")]
    pub const Auto: Self = Self(1);
    #[doc(alias = "AVCapturePrimaryConstituentDeviceSwitchingBehaviorRestricted")]
    pub const Restricted: Self = Self(2);
    #[doc(alias = "AVCapturePrimaryConstituentDeviceSwitchingBehaviorLocked")]
    pub const Locked: Self = Self(3);
}

unsafe impl Encode for AVCapturePrimaryConstituentDeviceSwitchingBehavior {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCapturePrimaryConstituentDeviceSwitchingBehavior {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// These constants can be used and combined to control the conditions that allow fallback camera selection when the primaryConstituentDeviceSelectionBehavior is set to AVCapturePrimaryConstituentDeviceSwitchingBehaviorRestricted. Note that camera switching necessary to satisfy the requested zoom factor is still allowed.
///
///
/// Disallow fallback switching.
///
/// Restrict fallback camera switching to when the video zoom factor changes, either through AVCaptureDevice.videoZoomFactor or -[AVCaptureDevice rampToVideoZoomFactor:withRate:]. Note that any change in video zoom factor will allow a switch to a fallback camera, not just changes across switch-over zoom factors.
///
/// Restrict fallback camera switches to when AVCaptureDevice.focusMode is set.
///
/// Restrict fallback camera switches to when AVCaptureDevice.exposureMode is set.
///
///
/// Whenever triggered by one or more of the enabled conditions, the fallback camera switching waits for exposure and focus to stabilize before deciding which camera to use as the primary constituent device.
///
/// Whenever AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionVideoZoomChanged is not included in the restricted switching behavior conditions, AVCapturePrimaryConstituentDeviceSwitchingBehaviorRestricted still allows camera selection when a change in video zoom factor makes a camera eligible or ineligible to be selected as the activePrimaryConstituentDevice. When the video zoom factor decreases to below the switch-over zoom factor of the activePrimaryConstituentDevice, a different camera will be selected to satisfy the requested zoom factor. When the video zoom factor increases and crosses a camera's switch-over zoom factor, this camera becomes eligible to be selected as the activePrimaryConstituentDevice. If exposure and focus allow, this camera then becomes the new activePrimaryConstituentDevice. Similar to the AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionVideoZoomChanged this also waits for exposure and focus to stabilize. Otherwise the activePrimaryConstituentDevice remains unchanged.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureprimaryconstituentdevicerestrictedswitchingbehaviorconditions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions(pub NSUInteger);
bitflags::bitflags! {
    impl AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions: NSUInteger {
        #[doc(alias = "AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionNone")]
        const None = 0;
        #[doc(alias = "AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionVideoZoomChanged")]
        const VideoZoomChanged = 1<<0;
        #[doc(alias = "AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionFocusModeChanged")]
        const FocusModeChanged = 1<<1;
        #[doc(alias = "AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionExposureModeChanged")]
        const ExposureModeChanged = 1<<2;
    }
}

unsafe impl Encode for AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// AVCaptureDeviceVirtual.
impl AVCaptureDevice {
    extern_methods!(
        /// A property indicating whether the receiver is a virtual device consisting of constituent physical devices.
        ///
        ///
        /// Two examples of virtual devices are:
        /// The Dual Camera, which supports seamlessly switching between a wide and telephoto camera while zooming and generating depth data from the disparities between the different points of view of the physical cameras.
        /// The TrueDepth Camera, which generates depth data from disparities between a YUV camera and an Infrared camera pointed in the same direction.
        #[unsafe(method(isVirtualDevice))]
        #[unsafe(method_family = none)]
        pub unsafe fn isVirtualDevice(&self) -> bool;

        /// An array of constituent physical devices comprising a virtual device.
        ///
        ///
        /// When called on a device for which virtualDevice == NO, an empty array is returned.
        #[unsafe(method(constituentDevices))]
        #[unsafe(method_family = none)]
        pub unsafe fn constituentDevices(&self) -> Retained<NSArray<AVCaptureDevice>>;

        /// An array of video zoom factors at or above which a virtual device (such as the Dual Camera) may switch to its next constituent device.
        ///
        ///
        /// This array contains zoom factors at which one of the constituent device's field of view matches the next constituent device's full field of view. The number of switch over video zoom factors is always one less than the count of the constituentDevices property, and the factors progress in the same order as the devices listed in that property. On non-virtual devices this property returns an empty array.
        #[unsafe(method(virtualDeviceSwitchOverVideoZoomFactors))]
        #[unsafe(method_family = none)]
        pub unsafe fn virtualDeviceSwitchOverVideoZoomFactors(&self)
            -> Retained<NSArray<NSNumber>>;

        /// The switching behavior and conditions, unless overwritten via -[AVCaptureMovieFileOutput setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions].
        ///
        /// Parameter `switchingBehavior`: The desired switching behavior.
        ///
        /// Parameter `restrictedSwitchingBehaviorConditions`: The desired conditions for restricting camera switching. This must be set to AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionNone whenever switchingBehavior is not equal to AVCapturePrimaryConstituentDeviceSwitchingBehaviorRestricted.
        ///
        ///
        /// The switching behavior may be overridden on the AVCaptureMovieFileOutput while recording (see -[AVCaptureMovieFileOutput setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions]). This method throws an NSInvalidArgumentException if constituent device switching is not supported by the receiver or if restrictedSwitchingBehaviorConditions is not equal to AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionNone and switchingBehavior is not equal to AVCapturePrimaryConstituentDeviceSwitchingBehaviorRestricted.
        #[unsafe(method(setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPrimaryConstituentDeviceSwitchingBehavior_restrictedSwitchingBehaviorConditions(
            &self,
            switching_behavior: AVCapturePrimaryConstituentDeviceSwitchingBehavior,
            restricted_switching_behavior_conditions: AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions,
        );

        /// The primaryConstituentDeviceSwitchingBehavior as set by -[AVCaptureDevice setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions:].
        ///
        ///
        /// By default, this property is set to AVCapturePrimaryConstituentDeviceSwitchingBehaviorAuto for AVCaptureDevices that support it.  This property is key-value observable.
        #[unsafe(method(primaryConstituentDeviceSwitchingBehavior))]
        #[unsafe(method_family = none)]
        pub unsafe fn primaryConstituentDeviceSwitchingBehavior(
            &self,
        ) -> AVCapturePrimaryConstituentDeviceSwitchingBehavior;

        /// The primaryConstituentDeviceRestrictedSwitchingBehaviorConditions as set by -[AVCaptureDevice setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions:].
        ///
        ///
        /// By default, this propety is set to AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionNone. This property is key-value observable.
        #[unsafe(method(primaryConstituentDeviceRestrictedSwitchingBehaviorConditions))]
        #[unsafe(method_family = none)]
        pub unsafe fn primaryConstituentDeviceRestrictedSwitchingBehaviorConditions(
            &self,
        ) -> AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions;

        /// The active constituent device switching behavior.
        ///
        ///
        /// For virtual devices with multiple constituent devices, this property returns the active switching behavior. This is equal to primaryConstituentDeviceSwitchingBehavior except while recording using an AVCaptureMovieFileOutput configured with a different switching behavior (see -[AVCaptureMovieFileOutput setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions]). Devices that do not support constituent device switching return AVCapturePrimaryConstituentDeviceSwitchingBehaviorUnsupported. This property is key-value observable.
        #[unsafe(method(activePrimaryConstituentDeviceSwitchingBehavior))]
        #[unsafe(method_family = none)]
        pub unsafe fn activePrimaryConstituentDeviceSwitchingBehavior(
            &self,
        ) -> AVCapturePrimaryConstituentDeviceSwitchingBehavior;

        /// The active constituent device restricted  switching behavior.
        ///
        ///
        /// For virtual devices with multiple constituent devices, this property returns the active restricted switching behavior conditions. This is equal to primaryConstituentDeviceRestrictedSwitchingBehaviorConditions except while recording using an AVCaptureMovieFileOutput configured with different restricted switching behavior conditions (see -[AVCaptureMovieFileOutput setPrimaryConstituentDeviceSwitchingBehaviorForRecording:restrictedSwitchingBehaviorConditions]). Devices that do not support constituent device switching return AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionNone. This property is key-value observable.
        #[unsafe(method(activePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions))]
        #[unsafe(method_family = none)]
        pub unsafe fn activePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions(
            &self,
        ) -> AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions;

        /// For virtual devices, this property indicates which constituent device is currently the primary constituent device. The primary constituent device may change when zoom, exposure, or focus changes.
        ///
        ///
        /// This property returns nil for non-virtual devices. On virtual devices this property returns nil until the device is used in a running AVCaptureSession. This property is key-value observable.
        #[unsafe(method(activePrimaryConstituentDevice))]
        #[unsafe(method_family = none)]
        pub unsafe fn activePrimaryConstituentDevice(&self) -> Option<Retained<AVCaptureDevice>>;

        /// The constituent devices that may be selected as a fallback for a longer focal length primary constituent device.
        ///
        ///
        /// This property returns an empty array for non-virtual devices. This property never changes for a given virtual device.
        #[unsafe(method(supportedFallbackPrimaryConstituentDevices))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportedFallbackPrimaryConstituentDevices(
            &self,
        ) -> Retained<NSArray<AVCaptureDevice>>;

        /// The constituent devices that may be used as a fallback device when a constituent device with a longer focal length becomes limited by its light sensitivity or minimum focus distance.
        ///
        ///
        /// This may only be set to the supportedFallbackPrimaryConstituentDevices or a subset thereof. By default this is set to all supportedFallbackPrimaryConstituentDevices. This property will throw an NSInvalidArgumentException if the array includes any device not reported in supportedFallbackPrimaryConstituentDevices. This property is key-value observable.
        #[unsafe(method(fallbackPrimaryConstituentDevices))]
        #[unsafe(method_family = none)]
        pub unsafe fn fallbackPrimaryConstituentDevices(
            &self,
        ) -> Retained<NSArray<AVCaptureDevice>>;

        /// Setter for [`fallbackPrimaryConstituentDevices`][Self::fallbackPrimaryConstituentDevices].
        #[unsafe(method(setFallbackPrimaryConstituentDevices:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFallbackPrimaryConstituentDevices(
            &self,
            fallback_primary_constituent_devices: &NSArray<AVCaptureDevice>,
        );
    );
}

/// Constants indicating the mode of the flash on the receiver's device, if it has one.
///
///
/// Indicates that the flash should always be off.
///
/// Indicates that the flash should always be on.
///
/// Indicates that the flash should be used automatically depending on ambient light conditions.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureflashmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureFlashMode(pub NSInteger);
impl AVCaptureFlashMode {
    #[doc(alias = "AVCaptureFlashModeOff")]
    pub const Off: Self = Self(0);
    #[doc(alias = "AVCaptureFlashModeOn")]
    pub const On: Self = Self(1);
    #[doc(alias = "AVCaptureFlashModeAuto")]
    pub const Auto: Self = Self(2);
}

unsafe impl Encode for AVCaptureFlashMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureFlashMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// AVCaptureDeviceFlash.
impl AVCaptureDevice {
    extern_methods!(
        /// Indicates whether the receiver has a flash.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver has a flash. The receiver's flashMode property can only be set when this property returns YES.
        #[unsafe(method(hasFlash))]
        #[unsafe(method_family = none)]
        pub unsafe fn hasFlash(&self) -> bool;

        /// Indicates whether the receiver's flash is currently available for use.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver's flash is currently available. The flash may become unavailable if, for example, the device overheats and needs to cool off. This property is key-value observable.
        #[unsafe(method(isFlashAvailable))]
        #[unsafe(method_family = none)]
        pub unsafe fn isFlashAvailable(&self) -> bool;

        /// Indicates whether the receiver's flash is currently active.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver's flash is currently active. When the flash is active, it will flash if a still image is captured. When a still image is captured with the flash active, exposure and white balance settings are overridden for the still. This is true even when using AVCaptureExposureModeCustom and/or AVCaptureWhiteBalanceModeLocked. This property is key-value observable.
        #[deprecated = "Use AVCapturePhotoOutput's -isFlashScene instead."]
        #[unsafe(method(isFlashActive))]
        #[unsafe(method_family = none)]
        pub unsafe fn isFlashActive(&self) -> bool;

        /// Returns whether the receiver supports the given flash mode.
        ///
        ///
        /// Parameter `flashMode`: An AVCaptureFlashMode to be checked.
        ///
        /// Returns: YES if the receiver supports the given flash mode, NO otherwise.
        ///
        ///
        /// The receiver's flashMode property can only be set to a certain mode if this method returns YES for that mode.
        #[deprecated = "Use AVCapturePhotoOutput's -supportedFlashModes instead."]
        #[unsafe(method(isFlashModeSupported:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isFlashModeSupported(&self, flash_mode: AVCaptureFlashMode) -> bool;

        /// Indicates current mode of the receiver's flash, if it has one.
        ///
        ///
        /// The value of this property is an AVCaptureFlashMode that determines the mode of the receiver's flash, if it has one. -setFlashMode: throws an NSInvalidArgumentException if set to an unsupported value (see -isFlashModeSupported:). -setFlashMode: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's flashMode by key value observing this property.
        ///
        /// When using AVCapturePhotoOutput, AVCaptureDevice's flashMode property is ignored. You specify flashMode on a per photo basis by setting the AVCapturePhotoSettings.flashMode property.
        #[deprecated = "Use AVCapturePhotoSettings.flashMode instead."]
        #[unsafe(method(flashMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn flashMode(&self) -> AVCaptureFlashMode;

        /// Setter for [`flashMode`][Self::flashMode].
        #[deprecated = "Use AVCapturePhotoSettings.flashMode instead."]
        #[unsafe(method(setFlashMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFlashMode(&self, flash_mode: AVCaptureFlashMode);
    );
}

/// Constants indicating the mode of the torch on the receiver's device, if it has one.
///
///
/// Indicates that the torch should always be off.
///
/// Indicates that the torch should always be on.
///
/// Indicates that the torch should be used automatically depending on ambient light conditions.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturetorchmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureTorchMode(pub NSInteger);
impl AVCaptureTorchMode {
    #[doc(alias = "AVCaptureTorchModeOff")]
    pub const Off: Self = Self(0);
    #[doc(alias = "AVCaptureTorchModeOn")]
    pub const On: Self = Self(1);
    #[doc(alias = "AVCaptureTorchModeAuto")]
    pub const Auto: Self = Self(2);
}

unsafe impl Encode for AVCaptureTorchMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureTorchMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C" {
    /// A special value that may be passed to -setTorchModeWithLevel:error: to set the torch to the maximum level currently available. Under thermal duress, the maximum available torch level may be less than 1.0.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturemaxavailabletorchlevel?language=objc)
    pub static AVCaptureMaxAvailableTorchLevel: c_float;
}

/// AVCaptureDeviceTorch.
impl AVCaptureDevice {
    extern_methods!(
        /// Indicates whether the receiver has a torch.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver has a torch. The receiver's torchMode property can only be set when this property returns YES.
        #[unsafe(method(hasTorch))]
        #[unsafe(method_family = none)]
        pub unsafe fn hasTorch(&self) -> bool;

        /// Indicates whether the receiver's torch is currently available for use.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver's torch is currently available. The torch may become unavailable if, for example, the device overheats and needs to cool off. This property is key-value observable.
        #[unsafe(method(isTorchAvailable))]
        #[unsafe(method_family = none)]
        pub unsafe fn isTorchAvailable(&self) -> bool;

        /// Indicates whether the receiver's torch is currently active.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver's torch is currently active. If the current torchMode is AVCaptureTorchModeAuto and isTorchActive is YES, the torch will illuminate once a recording starts (see AVCaptureOutput.h -startRecordingToOutputFileURL:recordingDelegate:). This property is key-value observable.
        #[unsafe(method(isTorchActive))]
        #[unsafe(method_family = none)]
        pub unsafe fn isTorchActive(&self) -> bool;

        /// Indicates the receiver's current torch brightness level as a floating point value.
        ///
        ///
        /// The value of this property is a float indicating the receiver's torch level from 0.0 (off) -> 1.0 (full). This property is key-value observable.
        #[unsafe(method(torchLevel))]
        #[unsafe(method_family = none)]
        pub unsafe fn torchLevel(&self) -> c_float;

        /// Returns whether the receiver supports the given torch mode.
        ///
        ///
        /// Parameter `torchMode`: An AVCaptureTorchMode to be checked.
        ///
        /// Returns: YES if the receiver supports the given torch mode, NO otherwise.
        ///
        ///
        /// The receiver's torchMode property can only be set to a certain mode if this method returns YES for that mode.
        #[unsafe(method(isTorchModeSupported:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isTorchModeSupported(&self, torch_mode: AVCaptureTorchMode) -> bool;

        /// Indicates current mode of the receiver's torch, if it has one.
        ///
        ///
        /// The value of this property is an AVCaptureTorchMode that determines the mode of the receiver's torch, if it has one. -setTorchMode: throws an NSInvalidArgumentException if set to an unsupported value (see -isTorchModeSupported:). -setTorchMode: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's torchMode by key value observing this property.
        #[unsafe(method(torchMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn torchMode(&self) -> AVCaptureTorchMode;

        /// Setter for [`torchMode`][Self::torchMode].
        #[unsafe(method(setTorchMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTorchMode(&self, torch_mode: AVCaptureTorchMode);

        /// Sets the current mode of the receiver's torch to AVCaptureTorchModeOn at the specified level.
        ///
        ///
        /// This method sets the torch mode to AVCaptureTorchModeOn at a specified level. torchLevel must be a value between 0 and 1, or the special value AVCaptureMaxAvailableTorchLevel. The specified value may not be available if the iOS device is too hot. This method throws an NSInvalidArgumentException if set to an unsupported level. If the specified level is valid, but unavailable, the method returns NO with AVErrorTorchLevelUnavailable. -setTorchModeOnWithLevel:error: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's torchMode by key value observing the torchMode property.
        #[unsafe(method(setTorchModeOnWithLevel:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTorchModeOnWithLevel_error(
            &self,
            torch_level: c_float,
        ) -> Result<(), Retained<NSError>>;
    );
}

/// Constants indicating the mode of the focus on the receiver's device, if it has one.
///
///
/// Indicates that the focus should be locked at the lens' current position.
///
/// Indicates that the device should autofocus once and then change the focus mode to AVCaptureFocusModeLocked.
///
/// Indicates that the device should automatically focus when needed.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturefocusmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureFocusMode(pub NSInteger);
impl AVCaptureFocusMode {
    #[doc(alias = "AVCaptureFocusModeLocked")]
    pub const Locked: Self = Self(0);
    #[doc(alias = "AVCaptureFocusModeAutoFocus")]
    pub const AutoFocus: Self = Self(1);
    #[doc(alias = "AVCaptureFocusModeContinuousAutoFocus")]
    pub const ContinuousAutoFocus: Self = Self(2);
}

unsafe impl Encode for AVCaptureFocusMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureFocusMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// Constants indicating the restriction of the receiver's autofocus system to a particular range of focus scan, if it supports range restrictions.
///
///
/// Indicates that the autofocus system should not restrict the focus range.
///
/// Indicates that the autofocus system should restrict the focus range for subject matter that is near to the camera.
///
/// Indicates that the autofocus system should restrict the focus range for subject matter that is far from the camera.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureautofocusrangerestriction?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureAutoFocusRangeRestriction(pub NSInteger);
impl AVCaptureAutoFocusRangeRestriction {
    #[doc(alias = "AVCaptureAutoFocusRangeRestrictionNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "AVCaptureAutoFocusRangeRestrictionNear")]
    pub const Near: Self = Self(1);
    #[doc(alias = "AVCaptureAutoFocusRangeRestrictionFar")]
    pub const Far: Self = Self(2);
}

unsafe impl Encode for AVCaptureAutoFocusRangeRestriction {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureAutoFocusRangeRestriction {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C" {
    /// A special value that may be passed as the lensPosition parameter of setFocusModeLockedWithLensPosition:completionHandler: to indicate that the caller does not wish to specify a value for the lensPosition property, and that it should instead be set to its current value. Note that the device may be adjusting lensPosition at the time of the call, in which case the value at which lensPosition is locked may differ from the value obtained by querying the lensPosition property.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturelenspositioncurrent?language=objc)
    pub static AVCaptureLensPositionCurrent: c_float;
}

/// Constants indicating the focus behavior when recording a Cinematic Video.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturecinematicvideofocusmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureCinematicVideoFocusMode(pub NSInteger);
impl AVCaptureCinematicVideoFocusMode {
    /// Indicates that no focus mode is specified, in which case weak focus is used as default.
    #[doc(alias = "AVCaptureCinematicVideoFocusModeNone")]
    pub const None: Self = Self(0);
    /// Indicates that the subject should remain in focus until it exits the scene.
    #[doc(alias = "AVCaptureCinematicVideoFocusModeStrong")]
    pub const Strong: Self = Self(1);
    /// Indicates that the Cinematic Video algorithm should automatically adjust focus according to the prominence of the subjects in the scene.
    #[doc(alias = "AVCaptureCinematicVideoFocusModeWeak")]
    pub const Weak: Self = Self(2);
}

unsafe impl Encode for AVCaptureCinematicVideoFocusMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureCinematicVideoFocusMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// AVCaptureDeviceFocus.
impl AVCaptureDevice {
    extern_methods!(
        /// Returns whether the receiver supports the given focus mode.
        ///
        ///
        /// Parameter `focusMode`: An AVCaptureFocusMode to be checked.
        ///
        /// Returns: YES if the receiver supports the given focus mode, NO otherwise.
        ///
        ///
        /// The receiver's focusMode property can only be set to a certain mode if this method returns YES for that mode.
        #[unsafe(method(isFocusModeSupported:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isFocusModeSupported(&self, focus_mode: AVCaptureFocusMode) -> bool;

        /// Indicates whether the receiver supports a lens position other than AVCaptureLensPositionCurrent.
        ///
        ///
        /// If lockingFocusWithCustomLensPositionSupported returns NO, setFocusModeLockedWithLensPosition: may only be called with AVCaptureLensPositionCurrent. Passing any other lens position will result in an exception.
        #[unsafe(method(isLockingFocusWithCustomLensPositionSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isLockingFocusWithCustomLensPositionSupported(&self) -> bool;

        /// Indicates current focus mode of the receiver, if it has one.
        ///
        ///
        /// The value of this property is an AVCaptureFocusMode that determines the receiver's focus mode, if it has one. -setFocusMode: throws an NSInvalidArgumentException if set to an unsupported value (see -isFocusModeSupported:). -setFocusMode: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's focusMode by key value observing this property.
        #[unsafe(method(focusMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn focusMode(&self) -> AVCaptureFocusMode;

        /// Setter for [`focusMode`][Self::focusMode].
        #[unsafe(method(setFocusMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFocusMode(&self, focus_mode: AVCaptureFocusMode);

        /// Indicates whether the receiver supports focus points of interest.
        ///
        ///
        /// The receiver's focusPointOfInterest property can only be set if this property returns YES.
        #[unsafe(method(isFocusPointOfInterestSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isFocusPointOfInterestSupported(&self) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        /// Indicates current focus point of interest of the receiver, if it has one.
        ///
        ///
        /// The value of this property is a CGPoint that determines the receiver's focus point of interest, if it has one. A value of (0,0) indicates that the camera should focus on the top left corner of the image, while a value of (1,1) indicates that it should focus on the bottom right. The default value is (0.5,0.5). -setFocusPointOfInterest: throws an NSInvalidArgumentException if isFocusPointOfInterestSupported returns NO. -setFocusPointOfInterest: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's focusPointOfInterest by key value observing this property. Note that setting focusPointOfInterest alone does not initiate a focus operation. After setting focusPointOfInterest, call -setFocusMode: to apply the new point of interest.
        #[unsafe(method(focusPointOfInterest))]
        #[unsafe(method_family = none)]
        pub unsafe fn focusPointOfInterest(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`focusPointOfInterest`][Self::focusPointOfInterest].
        #[unsafe(method(setFocusPointOfInterest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFocusPointOfInterest(&self, focus_point_of_interest: CGPoint);

        /// Whether the receiver supports focus rectangles of interest.
        ///
        /// You may only set the device's ``focusRectOfInterest`` property if this property returns `true`.
        #[unsafe(method(isFocusRectOfInterestSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isFocusRectOfInterestSupported(&self) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        /// The minimum size you may use when specifying a rectangle of interest.
        ///
        /// The size returned is in normalized coordinates, and depends on the current ``AVCaptureDevice/activeFormat``. If ``focusRectOfInterestSupported`` returns `false`, this property returns { 0, 0 }.
        #[unsafe(method(minFocusRectOfInterestSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn minFocusRectOfInterestSize(&self) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        /// The device's current focus rectangle of interest, if it has one.
        ///
        /// The value of this property is a ``CGRect`` determining the device's focus rectangle of interest. Use this as an alternative to setting ``focusPointOfInterest``, as it allows you to specify both a location and size. For example, a value of `CGRectMake(0, 0, 1, 1)` tells the device to use the entire field of view when determining the focus, while `CGRectMake(0, 0, 0.25, 0.25)` indicates the top left sixteenth, and `CGRectMake(0.75, 0.75, 0.25, 0.25)` indicates the bottom right sixteenth. Setting ``focusRectOfInterest`` throws an `NSInvalidArgumentException` if ``focusRectOfInterestSupported`` returns `false`. Setting ``focusRectOfInterest`` throws an `NSInvalidArgumentException` if your provided rectangle's size is smaller than the ``minFocusRectOfInterestSize``. Setting ``focusRectOfInterest`` throws an `NSGenericException` if you call it without first obtaining exclusive access to the device using ``AVCaptureDevice/lockForConfiguration:``. Setting ``focusRectOfInterest`` updates the device's ``focusPointOfInterest`` to the center of your provided rectangle of interest. If you later set the device's ``focusPointOfInterest``, the ``focusRectOfInterest`` resets to the default sized rectangle of interest for the new focus point of interest. If you change your ``AVCaptureDevice/activeFormat``, the point of interest and rectangle of interest both revert to their default values. You can observe automatic changes to the device's ``focusRectOfInterest`` by key-value observing this property.
        ///
        /// - Note: Setting ``focusRectOfInterest`` alone does not initiate a focus operation. After setting ``focusRectOfInterest``, set ``focusMode`` to apply the new rectangle of interest.
        #[unsafe(method(focusRectOfInterest))]
        #[unsafe(method_family = none)]
        pub unsafe fn focusRectOfInterest(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`focusRectOfInterest`][Self::focusRectOfInterest].
        #[unsafe(method(setFocusRectOfInterest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFocusRectOfInterest(&self, focus_rect_of_interest: CGRect);

        #[cfg(feature = "objc2-core-foundation")]
        /// The default rectangle of interest used for a given focus point of interest.
        ///
        /// - Parameter pointOfInterest: The point of interest for which you want the default rectangle of interest.
        ///
        /// For example, pass `(0.5, 0.5)` to get the focus rectangle of interest used for the default focus point of interest at `(0.5, 0.5)`.
        ///
        /// - Note: The particular default rectangle returned depends on the current focus mode.
        ///
        /// This method returns `CGRectNull` if ``focusRectOfInterestSupported`` returns `false`.
        #[unsafe(method(defaultRectForFocusPointOfInterest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn defaultRectForFocusPointOfInterest(
            &self,
            point_of_interest: CGPoint,
        ) -> CGRect;

        /// Indicates whether the receiver is currently performing a focus scan to adjust focus.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver's camera focus is being automatically adjusted by means of a focus scan, because its focus mode is AVCaptureFocusModeAutoFocus or AVCaptureFocusModeContinuousAutoFocus. Clients can observe the value of this property to determine whether the camera's focus is stable.
        ///
        /// See also: lensPosition
        ///
        /// See also: AVCaptureAutoFocusSystem
        #[unsafe(method(isAdjustingFocus))]
        #[unsafe(method_family = none)]
        pub unsafe fn isAdjustingFocus(&self) -> bool;

        /// Indicates whether the receiver supports autofocus range restrictions.
        ///
        ///
        /// The receiver's autoFocusRangeRestriction property can only be set if this property returns YES.
        #[unsafe(method(isAutoFocusRangeRestrictionSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isAutoFocusRangeRestrictionSupported(&self) -> bool;

        /// Indicates current restriction of the receiver's autofocus system to a particular range of focus scan, if it supports range restrictions.
        ///
        ///
        /// The value of this property is an AVCaptureAutoFocusRangeRestriction indicating how the autofocus system should limit its focus scan. The default value is AVCaptureAutoFocusRangeRestrictionNone. -setAutoFocusRangeRestriction: throws an NSInvalidArgumentException if isAutoFocusRangeRestrictionSupported returns NO. -setAutoFocusRangeRestriction: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. This property only has an effect when the focusMode property is set to AVCaptureFocusModeAutoFocus or AVCaptureFocusModeContinuousAutoFocus. Note that setting autoFocusRangeRestriction alone does not initiate a focus operation. After setting autoFocusRangeRestriction, call -setFocusMode: to apply the new restriction.
        #[unsafe(method(autoFocusRangeRestriction))]
        #[unsafe(method_family = none)]
        pub unsafe fn autoFocusRangeRestriction(&self) -> AVCaptureAutoFocusRangeRestriction;

        /// Setter for [`autoFocusRangeRestriction`][Self::autoFocusRangeRestriction].
        #[unsafe(method(setAutoFocusRangeRestriction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAutoFocusRangeRestriction(
            &self,
            auto_focus_range_restriction: AVCaptureAutoFocusRangeRestriction,
        );

        /// Indicates whether the receiver supports smooth autofocus.
        ///
        ///
        /// The receiver's smoothAutoFocusEnabled property can only be set if this property returns YES.
        #[unsafe(method(isSmoothAutoFocusSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSmoothAutoFocusSupported(&self) -> bool;

        /// Indicates whether the receiver should use smooth autofocus.
        ///
        ///
        /// On a receiver where -isSmoothAutoFocusSupported returns YES and smoothAutoFocusEnabled is set to YES, a smooth autofocus will be engaged when the focus mode is set to AVCaptureFocusModeAutoFocus or AVCaptureFocusModeContinuousAutoFocus. Enabling smooth autofocus is appropriate for movie recording. Smooth autofocus is slower and less visually invasive. Disabling smooth autofocus is more appropriate for video processing where a fast autofocus is necessary. The default value is NO. Setting this property throws an NSInvalidArgumentException if -isSmoothAutoFocusSupported returns NO. The receiver must be locked for configuration using lockForConfiguration: before clients can set this method, otherwise an NSGenericException is thrown. Note that setting smoothAutoFocusEnabled alone does not initiate a focus operation. After setting smoothAutoFocusEnabled, call -setFocusMode: to apply the new smooth autofocus mode.
        #[unsafe(method(isSmoothAutoFocusEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSmoothAutoFocusEnabled(&self) -> bool;

        /// Setter for [`isSmoothAutoFocusEnabled`][Self::isSmoothAutoFocusEnabled].
        #[unsafe(method(setSmoothAutoFocusEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSmoothAutoFocusEnabled(&self, smooth_auto_focus_enabled: bool);

        /// Indicates whether the receiver should automatically adjust face-driven autofocus.
        ///
        ///
        /// The value of this property is a BOOL that determines the receiver's automatic adjustment of face-driven autofocus. Default is YES on all platforms, if the receiver supports autofocus. This property must be set to NO before manually setting faceDrivenAutoFocusEnabled to YES/NO. -setAutomaticallyAdjustsFaceDrivenAutoFocusEnabled: throws an NSInvalidArgumentException if the receiver doesn't support autofocus. -setAutomaticallyAdjustsFaceDrivenAutoFocusEnabled: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. After setting automaticallyAdjustsFaceDrivenAutoFocusEnabled, call -setFocusMode: to apply the change.
        #[unsafe(method(automaticallyAdjustsFaceDrivenAutoFocusEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn automaticallyAdjustsFaceDrivenAutoFocusEnabled(&self) -> bool;

        /// Setter for [`automaticallyAdjustsFaceDrivenAutoFocusEnabled`][Self::automaticallyAdjustsFaceDrivenAutoFocusEnabled].
        #[unsafe(method(setAutomaticallyAdjustsFaceDrivenAutoFocusEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAutomaticallyAdjustsFaceDrivenAutoFocusEnabled(
            &self,
            automatically_adjusts_face_driven_auto_focus_enabled: bool,
        );

        /// Indicates whether face-driven autofocus is enabled on the receiver.
        ///
        ///
        /// Default is YES for all apps linked on or after iOS 15.4 when the receiver supports autofocus. -setFaceDrivenAutoFocusEnabled: throws an NSInvalidArgumentException if automaticallyAdjustsFaceDrivenAutoFocusEnabled returns YES.  -setFaceDrivenAutoFocusEnabled: throws an NSInvalidArgumentException if the receiver doesn't support autofocus. -setFaceDrivenAutoFocusEnabled: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. Note that setting faceDrivenAutoFocusEnabled alone does not initiate this focus change operation. After setting faceDrivenAutoFocusEnabled, call -setFocusMode: to apply the change.
        #[unsafe(method(isFaceDrivenAutoFocusEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isFaceDrivenAutoFocusEnabled(&self) -> bool;

        /// Setter for [`isFaceDrivenAutoFocusEnabled`][Self::isFaceDrivenAutoFocusEnabled].
        #[unsafe(method(setFaceDrivenAutoFocusEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFaceDrivenAutoFocusEnabled(&self, face_driven_auto_focus_enabled: bool);

        /// Indicates the focus position of the lens.
        ///
        ///
        /// The range of possible positions is 0.0 to 1.0, with 0.0 being the shortest distance at which the lens can focus and 1.0 the furthest. Note that 1.0 does not represent focus at infinity. The default value is 1.0. Note that a given lens position value does not correspond to an exact physical distance, nor does it represent a consistent focus distance from device to device. This property is key-value observable. It can be read at any time, regardless of focus mode, but can only be set via setFocusModeLockedWithLensPosition:completionHandler:.
        #[unsafe(method(lensPosition))]
        #[unsafe(method_family = none)]
        pub unsafe fn lensPosition(&self) -> c_float;

        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
        /// Sets focusMode to AVCaptureFocusModeLocked and locks lensPosition at an explicit value.
        ///
        ///
        /// Parameter `lensPosition`: The lens position, as described in the documentation for the lensPosition property. A value of AVCaptureLensPositionCurrent can be used to indicate that the caller does not wish to specify a value for lensPosition.
        ///
        /// Parameter `handler`: A block to be called when lensPosition has been set to the value specified and focusMode is set to AVCaptureFocusModeLocked. If setFocusModeLockedWithLensPosition:completionHandler: is called multiple times, the completion handlers will be called in FIFO order. The block receives a timestamp which matches that of the first buffer to which all settings have been applied. Note that the timestamp is synchronized to the device clock, and thus must be converted to the `AVCaptureSession/synchronizationClock` prior to comparison with the timestamps of buffers delivered via an AVCaptureVideoDataOutput. The client may pass nil for the handler parameter if knowledge of the operation's completion is not required.
        ///
        ///
        /// This is the only way of setting lensPosition. This method throws an NSRangeException if lensPosition is set to an unsupported level. This method throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
        #[unsafe(method(setFocusModeLockedWithLensPosition:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFocusModeLockedWithLensPosition_completionHandler(
            &self,
            lens_position: c_float,
            handler: Option<&block2::DynBlock<dyn Fn(CMTime)>>,
        );

        /// A property indicating the minimum focus distance.
        ///
        ///
        /// The minimum focus distance is given in millimeters, -1 if unknown. For virtual cameras (AVCaptureDeviceTypeBuiltInDualCamera, AVCaptureDeviceTypeBuiltInTripleCamera, etc.), the value reported is the smallest minimum focus distance of the auto-focus-capable cameras that it sources.
        #[unsafe(method(minimumFocusDistance))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumFocusDistance(&self) -> NSInteger;

        /// Focus on and start tracking a detected object.
        ///
        /// - Parameter detectedObjectID: The ID of the detected object.
        /// - Parameter focusMode: Specify whether to focus strongly or weakly.
        #[unsafe(method(setCinematicVideoTrackingFocusWithDetectedObjectID:focusMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCinematicVideoTrackingFocusWithDetectedObjectID_focusMode(
            &self,
            detected_object_id: NSInteger,
            focus_mode: AVCaptureCinematicVideoFocusMode,
        );

        #[cfg(feature = "objc2-core-foundation")]
        /// Focus on and start tracking an object if it can be detected at the region specified by the point.
        ///
        /// - Parameter point: A normalized point of interest (i.e., [0,1]) in the coordinate space of the device.
        /// - Parameter focusMode: Specify whether to focus strongly or weakly.
        #[unsafe(method(setCinematicVideoTrackingFocusAtPoint:focusMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCinematicVideoTrackingFocusAtPoint_focusMode(
            &self,
            point: CGPoint,
            focus_mode: AVCaptureCinematicVideoFocusMode,
        );

        #[cfg(feature = "objc2-core-foundation")]
        /// Fix focus at a distance.
        ///
        /// - Parameter point: A normalized point of interest (i.e., [0,1]) in the coordinate space of the device.
        /// - Parameter focusMode: Specify whether to focus strongly or weakly.
        ///
        /// The distance at which focus is set is determined internally using signals such as depth data.
        #[unsafe(method(setCinematicVideoFixedFocusAtPoint:focusMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCinematicVideoFixedFocusAtPoint_focusMode(
            &self,
            point: CGPoint,
            focus_mode: AVCaptureCinematicVideoFocusMode,
        );
    );
}

/// Constants indicating the mode of the exposure on the receiver's device, if it has adjustable exposure.
///
///
/// Indicates that the exposure should be locked at its current value.
///
/// Indicates that the device should automatically adjust exposure once and then change the exposure mode to AVCaptureExposureModeLocked.
///
/// Indicates that the device should automatically adjust exposure when needed.
///
/// Indicates that the device should only adjust exposure according to user provided ISO, exposureDuration values.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureexposuremode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureExposureMode(pub NSInteger);
impl AVCaptureExposureMode {
    #[doc(alias = "AVCaptureExposureModeLocked")]
    pub const Locked: Self = Self(0);
    #[doc(alias = "AVCaptureExposureModeAutoExpose")]
    pub const AutoExpose: Self = Self(1);
    #[doc(alias = "AVCaptureExposureModeContinuousAutoExposure")]
    pub const ContinuousAutoExposure: Self = Self(2);
    #[doc(alias = "AVCaptureExposureModeCustom")]
    pub const Custom: Self = Self(3);
}

unsafe impl Encode for AVCaptureExposureMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureExposureMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C" {
    /// A special value that may be passed as the duration parameter of setExposureModeCustomWithDuration:ISO:completionHandler: to indicate that the caller does not wish to specify a value for the exposureDuration property, and that it should instead be set to its current value. Note that the device may be adjusting exposureDuration at the time of the call, in which case the value to which exposureDuration is set may differ from the value obtained by querying the exposureDuration property.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureexposuredurationcurrent?language=objc)
    #[cfg(feature = "objc2-core-media")]
    pub static AVCaptureExposureDurationCurrent: CMTime;
}

extern "C" {
    /// A special value that may be passed as the ISO parameter of setExposureModeCustomWithDuration:ISO:completionHandler: to indicate that the caller does not wish to specify a value for the ISO property, and that it should instead be set to its current value. Note that the device may be adjusting ISO at the time of the call, in which case the value to which ISO is set may differ from the value obtained by querying the ISO property.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureisocurrent?language=objc)
    pub static AVCaptureISOCurrent: c_float;
}

extern "C" {
    /// A special value that may be passed as the bias parameter of setExposureTargetBias:completionHandler: to indicate that the caller does not wish to specify a value for the exposureTargetBias property, and that it should instead be set to its current value.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureexposuretargetbiascurrent?language=objc)
    pub static AVCaptureExposureTargetBiasCurrent: c_float;
}

/// AVCaptureDeviceExposure.
impl AVCaptureDevice {
    extern_methods!(
        /// Returns whether the receiver supports the given exposure mode.
        ///
        ///
        /// Parameter `exposureMode`: An AVCaptureExposureMode to be checked.
        ///
        /// Returns: YES if the receiver supports the given exposure mode, NO otherwise.
        ///
        ///
        /// The receiver's exposureMode property can only be set to a certain mode if this method returns YES for that mode.
        #[unsafe(method(isExposureModeSupported:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isExposureModeSupported(&self, exposure_mode: AVCaptureExposureMode) -> bool;

        /// Indicates current exposure mode of the receiver, if it has adjustable exposure.
        ///
        ///
        /// The value of this property is an AVCaptureExposureMode that determines the receiver's exposure mode, if it has adjustable exposure. -setExposureMode: throws an NSInvalidArgumentException if set to an unsupported value (see -isExposureModeSupported:). -setExposureMode: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. When using AVCapturePhotoOutput and capturing photos with AVCapturePhotoSettings' photoQualityPrioritization property set to AVCapturePhotoQualityPrioritizationBalanced or higher, the receiver's ISO and exposureDuration values may be overridden when exposing the photo if the scene is dark enough to warrant some form of multi-image fusion to improve quality. To ensure that the receiver's ISO and exposureDuration values are honored while in AVCaptureExposureModeCustom or AVCaptureExposureModeLocked, you must set your AVCapturePhotoSettings.photoQualityPrioritization property to AVCapturePhotoQualityPrioritizationSpeed. The same rule applies if you are using the deprecated AVCapturePhotoSettings.autoStillImageStabilizationEnabled property; you must set it to NO to preserve your custom exposure values in the photo capture. Likewise if you're using AVCaptureStillImageOutput, automaticallyEnablesStillImageStabilizationWhenAvailable must be set to NO to preserve your custom exposure values in a still image capture. Clients can observe automatic changes to the receiver's exposureMode by key value observing this property.
        #[unsafe(method(exposureMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn exposureMode(&self) -> AVCaptureExposureMode;

        /// Setter for [`exposureMode`][Self::exposureMode].
        #[unsafe(method(setExposureMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExposureMode(&self, exposure_mode: AVCaptureExposureMode);

        /// Indicates whether the receiver supports exposure points of interest.
        ///
        ///
        /// The receiver's exposurePointOfInterest property can only be set if this property returns YES.
        #[unsafe(method(isExposurePointOfInterestSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isExposurePointOfInterestSupported(&self) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        /// Indicates current exposure point of interest of the receiver, if it has one.
        ///
        ///
        /// The value of this property is a CGPoint that determines the receiver's exposure point of interest, if it has adjustable exposure. A value of (0,0) indicates that the camera should adjust exposure based on the top left corner of the image, while a value of (1,1) indicates that it should adjust exposure based on the bottom right corner. The default value is (0.5,0.5). -setExposurePointOfInterest: throws an NSInvalidArgumentException if isExposurePointOfInterestSupported returns NO. -setExposurePointOfInterest: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Note that setting exposurePointOfInterest alone does not initiate an exposure operation. After setting exposurePointOfInterest, call -setExposureMode: to apply the new point of interest.
        #[unsafe(method(exposurePointOfInterest))]
        #[unsafe(method_family = none)]
        pub unsafe fn exposurePointOfInterest(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`exposurePointOfInterest`][Self::exposurePointOfInterest].
        #[unsafe(method(setExposurePointOfInterest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExposurePointOfInterest(&self, exposure_point_of_interest: CGPoint);

        /// Whether the device supports exposure rectangles of interest.
        ///
        /// You may only set the device's ``exposureRectOfInterest`` property if this property returns `true`.
        #[unsafe(method(isExposureRectOfInterestSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isExposureRectOfInterestSupported(&self) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        /// The minimum size you may use when specifying a rectangle of interest.
        ///
        /// The size returned is in normalized coordinates, and depends on the current ``AVCaptureDevice/activeFormat``. If ``exposureRectOfInterestSupported`` returns `false`, this property returns { 0, 0 }.
        #[unsafe(method(minExposureRectOfInterestSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn minExposureRectOfInterestSize(&self) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        /// The device's current exposure rectangle of interest, if it has one.
        ///
        /// The value of this property is a ``CGRect`` determining the device's exposure rectangle of interest. Use this as an alternative to setting ``exposurePointOfInterest``, as it allows you to specify both a location and size. For example, a value of `CGRectMake(0, 0, 1, 1)` tells the device to use the entire field of view when determining the exposure, while `CGRectMake(0, 0, 0.25, 0.25)` indicates the top left sixteenth, and `CGRectMake(0.75, 0.75, 0.25, 0.25)` indicates the bottom right sixteenth. Setting ``exposureRectOfInterest`` throws an `NSInvalidArgumentException` if ``exposureRectOfInterestSupported`` returns `false`. Setting ``exposureRectOfInterest`` throws an `NSInvalidArgumentException` if your provided rectangle's size is smaller than the ``minExposureRectOfInterestSize``. Setting ``exposureRectOfInterest`` throws an `NSGenericException` if you call it without first obtaining exclusive access to the device using ``AVCaptureDevice/lockForConfiguration:``. Setting ``exposureRectOfInterest`` updates the device's ``exposurePointOfInterest`` to the center of your provided rectangle of interest. If you later set the device's ``exposurePointOfInterest``, the ``exposureRectOfInterest`` resets to the default sized rectangle of interest for the new exposure point of interest. If you change your ``AVCaptureDevice/activeFormat``, the point of interest and rectangle of interest both revert to their default values. You can observe automatic changes to the device's ``exposureRectOfInterest`` by key-value observing this property.
        ///
        /// - Note: Setting ``exposureRectOfInterest`` alone does not initiate an exposure operation. After setting ``exposureRectOfInterest``, set ``exposureMode`` to apply the new rectangle of interest.
        #[unsafe(method(exposureRectOfInterest))]
        #[unsafe(method_family = none)]
        pub unsafe fn exposureRectOfInterest(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`exposureRectOfInterest`][Self::exposureRectOfInterest].
        #[unsafe(method(setExposureRectOfInterest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExposureRectOfInterest(&self, exposure_rect_of_interest: CGRect);

        #[cfg(feature = "objc2-core-foundation")]
        /// The default rectangle of interest used for a given exposure point of interest.
        ///
        /// - Parameter pointOfInterest: The point of interest for which you want the default rectangle of interest.
        ///
        /// For example, pass `(0.5, 0.5)` to get the exposure rectangle of interest used for the default exposure point of interest at `(0.5, 0.5)`.
        ///
        /// This method returns `CGRectNull` if ``exposureRectOfInterestSupported`` returns `false`.
        #[unsafe(method(defaultRectForExposurePointOfInterest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn defaultRectForExposurePointOfInterest(
            &self,
            point_of_interest: CGPoint,
        ) -> CGRect;

        /// Indicates whether the receiver should automatically adjust face-driven auto exposure.
        ///
        ///
        /// The value of this property is a BOOL that determines the receiver's automatic adjustment of face-driven auto exposure. Default is YES on all platforms, if the receiver supports auto exposure. This property must be set to NO before manually setting faceDrivenAutoExposureEnabled to YES/NO. -setAutomaticallyAdjustsFaceDrivenAutoExposureEnabled: throws an NSInvalidArgumentException if the receiver doesn't support auto exposure. -setAutomaticallyAdjustsFaceDrivenAutoExposureEnabled: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. After setting automaticallyAdjustsFaceDrivenAutoExposureEnabled, call -setExposureMode: to apply the change.
        #[unsafe(method(automaticallyAdjustsFaceDrivenAutoExposureEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn automaticallyAdjustsFaceDrivenAutoExposureEnabled(&self) -> bool;

        /// Setter for [`automaticallyAdjustsFaceDrivenAutoExposureEnabled`][Self::automaticallyAdjustsFaceDrivenAutoExposureEnabled].
        #[unsafe(method(setAutomaticallyAdjustsFaceDrivenAutoExposureEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAutomaticallyAdjustsFaceDrivenAutoExposureEnabled(
            &self,
            automatically_adjusts_face_driven_auto_exposure_enabled: bool,
        );

        /// Indicates whether face-driven auto exposure is enabled on the receiver.
        ///
        ///
        /// Default is YES for all apps linked on or after iOS 15.4 when the receiver supports auto exposure. -setFaceDrivenAutoExposureEnabled: throws an NSInvalidArgumentException if automaticallyAdjustsFaceDrivenAutoExposureEnabled returns YES. -setFaceDrivenAutoExposureEnabled: throws an NSInvalidArgumentException if the receiver doesn't support auto exposure. -setFaceDrivenAutoExposureEnabled: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. Note that setting faceDrivenAutoExposureEnabled alone does not initiate this exposure change operation. After setting faceDrivenAutoExposureEnabled, call -setExposureMode: to apply the change.
        #[unsafe(method(isFaceDrivenAutoExposureEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isFaceDrivenAutoExposureEnabled(&self) -> bool;

        /// Setter for [`isFaceDrivenAutoExposureEnabled`][Self::isFaceDrivenAutoExposureEnabled].
        #[unsafe(method(setFaceDrivenAutoExposureEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFaceDrivenAutoExposureEnabled(
            &self,
            face_driven_auto_exposure_enabled: bool,
        );

        #[cfg(feature = "objc2-core-media")]
        /// The maximum exposure (integration) time that may be used by the auto exposure algorithm.
        ///
        ///
        /// When an AVCaptureDevice's exposureMode is set to AVCaptureExposureModeAutoExpose or AVCaptureExposureModeContinuousAutoExposure, the auto exposure algorithm picks a default max exposure duration that is tuned for the current configuration, balancing low light image quality with motion preservation. By querying or key-value observing this property, you may find out the current max exposure duration in use. You may also override the default value by setting this property to a value between activeFormat.maxExposureDuration and activeFormat.minExposureDuration. An NSRangeException is thrown if you pass an out-of-bounds exposure duration. Setting the property to the special value of kCMTimeInvalid resets the auto exposure max duration to the device's default for your current configuration. When the device's activeFormat or the AVCaptureSession's sessionPreset changes, this property resets to the default max exposure duration for the new format or session preset.
        ///
        /// On some devices, the auto exposure algorithm picks a different max exposure duration for a given format depending whether you used the -[AVCaptureSession setSessionPreset:] API or the -[AVCaptureDevice setActiveFormat:] API to set the format. To ensure uniform default handling of max exposure duration, you can set your AVCaptureDeviceInput's unifiedAutoExposureDefaultsEnabled property to YES.
        #[unsafe(method(activeMaxExposureDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeMaxExposureDuration(&self) -> CMTime;

        #[cfg(feature = "objc2-core-media")]
        /// Setter for [`activeMaxExposureDuration`][Self::activeMaxExposureDuration].
        #[unsafe(method(setActiveMaxExposureDuration:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActiveMaxExposureDuration(&self, active_max_exposure_duration: CMTime);

        /// Indicates whether the receiver is currently adjusting camera exposure.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver's camera exposure is being automatically adjusted because its exposure mode is AVCaptureExposureModeAutoExpose or AVCaptureExposureModeContinuousAutoExposure. Clients can observe the value of this property to determine whether the camera exposure is stable or is being automatically adjusted.
        #[unsafe(method(isAdjustingExposure))]
        #[unsafe(method_family = none)]
        pub unsafe fn isAdjustingExposure(&self) -> bool;

        /// The size of the lens diaphragm.
        ///
        ///
        /// The value of this property is a float indicating the size (f number) of the lens diaphragm. This property does not change.
        #[unsafe(method(lensAperture))]
        #[unsafe(method_family = none)]
        pub unsafe fn lensAperture(&self) -> c_float;

        #[cfg(feature = "objc2-core-media")]
        /// The length of time over which exposure takes place.
        ///
        ///
        /// Only exposure duration values between activeFormat.minExposureDuration and activeFormat.maxExposureDuration are supported. This property is key-value observable. It can be read at any time, regardless of exposure mode, but can only be set via setExposureModeCustomWithDuration:ISO:completionHandler:.
        #[unsafe(method(exposureDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn exposureDuration(&self) -> CMTime;

        /// The current exposure ISO value.
        ///
        ///
        /// This property controls the sensor's sensitivity to light by means of a gain value applied to the signal. Only ISO values between activeFormat.minISO and activeFormat.maxISO are supported. Higher values will result in noisier images. This property is key-value observable. It can be read at any time, regardless of exposure mode, but can only be set via setExposureModeCustomWithDuration:ISO:completionHandler:.
        #[unsafe(method(ISO))]
        #[unsafe(method_family = none)]
        pub unsafe fn ISO(&self) -> c_float;

        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
        /// Sets exposureMode to AVCaptureExposureModeCustom and locks exposureDuration and ISO at explicit values.
        ///
        ///
        /// Parameter `duration`: The exposure duration, as described in the documentation for the exposureDuration property. A value of AVCaptureExposureDurationCurrent can be used to indicate that the caller does not wish to specify a value for exposureDuration. Note that changes to this property may result in changes to activeVideoMinFrameDuration and/or activeVideoMaxFrameDuration.
        ///
        /// Parameter `ISO`: The exposure ISO value, as described in the documentation for the ISO property. A value of AVCaptureISOCurrent can be used to indicate that the caller does not wish to specify a value for ISO.
        ///
        /// Parameter `handler`: A block to be called when both exposureDuration and ISO have been set to the values specified and exposureMode is set to AVCaptureExposureModeCustom. If setExposureModeCustomWithDuration:ISO:completionHandler: is called multiple times, the completion handlers will be called in FIFO order. The block receives a timestamp which matches that of the first buffer to which all settings have been applied. Note that the timestamp is synchronized to the device clock, and thus must be converted to the `AVCaptureSession/synchronizationClock` prior to comparison with the timestamps of buffers delivered via an AVCaptureVideoDataOutput. The client may pass nil for the handler parameter if knowledge of the operation's completion is not required.
        ///
        ///
        /// This is the only way of setting exposureDuration and ISO. This method throws an NSRangeException if either exposureDuration or ISO is set to an unsupported level. This method throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. When using AVCapturePhotoOutput to capture photos, note that the photoQualityPrioritization property of AVCapturePhotoSettings defaults to AVCapturePhotoQualityPrioritizationBalanced, which allows photo capture to temporarily override the capture device's ISO and exposureDuration values if the scene is dark enough to warrant some form of multi-image fusion to improve quality. To ensure that the receiver's ISO and exposureDuration values are honored while in AVCaptureExposureModeCustom or AVCaptureExposureModeLocked, you must set your AVCapturePhotoSettings.photoQualityPrioritization property to AVCapturePhotoQualityPrioritizationSpeed. The same rule applies if you use the deprecated AVCapturePhotoSettings.autoStillImageStabilizationEnabled property or AVCaptureStillImageOutput.automaticallyEnablesStillImageStabilizationWhenAvailable property. You must set them to NO to preserve your custom or locked exposure settings.
        #[unsafe(method(setExposureModeCustomWithDuration:ISO:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExposureModeCustomWithDuration_ISO_completionHandler(
            &self,
            duration: CMTime,
            iso: c_float,
            handler: Option<&block2::DynBlock<dyn Fn(CMTime)>>,
        );

        /// Indicates the metered exposure level's offset from the target exposure value, in EV units.
        ///
        ///
        /// The value of this read-only property indicates the difference between the metered exposure level of the current scene and the target exposure value. This property is key-value observable.
        #[unsafe(method(exposureTargetOffset))]
        #[unsafe(method_family = none)]
        pub unsafe fn exposureTargetOffset(&self) -> c_float;

        /// Bias applied to the target exposure value, in EV units.
        ///
        ///
        /// When exposureMode is AVCaptureExposureModeContinuousAutoExposure or AVCaptureExposureModeLocked, the bias will affect both metering (exposureTargetOffset), and the actual exposure level (exposureDuration and ISO). When the exposure mode is AVCaptureExposureModeCustom, it will only affect metering. This property is key-value observable. It can be read at any time, but can only be set via setExposureTargetBias:completionHandler:.
        #[unsafe(method(exposureTargetBias))]
        #[unsafe(method_family = none)]
        pub unsafe fn exposureTargetBias(&self) -> c_float;

        /// A float indicating the minimum supported exposure bias, in EV units.
        ///
        ///
        /// This read-only property indicates the minimum supported exposure bias.
        #[unsafe(method(minExposureTargetBias))]
        #[unsafe(method_family = none)]
        pub unsafe fn minExposureTargetBias(&self) -> c_float;

        /// A float indicating the maximum supported exposure bias, in EV units.
        ///
        ///
        /// This read-only property indicates the maximum supported exposure bias.
        #[unsafe(method(maxExposureTargetBias))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxExposureTargetBias(&self) -> c_float;

        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
        /// Sets the bias to be applied to the target exposure value.
        ///
        ///
        /// Parameter `bias`: The bias to be applied to the exposure target value, as described in the documentation for the exposureTargetBias property.
        ///
        /// Parameter `handler`: A block to be called when exposureTargetBias has been set to the value specified. If setExposureTargetBias:completionHandler: is called multiple times, the completion handlers will be called in FIFO order. The block receives a timestamp which matches that of the first buffer to which the setting has been applied. Note that the timestamp is synchronized to the device clock, and thus must be converted to the `AVCaptureSession/synchronizationClock` prior to comparison with the timestamps of buffers delivered via an AVCaptureVideoDataOutput. The client may pass nil for the handler parameter if knowledge of the operation's completion is not required.
        ///
        ///
        /// This is the only way of setting exposureTargetBias. This method throws an NSRangeException if exposureTargetBias is set to an unsupported level. This method throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
        #[unsafe(method(setExposureTargetBias:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExposureTargetBias_completionHandler(
            &self,
            bias: c_float,
            handler: Option<&block2::DynBlock<dyn Fn(CMTime)>>,
        );
    );
}

/// AVCaptureDeviceToneMapping.
impl AVCaptureDevice {
    extern_methods!(
        /// Indicates whether the receiver should use global tone mapping.
        ///
        ///
        /// Tone mapping is a technique used by the device to map the pixel levels in high dynamic range images to a more limited dynamic range (such as 16 bit to 8 bit), while still retaining as close an appearance as possible. Normally the device employs adaptive, local tone curves to preserve highest image quality and adapt quickly to changing lighting conditions.
        ///
        /// This property indicates to the receiver to use a global tone map. If set to YES, the tone map is adjusted dynamically depending on the current scene and the same tone map is applied to all pixels in an image. If set to its default value of NO, different tone maps may be applied to different pixels in an image.
        ///
        /// globalToneMappingEnabled may only be set to YES if the receiver's activeFormat.isGlobalToneMappingSupported property returns YES, otherwise an NSGenericException is thrown. Setting globalToneMappingEnabled throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
        ///
        /// When global tone mapping is enabled, an AVCapturePhotoOutput connected to the AVCaptureDeviceInput’s session disables all forms of still image fusion, resulting in still images with no automatic stabilization applied.
        ///
        /// The receiver’s globalToneMappingEnabled resets to its default value of NO under the following conditions:
        /// - The receiver’s activeFormat changes
        /// - The receiver’s AVCaptureDeviceInput’s session’s sessionPreset changes
        /// - The receiver’s AVCaptureDeviceInput is added to a session
        ///
        /// Clients can observe automatic changes to the receiver's globalToneMappingEnabled by key value observing this property.
        #[unsafe(method(isGlobalToneMappingEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isGlobalToneMappingEnabled(&self) -> bool;

        /// Setter for [`isGlobalToneMappingEnabled`][Self::isGlobalToneMappingEnabled].
        #[unsafe(method(setGlobalToneMappingEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setGlobalToneMappingEnabled(&self, global_tone_mapping_enabled: bool);
    );
}

/// Constants indicating the mode of the white balance on the receiver's device, if it has adjustable white balance.
///
///
/// Indicates that the white balance should be locked at its current value.
///
/// Indicates that the device should automatically adjust white balance once and then change the white balance mode to AVCaptureWhiteBalanceModeLocked.
///
/// Indicates that the device should automatically adjust white balance when needed.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancemode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureWhiteBalanceMode(pub NSInteger);
impl AVCaptureWhiteBalanceMode {
    #[doc(alias = "AVCaptureWhiteBalanceModeLocked")]
    pub const Locked: Self = Self(0);
    #[doc(alias = "AVCaptureWhiteBalanceModeAutoWhiteBalance")]
    pub const AutoWhiteBalance: Self = Self(1);
    #[doc(alias = "AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance")]
    pub const ContinuousAutoWhiteBalance: Self = Self(2);
}

unsafe impl Encode for AVCaptureWhiteBalanceMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureWhiteBalanceMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// Structure containing RGB white balance gain values.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancegains?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AVCaptureWhiteBalanceGains {
    pub redGain: c_float,
    pub greenGain: c_float,
    pub blueGain: c_float,
}

unsafe impl Encode for AVCaptureWhiteBalanceGains {
    const ENCODING: Encoding = Encoding::Struct(
        "?",
        &[
            <c_float>::ENCODING,
            <c_float>::ENCODING,
            <c_float>::ENCODING,
        ],
    );
}

unsafe impl RefEncode for AVCaptureWhiteBalanceGains {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// Structure containing CIE 1931 xy chromaticity values.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancechromaticityvalues?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AVCaptureWhiteBalanceChromaticityValues {
    pub x: c_float,
    pub y: c_float,
}

unsafe impl Encode for AVCaptureWhiteBalanceChromaticityValues {
    const ENCODING: Encoding = Encoding::Struct("?", &[<c_float>::ENCODING, <c_float>::ENCODING]);
}

unsafe impl RefEncode for AVCaptureWhiteBalanceChromaticityValues {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// Structure containing a white balance color correlated temperature in kelvin, plus a tint value in the range of [-150 - +150].
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancetemperatureandtintvalues?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AVCaptureWhiteBalanceTemperatureAndTintValues {
    pub temperature: c_float,
    pub tint: c_float,
}

unsafe impl Encode for AVCaptureWhiteBalanceTemperatureAndTintValues {
    const ENCODING: Encoding = Encoding::Struct("?", &[<c_float>::ENCODING, <c_float>::ENCODING]);
}

unsafe impl RefEncode for AVCaptureWhiteBalanceTemperatureAndTintValues {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C" {
    /// Temperature and tint values ideal for scenes illuminated with a tungsten light source.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancetemperatureandtintvaluestungsten?language=objc)
    pub static AVCaptureWhiteBalanceTemperatureAndTintValuesTungsten:
        AVCaptureWhiteBalanceTemperatureAndTintValues;
}

extern "C" {
    /// Temperature and tint values ideal for scenes illuminated with a fluorescent light source.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancetemperatureandtintvaluesfluorescent?language=objc)
    pub static AVCaptureWhiteBalanceTemperatureAndTintValuesFluorescent:
        AVCaptureWhiteBalanceTemperatureAndTintValues;
}

extern "C" {
    /// Temperature and tint values ideal for scenes illuminated with natural daylight.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancetemperatureandtintvaluesdaylight?language=objc)
    pub static AVCaptureWhiteBalanceTemperatureAndTintValuesDaylight:
        AVCaptureWhiteBalanceTemperatureAndTintValues;
}

extern "C" {
    /// Temperature and tint values ideal for scenes illuminated with natural cloudy daylight.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancetemperatureandtintvaluescloudy?language=objc)
    pub static AVCaptureWhiteBalanceTemperatureAndTintValuesCloudy:
        AVCaptureWhiteBalanceTemperatureAndTintValues;
}

extern "C" {
    /// Temperature and tint values ideal for scenes illuminated with daylight but in heavy shade.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancetemperatureandtintvaluesshadow?language=objc)
    pub static AVCaptureWhiteBalanceTemperatureAndTintValuesShadow:
        AVCaptureWhiteBalanceTemperatureAndTintValues;
}

extern "C" {
    /// A special value that may be passed as a parameter of setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler: to indicate that the caller does not wish to specify a value for deviceWhiteBalanceGains, and that gains should instead be locked at their value at the moment that white balance is locked.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancegainscurrent?language=objc)
    pub static AVCaptureWhiteBalanceGainsCurrent: AVCaptureWhiteBalanceGains;
}

/// AVCaptureDeviceWhiteBalance.
impl AVCaptureDevice {
    extern_methods!(
        /// Returns whether the receiver supports the given white balance mode.
        ///
        ///
        /// Parameter `whiteBalanceMode`: An AVCaptureWhiteBalanceMode to be checked.
        ///
        /// Returns: YES if the receiver supports the given white balance mode, NO otherwise.
        ///
        ///
        /// The receiver's whiteBalanceMode property can only be set to a certain mode if this method returns YES for that mode.
        #[unsafe(method(isWhiteBalanceModeSupported:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isWhiteBalanceModeSupported(
            &self,
            white_balance_mode: AVCaptureWhiteBalanceMode,
        ) -> bool;

        /// Indicates whether the receiver supports white balance gains other than AVCaptureWhiteBalanceGainsCurrent.
        ///
        ///
        /// If lockingWhiteBalanceWithCustomDeviceGainsSupported returns NO, setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains: may only be called with AVCaptureWhiteBalanceGainsCurrent. Passing any other white balance gains will result in an exception.
        #[unsafe(method(isLockingWhiteBalanceWithCustomDeviceGainsSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isLockingWhiteBalanceWithCustomDeviceGainsSupported(&self) -> bool;

        /// Indicates current white balance mode of the receiver, if it has adjustable white balance.
        ///
        ///
        /// The value of this property is an AVCaptureWhiteBalanceMode that determines the receiver's white balance mode, if it has adjustable white balance. -setWhiteBalanceMode: throws an NSInvalidArgumentException if set to an unsupported value (see -isWhiteBalanceModeSupported:). -setWhiteBalanceMode: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's whiteBalanceMode by key value observing this property.
        #[unsafe(method(whiteBalanceMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn whiteBalanceMode(&self) -> AVCaptureWhiteBalanceMode;

        /// Setter for [`whiteBalanceMode`][Self::whiteBalanceMode].
        #[unsafe(method(setWhiteBalanceMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setWhiteBalanceMode(&self, white_balance_mode: AVCaptureWhiteBalanceMode);

        /// Indicates whether the receiver is currently adjusting camera white balance.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver's camera white balance is being automatically adjusted because its white balance mode is AVCaptureWhiteBalanceModeAutoWhiteBalance or AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance. Clients can observe the value of this property to determine whether the camera white balance is stable or is being automatically adjusted.
        #[unsafe(method(isAdjustingWhiteBalance))]
        #[unsafe(method_family = none)]
        pub unsafe fn isAdjustingWhiteBalance(&self) -> bool;

        /// Indicates the current device-specific RGB white balance gain values in use.
        ///
        ///
        /// This property specifies the current red, green, and blue gain values used for white balance. The values can be used to adjust color casts for a given scene. For each channel, only values between 1.0 and -maxWhiteBalanceGain are supported. This property is key-value observable. It can be read at any time, regardless of white balance mode, but can only be set via setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler:.
        #[unsafe(method(deviceWhiteBalanceGains))]
        #[unsafe(method_family = none)]
        pub unsafe fn deviceWhiteBalanceGains(&self) -> AVCaptureWhiteBalanceGains;

        /// Indicates the current device-specific Gray World RGB white balance gain values in use.
        ///
        ///
        /// This property specifies the current red, green, and blue gain values derived from the current scene to deliver a neutral (or "Gray World") white point for white balance. Gray World values assume a neutral subject (e.g. a gray card) has been placed in the middle of the subject area and fills the center 50% of the frame. Clients can read these values and apply them to the device using setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler:. For each channel, only values between 1.0 and -maxWhiteBalanceGain are supported. This property is key-value observable. It can be read at any time, regardless of white balance mode.
        #[unsafe(method(grayWorldDeviceWhiteBalanceGains))]
        #[unsafe(method_family = none)]
        pub unsafe fn grayWorldDeviceWhiteBalanceGains(&self) -> AVCaptureWhiteBalanceGains;

        /// Indicates the maximum supported value to which a channel in the AVCaptureWhiteBalanceGains may be set.
        ///
        ///
        /// This property does not change for the life of the receiver.
        #[unsafe(method(maxWhiteBalanceGain))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxWhiteBalanceGain(&self) -> c_float;

        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
        /// Sets white balance to locked mode with explicit temperature and tint values.
        ///
        /// - Parameter whiteBalanceTemperatureAndTintValues: The white balance temperature and tint values, as computed from ``temperatureAndTintValuesForDeviceWhiteBalanceGains:`` method, ``AVCaptureWhiteBalanceTemperatureAndTintValues`` presets or manual input.
        ///
        /// - Parameter handler: A block to be called when white balance values have been set to the values specified and ``whiteBalanceMode`` is set to ``AVCaptureWhiteBalanceModeLocked``. If ``setWhiteBalanceModeLockedWithDeviceWhiteBalanceTemperatureAndTintValues:completionHandler:`` is called multiple times, the completion handlers are called in FIFO order. The block receives a timestamp which matches that of the first buffer to which all settings have been applied. Note that the timestamp is synchronized to the device clock, and thus must be converted to the ``AVCaptureSession/synchronizationClock`` prior to comparison with the timestamps of buffers delivered via an ``AVCaptureVideoDataOutput``. This parameter may be `nil` if synchronization is not required.
        ///
        /// This method takes a ``AVCaptureWhiteBalanceTemperatureAndTintValues`` struct and applies the appropriate ``AVCaptureWhiteBalanceGains``. This method throws an `NSRangeException` if any of the values are set to an unsupported level. This method throws an `NSGenericException` if called without first obtaining exclusive access to the device using ``AVCaptureDevice/lockForConfiguration:``.
        #[unsafe(method(setWhiteBalanceModeLockedWithDeviceWhiteBalanceTemperatureAndTintValues:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setWhiteBalanceModeLockedWithDeviceWhiteBalanceTemperatureAndTintValues_completionHandler(
            &self,
            white_balance_temperature_and_tint_values: AVCaptureWhiteBalanceTemperatureAndTintValues,
            handler: Option<&block2::DynBlock<dyn Fn(CMTime)>>,
        );

        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
        /// Sets white balance to locked mode with explicit deviceWhiteBalanceGains values.
        ///
        ///
        /// Parameter `whiteBalanceGains`: The white balance gain values, as described in the documentation for the deviceWhiteBalanceGains property. A value of AVCaptureWhiteBalanceGainsCurrent can be used to indicate that the caller does not wish to specify a value for deviceWhiteBalanceGains.
        ///
        /// Parameter `handler`: A block to be called when white balance gains have been set to the values specified and whiteBalanceMode is set to AVCaptureWhiteBalanceModeLocked. If setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler: is called multiple times, the completion handlers will be called in FIFO order. The block receives a timestamp which matches that of the first buffer to which all settings have been applied. Note that the timestamp is synchronized to the device clock, and thus must be converted to the `AVCaptureSession/synchronizationClock` prior to comparison with the timestamps of buffers delivered via an AVCaptureVideoDataOutput. This parameter may be nil if synchronization is not required.
        ///
        ///
        /// Gain values are normalized to the minimum channel value to avoid brightness changes (e.g. R:2 G:2 B:4 will be normalized to R:1 G:1 B:2). For each channel in the whiteBalanceGains struct, only values between 1.0 and maxWhiteBalanceGain after nomalization are supported.  This method throws an NSRangeException if any of the whiteBalanceGains are set to an unsupported level. This method throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
        #[unsafe(method(setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains_completionHandler(
            &self,
            white_balance_gains: AVCaptureWhiteBalanceGains,
            handler: Option<&block2::DynBlock<dyn Fn(CMTime)>>,
        );

        /// Converts device-specific white balance RGB gain values to device-independent chromaticity values.
        ///
        ///
        /// Parameter `whiteBalanceGains`: White balance gain values, as described in the documentation for the deviceWhiteBalanceGains property. A value of AVCaptureWhiteBalanceGainsCurrent may not be used in this function.
        ///
        /// Returns: A fully populated AVCaptureWhiteBalanceChromaticityValues structure containing device-independent values.
        ///
        ///
        /// This method may be called on the receiver to convert device-specific white balance RGB gain values to device-independent chromaticity (little x, little y) values. For each channel in the whiteBalanceGains struct, only values between 1.0 and -maxWhiteBalanceGain are supported. This method throws an NSRangeException if any of the whiteBalanceGains are set to unsupported values.
        #[unsafe(method(chromaticityValuesForDeviceWhiteBalanceGains:))]
        #[unsafe(method_family = none)]
        pub unsafe fn chromaticityValuesForDeviceWhiteBalanceGains(
            &self,
            white_balance_gains: AVCaptureWhiteBalanceGains,
        ) -> AVCaptureWhiteBalanceChromaticityValues;

        /// Converts device-independent chromaticity values to device-specific white balance RGB gain values.
        ///
        ///
        /// Parameter `chromaticityValues`: Little x, little y chromaticity values as described in the documentation for AVCaptureWhiteBalanceChromaticityValues.
        ///
        /// Returns: A fully populated AVCaptureWhiteBalanceGains structure containing device-specific RGB gain values.
        ///
        ///
        /// This method may be called on the receiver to convert device-independent chromaticity values to device-specific RGB white balance gain values. This method throws an NSRangeException if any of the chromaticityValues are set outside the range [0,1]. Note that some x,y combinations yield out-of-range device RGB values that will cause an exception to be thrown if passed directly to -setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler:. Be sure to check that red, green, and blue gain values are within the range of [1.0 - maxWhiteBalanceGain].
        #[unsafe(method(deviceWhiteBalanceGainsForChromaticityValues:))]
        #[unsafe(method_family = none)]
        pub unsafe fn deviceWhiteBalanceGainsForChromaticityValues(
            &self,
            chromaticity_values: AVCaptureWhiteBalanceChromaticityValues,
        ) -> AVCaptureWhiteBalanceGains;

        /// Converts device-specific white balance RGB gain values to device-independent temperature and tint values.
        ///
        ///
        /// Parameter `whiteBalanceGains`: White balance gain values, as described in the documentation for the deviceWhiteBalanceGains property. A value of AVCaptureWhiteBalanceGainsCurrent may not be used in this function.
        ///
        /// Returns: A fully populated AVCaptureWhiteBalanceTemperatureAndTintValues structure containing device-independent values.
        ///
        ///
        /// This method may be called on the receiver to convert device-specific white balance RGB gain values to device-independent temperature (in kelvin) and tint values. For each channel in the whiteBalanceGains struct, only values between 1.0 and -maxWhiteBalanceGain are supported. This method throws an NSRangeException if any of the whiteBalanceGains are set to unsupported values.
        #[unsafe(method(temperatureAndTintValuesForDeviceWhiteBalanceGains:))]
        #[unsafe(method_family = none)]
        pub unsafe fn temperatureAndTintValuesForDeviceWhiteBalanceGains(
            &self,
            white_balance_gains: AVCaptureWhiteBalanceGains,
        ) -> AVCaptureWhiteBalanceTemperatureAndTintValues;

        /// Converts device-independent temperature and tint values to device-specific white balance RGB gain values.
        ///
        ///
        /// Parameter `tempAndTintValues`: Temperature and tint values as described in the documentation for AVCaptureWhiteBalanceTemperatureAndTintValues.
        ///
        /// Returns: A fully populated AVCaptureWhiteBalanceGains structure containing device-specific RGB gain values.
        ///
        ///
        /// This method may be called on the receiver to convert device-independent temperature and tint values to device-specific RGB white balance gain values. You may pass any temperature and tint values and corresponding white balance gains will be produced. Note though that some temperature and tint combinations yield out-of-range device RGB values that will cause an exception to be thrown if passed directly to -setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler:. Be sure to check that red, green, and blue gain values are within the range of [1.0 - maxWhiteBalanceGain].
        #[unsafe(method(deviceWhiteBalanceGainsForTemperatureAndTintValues:))]
        #[unsafe(method_family = none)]
        pub unsafe fn deviceWhiteBalanceGainsForTemperatureAndTintValues(
            &self,
            temp_and_tint_values: AVCaptureWhiteBalanceTemperatureAndTintValues,
        ) -> AVCaptureWhiteBalanceGains;
    );
}

/// AVCaptureDeviceSubjectAreaChangeMonitoring.
impl AVCaptureDevice {
    extern_methods!(
        /// Indicates whether the receiver should monitor the subject area for changes.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver should monitor the video subject area for changes, such as lighting changes, substantial movement, etc. If subject area change monitoring is enabled, the receiver sends an AVCaptureDeviceSubjectAreaDidChangeNotification whenever it detects a change to the subject area, at which time an interested client may wish to re-focus, adjust exposure, white balance, etc. The receiver must be locked for configuration using lockForConfiguration: before clients can set the value of this property.
        #[unsafe(method(isSubjectAreaChangeMonitoringEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSubjectAreaChangeMonitoringEnabled(&self) -> bool;

        /// Setter for [`isSubjectAreaChangeMonitoringEnabled`][Self::isSubjectAreaChangeMonitoringEnabled].
        #[unsafe(method(setSubjectAreaChangeMonitoringEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSubjectAreaChangeMonitoringEnabled(
            &self,
            subject_area_change_monitoring_enabled: bool,
        );
    );
}

/// AVCaptureDeviceLowLightBoost.
impl AVCaptureDevice {
    extern_methods!(
        /// Indicates whether the receiver supports boosting images in low light conditions.
        ///
        ///
        /// The receiver's automaticallyEnablesLowLightBoostWhenAvailable property can only be set if this property returns YES.
        #[unsafe(method(isLowLightBoostSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isLowLightBoostSupported(&self) -> bool;

        /// Indicates whether the receiver's low light boost feature is enabled.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver is currently enhancing images to improve quality due to low light conditions. When -isLowLightBoostEnabled returns YES, the receiver has switched into a special mode in which more light can be perceived in images. This property is key-value observable.
        #[unsafe(method(isLowLightBoostEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isLowLightBoostEnabled(&self) -> bool;

        /// Indicates whether the receiver should automatically switch to low light boost mode when necessary.
        ///
        ///
        /// On a receiver where -isLowLightBoostSupported returns YES, a special low light boost mode may be engaged to improve image quality. When the automaticallyEnablesLowLightBoostWhenAvailable property is set to YES, the receiver switches at its discretion to a special boost mode under low light, and back to normal operation when the scene becomes sufficiently lit. An AVCaptureDevice that supports this feature may only engage boost mode for certain source formats or resolutions. Clients may observe changes to the lowLightBoostEnabled property to know when the mode has engaged. The switch between normal operation and low light boost mode may drop one or more video frames. The default value is NO. Setting this property throws an NSInvalidArgumentException if -isLowLightBoostSupported returns NO. The receiver must be locked for configuration using lockForConfiguration: before clients can set this method, otherwise an NSGenericException is thrown.
        #[unsafe(method(automaticallyEnablesLowLightBoostWhenAvailable))]
        #[unsafe(method_family = none)]
        pub unsafe fn automaticallyEnablesLowLightBoostWhenAvailable(&self) -> bool;

        /// Setter for [`automaticallyEnablesLowLightBoostWhenAvailable`][Self::automaticallyEnablesLowLightBoostWhenAvailable].
        #[unsafe(method(setAutomaticallyEnablesLowLightBoostWhenAvailable:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAutomaticallyEnablesLowLightBoostWhenAvailable(
            &self,
            automatically_enables_low_light_boost_when_available: bool,
        );
    );
}

/// AVCaptureDeviceVideoZoom.
impl AVCaptureDevice {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// Controls zoom level of image outputs
        ///
        ///
        /// Applies a centered crop for all image outputs, scaling as necessary to maintain output dimensions. Minimum value of 1.0 yields full field of view, increasing values will increase magnification, up to a maximum value specified in the activeFormat's videoMaxZoomFactor property. Modifying the zoom factor will cancel any active rampToVideoZoomFactor:withRate:, and snap directly to the assigned value. Assigning values outside the acceptable range will generate an NSRangeException. Clients can key value observe the value of this property. When depth data delivery is enabled, changing the zoom factor sets the videoZoomFactor to the nearest supportedVideoZoomFactor from -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery] with a disruptive reconfiguration of the capture render pipeline.
        ///
        /// -setVideoZoomFactor: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
        ///
        ///
        /// See also: -[AVCaptureDeviceFormat videoMaxZoomFactor], -[AVCaptureDeviceFormat videoZoomFactorUpscaleThreshold], -[AVCaptureDevice minAvailableVideoZoomFactor], -[AVCaptureDevice maxAvailableVideoZoomFactor],  -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery], -[AVCaptureDeviceFormat videoMinZoomFactorForCenterStage] and -[AVCaptureDeviceFormat videoMaxZoomFactorForCenterStage]
        #[unsafe(method(videoZoomFactor))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoZoomFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`videoZoomFactor`][Self::videoZoomFactor].
        #[unsafe(method(setVideoZoomFactor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setVideoZoomFactor(&self, video_zoom_factor: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        /// Provides smooth changes in zoom factor.
        ///
        ///
        /// This method provides a change in zoom by compounding magnification at the specified rate over time. Although the zoom factor will grow exponentially, this yields a visually linear zoom in the image over time.
        ///
        /// The zoom transition will stop at the specified factor, which must be in the valid range for videoZoomFactor. Assignments to videoZoomFactor while a ramp is in progress will cancel the ramp and snap to the assigned value.
        ///
        /// The zoom factor is continuously scaled by pow(2,rate * time). A rate of 0 causes no change in zoom factor, equivalent to calling cancelVideoZoomRamp. A rate of 1 will cause the magnification to double every second (or halve every second if zooming out), and similarly larger or smaller values will zoom faster or slower respectively. Only the absolute value of the rate is significant--sign is corrected for the direction of the target. Changes in rate will be smoothed by an internal acceleration limit.
        ///
        /// When depth data delivery is enabled, -rampToVideoZoomFactor:withRate: sets the videoZoomFactor to the nearest supportedVideoZoomFactor from -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery] with a disruptive reconfiguration of the capture render pipeline.
        ///
        /// -rampToVideoZoomFactor:withRate: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
        #[unsafe(method(rampToVideoZoomFactor:withRate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn rampToVideoZoomFactor_withRate(&self, factor: CGFloat, rate: c_float);

        /// Indicates if the zoom factor is transitioning to a value set by rampToVideoZoomFactor:withRate:
        ///
        ///
        /// Clients can observe this value to determine when a ramp begins or completes.
        #[unsafe(method(isRampingVideoZoom))]
        #[unsafe(method_family = none)]
        pub unsafe fn isRampingVideoZoom(&self) -> bool;

        /// Eases out of any video zoom transitions initiated by rampToVideoZoomFactor:withRate:
        ///
        ///
        /// This method is equivalent to calling rampToVideoZoomFactor:withRate: using the current zoom factor target and a rate of 0. This allows a smooth stop to any changes in zoom which were in progress.
        ///
        /// -cancelVideoZoomRamp: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
        #[unsafe(method(cancelVideoZoomRamp))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancelVideoZoomRamp(&self);

        #[cfg(feature = "objc2-core-foundation")]
        /// The video zoom factor at or above which a DualCamera can select between its wide angle camera and its telephoto camera.
        ///
        ///
        /// This is the zoom factor at which the wide angle camera's field of view matches telephoto camera's full field of view. On non-DualCamera devices this will return 1.0. As of iOS 13.0, this API has been deprecated in favor of virtualDeviceSwitchOverVideoZoomFactors.
        #[deprecated]
        #[unsafe(method(dualCameraSwitchOverVideoZoomFactor))]
        #[unsafe(method_family = none)]
        pub unsafe fn dualCameraSwitchOverVideoZoomFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// A multiplier that can be used with the receiver's videoZoomFactor property for displaying a video zoom factor in a user interface.
        ///
        ///
        /// In some system user interfaces, like the macOS Video Effects Menu, the video zoom factor value is displayed in a way most appropriate for visual representation and might differ from the videoZoomFactor property value on the receiver by a fixed ratio. For example, if the videoZoomFactor property value is 1.0 and the displayVideoZoomFactorMultiplier property value is 0.5, then multiplying 1.0 and 0.5 produces 0.5 which can be displayed in the UI. Client applications can key value observe this property to update the display video zoom factor values in their UI to stay consistent with Apple's system UIs.
        #[unsafe(method(displayVideoZoomFactorMultiplier))]
        #[unsafe(method_family = none)]
        pub unsafe fn displayVideoZoomFactorMultiplier(&self) -> CGFloat;
    );
}

/// Constants indicating the client's authorization to the underlying hardware supporting a media type.
///
///
/// Indicates that the user has not yet made a choice regarding whether the client can access the hardware.
///
/// The client is not authorized to access the hardware for the media type. The user cannot change the client's status, possibly due to active restrictions such as parental controls being in place.
///
/// The user explicitly denied access to the hardware supporting a media type for the client.
///
/// The client is authorized to access the hardware supporting a media type.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avauthorizationstatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVAuthorizationStatus(pub NSInteger);
impl AVAuthorizationStatus {
    #[doc(alias = "AVAuthorizationStatusNotDetermined")]
    pub const NotDetermined: Self = Self(0);
    #[doc(alias = "AVAuthorizationStatusRestricted")]
    pub const Restricted: Self = Self(1);
    #[doc(alias = "AVAuthorizationStatusDenied")]
    pub const Denied: Self = Self(2);
    #[doc(alias = "AVAuthorizationStatusAuthorized")]
    pub const Authorized: Self = Self(3);
}

unsafe impl Encode for AVAuthorizationStatus {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVAuthorizationStatus {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// AVCaptureDeviceAuthorization.
impl AVCaptureDevice {
    extern_methods!(
        #[cfg(feature = "AVMediaFormat")]
        /// Returns the client's authorization status for accessing the underlying hardware that supports a given media type.
        ///
        ///
        /// Parameter `mediaType`: The media type, either AVMediaTypeVideo or AVMediaTypeAudio
        ///
        /// Returns: The authorization status of the client
        ///
        ///
        /// This method returns the AVAuthorizationStatus of the client for accessing the underlying hardware supporting the media type. Media type constants are defined in AVMediaFormat.h. If any media type other than AVMediaTypeVideo or AVMediaTypeAudio is supplied, an NSInvalidArgumentException will be thrown. If the status is AVAuthorizationStatusNotDetermined, you may use the +requestAccessForMediaType:completionHandler: method to request access by prompting the user.
        #[unsafe(method(authorizationStatusForMediaType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn authorizationStatusForMediaType(
            media_type: &AVMediaType,
        ) -> AVAuthorizationStatus;

        #[cfg(all(feature = "AVMediaFormat", feature = "block2"))]
        /// Requests access to the underlying hardware for the media type, showing a dialog to the user if necessary.
        ///
        ///
        /// Parameter `mediaType`: The media type, either AVMediaTypeVideo or AVMediaTypeAudio
        ///
        /// Parameter `handler`: A block called with the result of requesting access
        ///
        ///
        /// Use this function to request access to the hardware for a given media type. Media type constants are defined in AVMediaFormat.h. If any media type other than AVMediaTypeVideo or AVMediaTypeAudio is supplied, an NSInvalidArgumentException will be thrown.
        ///
        /// This call will not block while the user is being asked for access, allowing the client to continue running. Until access has been granted, any AVCaptureDevices for the media type will vend silent audio samples or black video frames. The user is only asked for permission the first time the client requests access. Later calls use the permission granted by the user.
        ///
        /// Note that the authorization dialog will automatically be shown if the status is AVAuthorizationStatusNotDetermined when creating an AVCaptureDeviceInput.
        ///
        /// Invoking this method with AVMediaTypeAudio is equivalent to calling -[AVAudioSession requestRecordPermission:].
        ///
        /// The completion handler is called on an arbitrary dispatch queue. It is the client's responsibility to ensure that any UIKit-related updates are called on the main queue or main thread as a result.
        #[unsafe(method(requestAccessForMediaType:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestAccessForMediaType_completionHandler(
            media_type: &AVMediaType,
            handler: &block2::DynBlock<dyn Fn(Bool)>,
        );
    );
}

/// A constant that is used to specify the transport controls' speed.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetransportcontrolsspeed?language=objc)
pub type AVCaptureDeviceTransportControlsSpeed = c_float;

/// Constants indicating the transport controls' current mode of play back, if it has one.
///
///
/// Indicates that the tape transport is not threaded through the play head.
///
/// Indicates that the tape transport is threaded through the play head.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetransportcontrolsplaybackmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureDeviceTransportControlsPlaybackMode(pub NSInteger);
impl AVCaptureDeviceTransportControlsPlaybackMode {
    #[doc(alias = "AVCaptureDeviceTransportControlsNotPlayingMode")]
    pub const NotPlayingMode: Self = Self(0);
    #[doc(alias = "AVCaptureDeviceTransportControlsPlayingMode")]
    pub const PlayingMode: Self = Self(1);
}

unsafe impl Encode for AVCaptureDeviceTransportControlsPlaybackMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureDeviceTransportControlsPlaybackMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// AVCaptureDeviceTransportControls.
impl AVCaptureDevice {
    extern_methods!(
        /// Returns whether the receiver supports transport control commands.
        ///
        ///
        /// For devices with transport controls, such as AVC tape-based camcorders or pro capture devices with RS422 deck control, the value of this property is YES. If transport controls are not supported, none of the associated transport control methods and properties are available on the receiver.
        #[unsafe(method(transportControlsSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn transportControlsSupported(&self) -> bool;

        /// Returns the receiver's current playback mode.
        ///
        ///
        /// For devices that support transport control, this property may be queried to discover the current playback mode.
        #[unsafe(method(transportControlsPlaybackMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn transportControlsPlaybackMode(
            &self,
        ) -> AVCaptureDeviceTransportControlsPlaybackMode;

        /// Returns the receiver's current playback speed as a floating point value.
        ///
        ///
        /// For devices that support transport control, this property may be queried to discover the current playback speed of the deck.
        /// 0.0 -> stopped.
        /// 1.0 -> forward at normal speed.
        /// -1.0-> reverse at normal speed.
        /// 2.0 -> forward at 2x normal speed.
        /// etc.
        #[unsafe(method(transportControlsSpeed))]
        #[unsafe(method_family = none)]
        pub unsafe fn transportControlsSpeed(&self) -> AVCaptureDeviceTransportControlsSpeed;

        /// Sets both the transport controls playback mode and speed in a single method.
        ///
        ///
        /// Parameter `mode`: A AVCaptureDeviceTransportControlsPlaybackMode indicating whether the deck should be put into play mode.
        ///
        /// Parameter `speed`: A AVCaptureDeviceTransportControlsSpeed indicating the speed at which to wind or play the tape.
        ///
        ///
        /// A method for setting the receiver's transport controls playback mode and speed. The receiver must be locked for configuration using lockForConfiguration: before clients can set this method, otherwise an NSGenericException is thrown.
        #[unsafe(method(setTransportControlsPlaybackMode:speed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTransportControlsPlaybackMode_speed(
            &self,
            mode: AVCaptureDeviceTransportControlsPlaybackMode,
            speed: AVCaptureDeviceTransportControlsSpeed,
        );
    );
}

/// AVCaptureDeviceHighDynamicRangeSupport.
impl AVCaptureDevice {
    extern_methods!(
        /// Indicates whether the receiver is allowed to turn high dynamic range streaming on or off.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver is free to turn high dynamic range streaming on or off. This property defaults to YES. When automaticallyAdjustsVideoHDREnabled, the AVCaptureDevice turns videoHDR on automatically if it's a good fit for the activeFormat. -setAutomaticallyAdjustsVideoHDREnabled: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. Clients can key-value observe videoHDREnabled to know when the receiver has automatically changed the value.
        #[unsafe(method(automaticallyAdjustsVideoHDREnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn automaticallyAdjustsVideoHDREnabled(&self) -> bool;

        /// Setter for [`automaticallyAdjustsVideoHDREnabled`][Self::automaticallyAdjustsVideoHDREnabled].
        #[unsafe(method(setAutomaticallyAdjustsVideoHDREnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAutomaticallyAdjustsVideoHDREnabled(
            &self,
            automatically_adjusts_video_hdr_enabled: bool,
        );

        /// Indicates whether the receiver's streaming high dynamic range feature is enabled. See AVCaptureDeviceFormat.isVideoHDRSupported.
        ///
        ///
        /// The value of this property is a BOOL indicating whether the receiver is currently streaming high dynamic range video buffers, also known as Extended Dynamic Range (EDR). The value of this property is ignored when device.activeColorSpace is HLG BT2020 color space since HDR is effectively always on and can't be disabled. The property may only be set if you first set automaticallyAdjustsVideoHDREnabled to NO, otherwise an NSGenericException is thrown. videoHDREnabled may only be set to YES if the receiver's activeFormat.isVideoHDRSupported property returns YES, otherwise an NSGenericException is thrown. This property may be key-value observed.
        ///
        /// Note that setting this property may cause a lengthy reconfiguration of the receiver, similar to setting a new active format or AVCaptureSession sessionPreset. If you are setting either the active format or the AVCaptureSession's sessionPreset AND this property, you should bracket these operations with [session beginConfiguration] and [session commitConfiguration] to minimize reconfiguration time.
        #[unsafe(method(isVideoHDREnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isVideoHDREnabled(&self) -> bool;

        /// Setter for [`isVideoHDREnabled`][Self::isVideoHDREnabled].
        #[unsafe(method(setVideoHDREnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setVideoHDREnabled(&self, video_hdr_enabled: bool);
    );
}

/// Constants indicating active or supported video color space.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturecolorspace?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureColorSpace(pub NSInteger);
impl AVCaptureColorSpace {
    /// The sRGB color space ( https://www.w3.org/Graphics/Color/srgb ).
    #[doc(alias = "AVCaptureColorSpace_sRGB")]
    pub const sRGB: Self = Self(0);
    /// The P3 D65 wide color space which uses Illuminant D65 as the white point.
    #[doc(alias = "AVCaptureColorSpace_P3_D65")]
    pub const P3_D65: Self = Self(1);
    /// The BT2020 wide color space which uses Illuminant D65 as the white point and Hybrid Log-Gamma as the transfer function.
    #[doc(alias = "AVCaptureColorSpace_HLG_BT2020")]
    pub const HLG_BT2020: Self = Self(2);
    /// The Apple Log Color space, which uses BT2020 as the color primaries, and an Apple defined Log curve as a transfer function. When you set this as the active color space on an ``AVCaptureDevice``, any ``AVCapturePhotoOutput`` or ``AVCaptureStillImageOutput`` connected to the same ``AVCaptureDevice`` is made inactive (its ``AVCaptureConnection/active`` property returns `false`).
    #[doc(alias = "AVCaptureColorSpace_AppleLog")]
    pub const AppleLog: Self = Self(3);
    /// The Apple Log 2 Color space, which uses Apple Gamut as the color primaries, and an Apple defined Log curve as a transfer function. When you set this as the active color space on an ``AVCaptureDevice``, any ``AVCapturePhotoOutput`` or ``AVCaptureStillImageOutput`` connected to the same ``AVCaptureDevice`` is made inactive (its ``AVCaptureConnection/active`` property returns `false`).
    #[doc(alias = "AVCaptureColorSpace_AppleLog2")]
    pub const AppleLog2: Self = Self(4);
}

unsafe impl Encode for AVCaptureColorSpace {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureColorSpace {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// AVCaptureDeviceColorSpaceSupport.
impl AVCaptureDevice {
    extern_methods!(
        /// Indicates the receiver's current active color space.
        ///
        ///
        /// By default, an AVCaptureDevice attached to an AVCaptureSession is automatically configured for wide color by the AVCaptureSession (see AVCaptureSession automaticallyConfiguresCaptureDeviceForWideColor). You may also set the activeColorSpace manually. To prevent the AVCaptureSession from undoing your work, remember to set AVCaptureSession's automaticallyConfiguresCaptureDeviceForWideColor property to NO. Changing the receiver's activeColorSpace while the session is running requires a disruptive reconfiguration of the capture render pipeline. Movie captures in progress will be ended immediately; unfulfilled photo requests will be aborted; video preview will temporarily freeze. -setActiveColorSpace: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:.
        #[unsafe(method(activeColorSpace))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeColorSpace(&self) -> AVCaptureColorSpace;

        /// Setter for [`activeColorSpace`][Self::activeColorSpace].
        #[unsafe(method(setActiveColorSpace:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActiveColorSpace(&self, active_color_space: AVCaptureColorSpace);
    );
}

/// AVCaptureDeviceDepthSupport.
impl AVCaptureDevice {
    extern_methods!(
        /// The currently active depth data format of the receiver.
        ///
        ///
        /// This property can be used to get or set the device's currently active depth data format. -setActiveDepthDataFormat: throws an NSInvalidArgumentException if set to a format not present in the activeFormat's -supportedDepthDataFormats array. -setActiveDepthDataFormat: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's activeDepthDataFormat by key value observing this property. On devices where depth data is not supported, this property returns nil.
        ///
        /// The frame rate of depth data may not be set directly. Depth data frame rate is synchronized to the device's activeMin/MaxFrameDurations. It may match the device's current frame rate, or lower, if depth data cannot be produced fast enough for the active video frame rate.
        ///
        /// Delivery of depth data to a AVCaptureDepthDataOutput may increase the system load, resulting in a reduced video frame rate for thermal sustainability.
        #[unsafe(method(activeDepthDataFormat))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeDepthDataFormat(&self) -> Option<Retained<AVCaptureDeviceFormat>>;

        /// Setter for [`activeDepthDataFormat`][Self::activeDepthDataFormat].
        #[unsafe(method(setActiveDepthDataFormat:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActiveDepthDataFormat(
            &self,
            active_depth_data_format: Option<&AVCaptureDeviceFormat>,
        );

        #[cfg(feature = "objc2-core-media")]
        /// A property indicating the receiver's current active minimum depth data frame duration (the reciprocal of its maximum depth data frame rate).
        ///
        ///
        /// This property may be used to set an upper limit to the frame rate at which depth data is produced. Lowering the depth data frame rate typically lowers power consumption which will increase the time the camera can run before an elevated system pressure state is reached.
        ///
        /// Setting this property to kCMTimeInvalid resets it to the active depth data format's default min frame duration. Setting this property to kCMTimePositiveInfinity results in a depth data frame rate of 0.
        ///
        /// The activeDepthDataMinFrameDuration gets reset whenever either the active video format or the active depth data format changes.
        ///
        /// -setActiveDepthDataMinFrameDuration: throws an NSRangeException if set to a value that is outside of the active depth data format's supported frame rate range.
        /// -setActiveDepthDataMinFrameDuration: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
        #[unsafe(method(activeDepthDataMinFrameDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeDepthDataMinFrameDuration(&self) -> CMTime;

        #[cfg(feature = "objc2-core-media")]
        /// Setter for [`activeDepthDataMinFrameDuration`][Self::activeDepthDataMinFrameDuration].
        #[unsafe(method(setActiveDepthDataMinFrameDuration:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActiveDepthDataMinFrameDuration(
            &self,
            active_depth_data_min_frame_duration: CMTime,
        );

        #[cfg(feature = "objc2-core-foundation")]
        /// Indicates the minimum zoom factor available for the AVCaptureDevice's videoZoomFactor property.
        ///
        ///
        /// On non-virtual devices the minAvailableVideoZoomFactor is always 1.0. If the device's videoZoomFactor property is assigned a value smaller than 1.0, an NSRangeException is thrown.
        /// On a virtual device the minAvailableVideoZoomFactor can change when the device is delivering depth data to one or more outputs (see -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery]). When depth data delivery is enabled, allowed zoom factor values are governed by -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery] and this contains the absolute minimum zoom of all allowed zoom factors.
        /// Setting the videoZoomFactor to a value greater than or equal to 1.0, but lower than minAvailableVideoZoomFactor results in the value being clamped to the minAvailableVideoZoomFactor. Clients can key value observe the value of this property.
        #[unsafe(method(minAvailableVideoZoomFactor))]
        #[unsafe(method_family = none)]
        pub unsafe fn minAvailableVideoZoomFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Indicates the maximum zoom factor available for the AVCaptureDevice's videoZoomFactor property.
        ///
        ///
        /// On non-virtual devices the maxAvailableVideoZoomFactor is always equal to the activeFormat.videoMaxZoomFactor. If the device's videoZoomFactor property is assigned a value greater than activeFormat.videoMaxZoomFactor, an NSRangeException is thrown.
        /// On a virtual device the maxAvailableVideoZoomFactor can change when the device is delivering depth data to one or more outputs (see -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery]). When depth data delivery is enabled, allowed zoom factor values are governed by -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery] and this contains the absolute maximum zoom of all allowed zoom factors.
        /// Setting the videoZoomFactor to a value less than or equal to activeFormat.videoMaxZoomFactor, but greater than maxAvailableVideoZoomFactor results in the value being clamped to the maxAvailableVideoZoomFactor. Clients can key value observe the value of this property.
        #[unsafe(method(maxAvailableVideoZoomFactor))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxAvailableVideoZoomFactor(&self) -> CGFloat;
    );
}

/// AVCaptureDeviceGeometricDistortionCorrection.
impl AVCaptureDevice {
    extern_methods!(
        /// Indicates that geometric distortion correction is supported by the receiver.
        ///
        ///
        /// Some AVCaptureDevices benefit from geometric distortion correction (GDC), such as devices with a very wide field of view. GDC lessens the fisheye effect at the outer edge of the frame at the cost of losing a small amount of vertical and horizontal field of view. When GDC is enabled on the AVCaptureDevice (see geometricDistortionCorrectionEnabled), the corrected image is upscaled to the original image size when needed.  With respect to the AVCaptureDevice.videoZoomFactor API, the full viewable field of view is always represented with a videoZoomFactor of 1.0. Thus, when GDC is enabled, the AVCaptureDevice.activeFormat's field of view at videoZoomFactor = 1.0 will be different than when GDC is disabled. The smaller field of view is reported through the activeFormat's geometricDistortionCorrectedVideoFieldOfView property. Beware though that RAW photo captures never have GDC applied, regardless of the value of AVCaptureDevice.geometricDistortionCorrectionEnabled.
        #[unsafe(method(isGeometricDistortionCorrectionSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isGeometricDistortionCorrectionSupported(&self) -> bool;

        /// Indicates whether geometric distortion correction is enabled by the receiver.
        ///
        ///
        /// Where supported, the default value is YES. The receiver must be locked for configuration using lockForConfiguration: before clients can set this method, otherwise an NSGenericException is thrown.
        ///
        /// In the case of ProRes RAW, when geometricDistortionCorrectionEnabled is YES, GDC is applied to your outputs in different ways:
        /// - It is always applied to AVCaptureVideoPreviewLayer.
        /// - It is applied to AVCaptureVideoDataOutput only if deliversPreviewSizedOutputBuffers is set to YES.
        /// - It is never applied to AVCaptureMovieFileOutput.
        ///
        /// When GDC is enabled, AVCaptureVideoDataOutput buffers contain GDC metadata attachments, and AVCaptureMovieFileOutput movies contain GDC metadata which an application supporting ProRes RAW can optionally apply at playback time using the ProRes RAW SDK. To learn more about the ProRes RAW SDK, refer to the Apple ProRes and ProRes RAW Authorized Products article at https://support.apple.com/en-us/118584.
        #[unsafe(method(isGeometricDistortionCorrectionEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isGeometricDistortionCorrectionEnabled(&self) -> bool;

        /// Setter for [`isGeometricDistortionCorrectionEnabled`][Self::isGeometricDistortionCorrectionEnabled].
        #[unsafe(method(setGeometricDistortionCorrectionEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setGeometricDistortionCorrectionEnabled(
            &self,
            geometric_distortion_correction_enabled: bool,
        );
    );
}

/// AVCaptureDeviceCalibration.
impl AVCaptureDevice {
    extern_methods!(
        /// An NSData containing the relative extrinsic matrix from one AVCaptureDevice to another.
        ///
        /// Parameter `fromDevice`: The AVCaptureDevice to use as the source. Must be non nil or an NSInvalidArgumentException is thrown.
        ///
        /// Parameter `toDevice`: The AVCaptureDevice to use as the destination. Must be non nil or an NSInvalidArgumentException is thrown.
        ///
        ///
        /// The extrinsic matrix consists of a unitless 3x3 rotation matrix (R) on the left and a translation (t) 3x1 column vector on the right. The translation vector's units are millimeters. The extrinsics of the "toDevice" camera are expressed with respect to a reference camera "fromDevice". If X_from is a 3D point in "fromCamera"'s coordinate system, then it can be projected into "toCamera"'s coordinate system with X_to = [R | t] * X_from. Note that a matrix_float4x3 matrix is column major with 3 rows and 4 columns. The extrinsicMatrix is only provided for physical cameras for which factory calibrations exist. Virtual device cameras return nil.
        /// /
        /// \
        /// /
        /// \
        /// | r1,1  r1,2  r1,3 | t1 |
        /// |R|t| = | r2,1  r2,2  r2,3 | t2 |
        /// \
        /// /   | r3,1  r3,2  r3,3 | t3 |
        /// \
        /// /
        ///
        /// Note that if you enable video stabilization (see AVCaptureConnection.preferredVideoStabilizationMode), the pixels in stabilized video frames no longer match the relative extrinsicMatrix from one device to another due to warping. The extrinsicMatrix and camera intrinsics should only be used when video stabilization is disabled.
        #[unsafe(method(extrinsicMatrixFromDevice:toDevice:))]
        #[unsafe(method_family = none)]
        pub unsafe fn extrinsicMatrixFromDevice_toDevice(
            from_device: &AVCaptureDevice,
            to_device: &AVCaptureDevice,
        ) -> Option<Retained<NSData>>;
    );
}

/// Constants indicating the current Center Stage control mode.
///
///
/// Indicates that the application is unaware of the Center Stage feature. Its enablement is entirely under user control in Control Center.
///
/// Indicates that the application controls the Center Stage feature, disallowing input from the user in Control Center.
///
/// Indicates that both the user and application cooperatively share control of the Center Stage feature.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturecenterstagecontrolmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureCenterStageControlMode(pub NSInteger);
impl AVCaptureCenterStageControlMode {
    #[doc(alias = "AVCaptureCenterStageControlModeUser")]
    pub const User: Self = Self(0);
    #[doc(alias = "AVCaptureCenterStageControlModeApp")]
    pub const App: Self = Self(1);
    #[doc(alias = "AVCaptureCenterStageControlModeCooperative")]
    pub const Cooperative: Self = Self(2);
}

unsafe impl Encode for AVCaptureCenterStageControlMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureCenterStageControlMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// AVCaptureDeviceCenterStage.
impl AVCaptureDevice {
    extern_methods!(
        /// A class property indicating the current mode of Center Stage control (user, app, or cooperative).
        ///
        ///
        /// This class property determines how the Center Stage feature is controlled. When set to the default value of AVCaptureCenterStageControlModeUser, centerStageEnabled may not be set programmatically and throws an NSInvalidArgumentException. In User mode, the feature may only be set by the user in Control Center. If you wish to take Center Stage control away from the user and exclusively enable / disable it programmatically, set this property to AVCaptureCenterStageControlModeApp. When under exclusive app control, Center Stage user control is disallowed (for instance, the toggle is grayed out in Control Center). If you wish to take control of Center Stage, but also cooperate with the user by listening for and appropriately reacting to their changes to the centerStageEnabled property, set this property to AVCaptureCenterStageControlModeCooperative. Note that in this mode, the onus is on you, the app developer, to honor user intent and conform your AVCaptureSession configuration to make Center Stage active (see the AVCaptureDevice instance property centerStageActive). In cooperative mode, the centerStageEnabled property may change at any time (such as when the user enables / disables the feature in Control Center).
        #[unsafe(method(centerStageControlMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn centerStageControlMode() -> AVCaptureCenterStageControlMode;

        /// Setter for [`centerStageControlMode`][Self::centerStageControlMode].
        #[unsafe(method(setCenterStageControlMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCenterStageControlMode(
            center_stage_control_mode: AVCaptureCenterStageControlMode,
        );

        /// A class property indicating whether the Center Stage feature is currently enabled or disabled (such as in Control Center or programmatically via your app).
        ///
        ///
        /// This property may only be set if centerStageControlMode is AVCaptureCenterStageControlModeApp or AVCaptureCenterStageControlModeCooperative, and otherwise throws an NSInvalidArgumentException. When centerStageControlMode is AVCaptureCenterStageControlModeUser or AVCaptureCenterStageControlModeCooperative, this property may change according to user desire (such as enabling / disabling the feature in Control Center), so you should key-value observe it.
        #[unsafe(method(isCenterStageEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isCenterStageEnabled() -> bool;

        /// Setter for [`isCenterStageEnabled`][Self::isCenterStageEnabled].
        #[unsafe(method(setCenterStageEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCenterStageEnabled(center_stage_enabled: bool);

        /// Indicates whether Center Stage is currently active on a particular AVCaptureDevice.
        ///
        ///
        /// This readonly property returns YES when Center Stage is currently active on the receiver. When active, the camera automatically adjusts to keep people optimally framed within the field of view. The field of view may pan, tighten or widen as needed. Certain restrictions come into play when Center Stage is active:
        /// - The device's minAvailableVideoZoomFactor and maxAvailableVideoZoomFactor become restricted (see AVCaptureDeviceFormat's videoMinZoomFactorForCenterStage and videoMaxZoomFactorForCenterStage).
        /// - The device's activeVideoMinFrameDuration and activeVideoMaxFrameDuration are limited (see AVCaptureDeviceFormat's videoFrameRateRangeForCenterStage).
        /// Center Stage may be enabled via user control or application control, depending on the current +AVCaptureDevice.centerStageControlMode. When +AVCaptureDevice.centerStageEnabled is YES, a particular AVCaptureDevice instance may return YES for this property, depending whether it supports the feature in its current configuration. Some device features are mutually exclusive to Center Stage:
        /// - If depth data delivery is enabled on any output, such as AVCaptureDepthDataOutput, or -AVCapturePhotoOutput.depthDataDeliveryEnabled, Center Stage is deactivated.
        /// - If geometricDistortionCorrectionSupported is YES, geometricDistortionCorrectionEnabled must also be YES, or Center Stage is deactivated.
        /// This property is key-value observable.
        #[unsafe(method(isCenterStageActive))]
        #[unsafe(method_family = none)]
        pub unsafe fn isCenterStageActive(&self) -> bool;

        /// Indicates whether the device supports the Center Stage Rect of Interest feature.
        ///
        ///
        /// This property returns YES if the device supports Center Stage Rect of Interest.
        #[unsafe(method(isCenterStageRectOfInterestSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isCenterStageRectOfInterestSupported(&self) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        /// Specifies the effective region within the output pixel buffer that will be used to perform Center Stage framing.
        ///
        ///
        /// Applications that wish to apply additional processing (such as cropping) on top of Center Stage's output can use this property to guide Center Stage's framing.
        ///
        /// The rectangle's origin is top left and is relative to the coordinate space of the output pixel buffer. The default value of this property is the value CGRectMake(0, 0, 1, 1), where {0,0} represents the top left of the picture area, and {1,1} represents the bottom right on an unrotated picture. This rectangle of interest is applied prior to rotation, mirroring or scaling.
        ///
        /// Pixels outside of this rectangle of interest will be blackened out.
        ///
        /// Setting this property has no impact on objects specified in the metadata output.
        ///
        /// -setCenterStageRectOfInterest: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. -setCenterStageRectOfInterest: throws an NSInvalidArgumentException if none of the AVCaptureDeviceFormats supported by the receiver support CenterStage. -setCenterStageRectOfInterest: throws an NSInvalidArgumentException if +centerStageEnabled is NO on the AVCaptureDevice class. -setCenterStageRectOfInterest: throws an NSInvalidArgumentException if the provided rectOfInterest goes outside the normalized (0-1) coordinate space.
        #[unsafe(method(centerStageRectOfInterest))]
        #[unsafe(method_family = none)]
        pub unsafe fn centerStageRectOfInterest(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`centerStageRectOfInterest`][Self::centerStageRectOfInterest].
        #[unsafe(method(setCenterStageRectOfInterest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCenterStageRectOfInterest(&self, center_stage_rect_of_interest: CGRect);
    );
}

/// AVCaptureDevicePortraitEffect.
impl AVCaptureDevice {
    extern_methods!(
        /// A class property indicating whether the Portrait Effect feature is currently enabled in Control Center.
        ///
        ///
        /// This property changes to reflect the Portrait Effect state in Control Center. It is key-value observable. On iOS, Portrait Effect only applies to video conferencing apps by default (apps that use "voip" as one of their UIBackgroundModes). Non video conferencing apps may opt in for the Portrait Effect by adding the following key to their Info.plist:
        /// <key
        /// >NSCameraPortraitEffectEnabled
        /// </key
        /// >
        /// <true
        /// />
        #[unsafe(method(isPortraitEffectEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isPortraitEffectEnabled() -> bool;

        /// Indicates whether Portrait Effect is currently active for a particular AVCaptureDevice.
        ///
        ///
        /// This readonly property returns YES when Portrait Effect is currently active on the receiver. When active, the device blurs the background, simulating a shallow depth of field effect. Certain restrictions come into play when Portrait Effect is active:
        /// - The device's activeVideoMinFrameDuration and activeVideoMaxFrameDuration are limited (see AVCaptureDeviceFormat's videoFrameRateRangeForPortraitEffect).
        /// Note that when +AVCaptureDevice.portraitEffectEnabled is YES, a particular AVCaptureDevice instance may return YES for this property, depending whether it supports the feature in its current configuration.
        /// This property is key-value observable.
        #[unsafe(method(isPortraitEffectActive))]
        #[unsafe(method_family = none)]
        pub unsafe fn isPortraitEffectActive(&self) -> bool;
    );
}

/// AVCaptureDeviceReactionEffects.
impl AVCaptureDevice {
    extern_methods!(
        /// A class property indicating whether the application is suitable for reaction effects, either by automatic gesture detection, or by calls to -[AVCaptureDevice performEffectForReaction:]. Reactions are only rendered when the device's activeFormat.reactionEffectsSupported is also YES, which will be reflected by canPerformReactionEffects when the feature is both enabled and supported.
        ///
        ///
        /// On macOS, Reaction Effects are enabled by default for all applications. On iOS, Reaction Effects are enabled by default for video conferencing applications (apps that use "voip" as one of their UIBackgroundModes). Non video conferencing applications may opt in for Reaction Effects by adding the following key to their Info.plist:
        /// <key
        /// >NSCameraReactionEffectsEnabled
        /// </key
        /// >
        /// <true
        /// />
        #[unsafe(method(reactionEffectsEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn reactionEffectsEnabled() -> bool;

        /// A class property indicating whether gesture detection will trigger reaction effects on the video stream. Gesture detection will only run when the device's activeFormat.reactionEffectsSupported is also YES, which will be reflected by canPerformReactionEffects.
        ///
        ///
        /// This property changes to reflect the Gestures state in Control Center. It is key-value observable. Clients can call performEffectForReaction: independently of whether gesture detection is enabled, reaction effects from either source will be intermixed.
        /// By default, gesture detection is enabled.  As of iOS 17.4 and macOS 14.4, applications can control the default value of this property by adding the following key to their Info.plist:
        /// <key
        /// >NSCameraReactionEffectGesturesEnabledDefault
        /// </key
        /// >
        /// A value of true enables gesture detection and a value of false disables it, until such time that the user makes their own selection in Control Center.
        #[unsafe(method(reactionEffectGesturesEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn reactionEffectGesturesEnabled() -> bool;

        /// Indicates whether reactions can be performed on a particular AVCaptureDevice. This requires reactionEffectsEnabled to be YES, as well as using a AVCaptureDeviceFormat with reactionEffectsSupported.
        ///
        ///
        /// This readonly property returns YES when resources for reactions are available on the device instance. When YES, calls to performEffectForReaction: will render on the video feed, otherwise those calls are ignored. It is key-value observable.
        #[unsafe(method(canPerformReactionEffects))]
        #[unsafe(method_family = none)]
        pub unsafe fn canPerformReactionEffects(&self) -> bool;

        #[cfg(feature = "AVCaptureReactions")]
        /// Returns a list of reaction types which can be passed to performEffectForReaction.
        ///
        ///
        /// The list may differ between devices, or be affected by changes to active format, and can be key-value observed.
        #[unsafe(method(availableReactionTypes))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableReactionTypes(&self) -> Retained<NSSet<AVCaptureReactionType>>;

        #[cfg(feature = "AVCaptureReactions")]
        /// Triggers a specified reaction on the video stream.
        ///
        ///
        /// Parameter `reactionType`: Indicates which reaction to perform.
        ///
        ///
        /// The entries in reactionEffectsInProgress may not reflect one-to-one against calls to this method. Depending on reaction style or resource limits, triggering multiple overlapping reactions of the same type may be coalesced into extending an existing reaction rather than overlaying a new one.
        ///
        /// The reactionType requested must be one of those listed in availableReactionTypes or an exception will be thrown. Performing a reaction when canPerformReactionEffects is NO is ignored, and VoIP applications are encouraged to transmit and display such reactions outside of the video feed.
        #[unsafe(method(performEffectForReaction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn performEffectForReaction(&self, reaction_type: &AVCaptureReactionType);

        #[cfg(feature = "AVCaptureReactions")]
        /// Contains an array of reaction effects that are currently being performed by the device, sorted by timestamp. If observing old and new values in the KVO callback, the reaction effects which are still running in the new array will have kCMTimeInvalid as their endTime property. Reaction effects which have ended will only be in the old array, and will have their endTime property set to the presentation time of the first frame where the reaction effect was no longer present.
        ///
        ///
        /// Reaction effects which are triggered by either a call to performEffectForReaction: or by the automatic gesture detection will be reflected in this array. It is key-value observable to be notified when reaction effects begin or end.
        #[unsafe(method(reactionEffectsInProgress))]
        #[unsafe(method_family = none)]
        pub unsafe fn reactionEffectsInProgress(
            &self,
        ) -> Retained<NSArray<AVCaptureReactionEffectState>>;
    );
}

/// AVCaptureDeviceBackgroundReplacement.
impl AVCaptureDevice {
    extern_methods!(
        /// A class property indicating whether the user has enabled the Background Replacement feature for this application.
        #[unsafe(method(isBackgroundReplacementEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isBackgroundReplacementEnabled() -> bool;

        /// Indicates whether Background Replacement is currently active on a particular AVCaptureDevice.
        ///
        ///
        /// This property is key-value observable.
        #[unsafe(method(isBackgroundReplacementActive))]
        #[unsafe(method_family = none)]
        pub unsafe fn isBackgroundReplacementActive(&self) -> bool;
    );
}

/// AVCaptureDeviceContinuityCamera.
impl AVCaptureDevice {
    extern_methods!(
        /// A property that reports YES if the receiver is a Continuity Camera.
        ///
        ///
        /// Access this property to discover if the receiver is a Continuity Camera (external iPhone webcam).
        #[unsafe(method(isContinuityCamera))]
        #[unsafe(method_family = none)]
        pub unsafe fn isContinuityCamera(&self) -> bool;
    );
}

/// AVCaptureDeviceDeskViewCamera.
impl AVCaptureDevice {
    extern_methods!(
        /// A reference to the Desk View Camera that is associated with and derived from this camera.
        ///
        ///
        /// The companionDeskViewCamera property allows you to discover if the receiver has a paired Desk View Camera which derives its desk framing from the receiver's ultra wide frame. In the presence of multiple Continuity Cameras, this property allows you to pair a particular Continuity Camera with its associated Desk View Camera.
        #[unsafe(method(companionDeskViewCamera))]
        #[unsafe(method_family = none)]
        pub unsafe fn companionDeskViewCamera(&self) -> Option<Retained<AVCaptureDevice>>;
    );
}

/// Constants describing microphone filtering modes.
///
///
/// Indicates that microphone audio is being processed with standard voice DSP.
///
/// Indicates that microphone audio processing is minimized to capture all sounds in the room.
///
/// Indicates that microphone audio is being processed to isolate the voice and attenuate other signals.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturemicrophonemode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureMicrophoneMode(pub NSInteger);
impl AVCaptureMicrophoneMode {
    #[doc(alias = "AVCaptureMicrophoneModeStandard")]
    pub const Standard: Self = Self(0);
    #[doc(alias = "AVCaptureMicrophoneModeWideSpectrum")]
    pub const WideSpectrum: Self = Self(1);
    #[doc(alias = "AVCaptureMicrophoneModeVoiceIsolation")]
    pub const VoiceIsolation: Self = Self(2);
}

unsafe impl Encode for AVCaptureMicrophoneMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureMicrophoneMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// AVCaptureMicrophoneMode.
impl AVCaptureDevice {
    extern_methods!(
        /// Indicates the microphone mode that has been selected by the user in Control Center.
        ///
        ///
        /// This readonly property returns the microphone mode selected by the user in Control Center. It is key-value observable.
        #[unsafe(method(preferredMicrophoneMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn preferredMicrophoneMode() -> AVCaptureMicrophoneMode;

        /// Indicates the currently active microphone mode.
        ///
        ///
        /// This readonly property returns the currently active microphone mode, which may differ from the preferredMicrophoneMode if the application's active audio route does not support the preferred microphone mode. This property is key-value observable.
        #[unsafe(method(activeMicrophoneMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeMicrophoneMode() -> AVCaptureMicrophoneMode;
    );
}

/// Constants describing the system user interfaces available to +showSystemUserInterface:.
///
///
/// Indicates the system UI for enabling / disabling video effects.
///
/// Indicates the system UI for selecting microphone modes.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesystemuserinterface?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureSystemUserInterface(pub NSInteger);
impl AVCaptureSystemUserInterface {
    #[doc(alias = "AVCaptureSystemUserInterfaceVideoEffects")]
    pub const VideoEffects: Self = Self(1);
    #[doc(alias = "AVCaptureSystemUserInterfaceMicrophoneModes")]
    pub const MicrophoneModes: Self = Self(2);
}

unsafe impl Encode for AVCaptureSystemUserInterface {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureSystemUserInterface {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// AVCaptureSystemUserInterface.
impl AVCaptureDevice {
    extern_methods!(
        /// Displays the system's user interface for video effects or microphone modes.
        ///
        ///
        /// Parameter `systemUserInterface`: The system UI to show.
        ///
        ///
        /// This method allows the calling application to prompt the user to make changes to Video Effects (such as Center Stage or the Portrait Effect) or Microphone Modes. It brings up the system user interface and deep links to the appropriate module. This method is non-blocking. After presenting the desired system user interface, control returns immediately to the application.
        #[unsafe(method(showSystemUserInterface:))]
        #[unsafe(method_family = none)]
        pub unsafe fn showSystemUserInterface(system_user_interface: AVCaptureSystemUserInterface);
    );
}

/// AVSpatialCaptureDiscomfortReason string constants
///
///
/// The AVSpatialCaptureDiscomfortReason string constants are used to report the applicability of the current scene to create a comfortable viewing experience.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avspatialcapturediscomfortreason?language=objc)
// NS_TYPED_ENUM
pub type AVSpatialCaptureDiscomfortReason = NSString;

extern "C" {
    /// The lighting of the current scene is not bright enough; the playback experience will likely be uncomfortable due to noise differences between the two cameras.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avspatialcapturediscomfortreasonnotenoughlight?language=objc)
    pub static AVSpatialCaptureDiscomfortReasonNotEnoughLight:
        &'static AVSpatialCaptureDiscomfortReason;
}

extern "C" {
    /// The focus point of the current scene is too close; the playback experience will likely be uncomfortable due to the subject being closer than the minimum focus distance of one or both of the lenses.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avspatialcapturediscomfortreasonsubjecttooclose?language=objc)
    pub static AVSpatialCaptureDiscomfortReasonSubjectTooClose:
        &'static AVSpatialCaptureDiscomfortReason;
}

/// AVCaptureDeviceSpatialCapture.
impl AVCaptureDevice {
    extern_methods!(
        /// Indicates whether or not the current environmental conditions are amenable to a spatial capture that is comfortable to view.
        ///
        ///
        /// This property can be monitored in order to determine the presentation of UI elements to inform the user that they should reframe their scene for a more pleasing spatial capture ("subject is too close", "scene is too dark").
        #[unsafe(method(spatialCaptureDiscomfortReasons))]
        #[unsafe(method_family = none)]
        pub unsafe fn spatialCaptureDiscomfortReasons(
            &self,
        ) -> Retained<NSSet<AVSpatialCaptureDiscomfortReason>>;
    );
}

/// An informative status about the scene observed by the device.
///
/// Some features have certain requirements on the scene (lighting condition for Cinematic Video, for example) to produce optimal results; these ``AVCaptureSceneMonitoringStatus`` string constants are used to represent such scene statuses for a given feature.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturescenemonitoringstatus?language=objc)
// NS_TYPED_ENUM
pub type AVCaptureSceneMonitoringStatus = NSString;

extern "C" {
    /// The light level of the current scene is insufficient for the current set of features to function optimally.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturescenemonitoringstatusnotenoughlight?language=objc)
    pub static AVCaptureSceneMonitoringStatusNotEnoughLight:
        &'static AVCaptureSceneMonitoringStatus;
}

/// AVCaptureDeviceCinematicVideoCapture.
impl AVCaptureDevice {
    extern_methods!(
        /// The current scene monitoring statuses related to Cinematic Video capture.
        ///
        /// Monitor this property via key-value observation to present a UI informing the user that they should reframe their scene for a better Cinematic Video experience ("scene is too dark").
        #[unsafe(method(cinematicVideoCaptureSceneMonitoringStatuses))]
        #[unsafe(method_family = none)]
        pub unsafe fn cinematicVideoCaptureSceneMonitoringStatuses(
            &self,
        ) -> Retained<NSSet<AVCaptureSceneMonitoringStatus>>;
    );
}

/// String constants describing the different video aspect ratios you can configure for a particular device.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureaspectratio?language=objc)
// NS_TYPED_ENUM
pub type AVCaptureAspectRatio = NSString;

extern "C" {
    /// An aspect ratio of 1x1.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureaspectratio1x1?language=objc)
    pub static AVCaptureAspectRatio1x1: &'static AVCaptureAspectRatio;
}

extern "C" {
    /// An aspect ratio of 16x9.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureaspectratio16x9?language=objc)
    pub static AVCaptureAspectRatio16x9: &'static AVCaptureAspectRatio;
}

extern "C" {
    /// An aspect ratio of 9x16.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureaspectratio9x16?language=objc)
    pub static AVCaptureAspectRatio9x16: &'static AVCaptureAspectRatio;
}

extern "C" {
    /// An aspect ratio of 4x3.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureaspectratio4x3?language=objc)
    pub static AVCaptureAspectRatio4x3: &'static AVCaptureAspectRatio;
}

extern "C" {
    /// An aspect ratio of 3x4.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureaspectratio3x4?language=objc)
    pub static AVCaptureAspectRatio3x4: &'static AVCaptureAspectRatio;
}

/// DynamicAspectRatio.
impl AVCaptureDevice {
    extern_methods!(
        /// A key-value observable property indicating the current aspect ratio for a device.
        ///
        /// This property is initialized to the first ``AVCaptureAspectRatio`` listed in the device's activeFormat's ``AVCaptureDeviceFormat/supportedDynamicAspectRatios`` property. If the activeFormat's ``AVCaptureDeviceFormat/supportedDynamicAspectRatios`` is an empty array, this property returns nil.
        #[unsafe(method(dynamicAspectRatio))]
        #[unsafe(method_family = none)]
        pub unsafe fn dynamicAspectRatio(&self) -> Option<Retained<AVCaptureAspectRatio>>;

        #[cfg(feature = "objc2-core-media")]
        /// A key-value observable property describing the output dimensions of the video buffer based on the device's dynamic aspect ratio.
        ///
        /// If the device's activeFormat's ``AVCaptureDeviceFormat/supportedDynamicAspectRatios`` is an empty array, this property returns {0,0}.
        #[unsafe(method(dynamicDimensions))]
        #[unsafe(method_family = none)]
        pub unsafe fn dynamicDimensions(&self) -> CMVideoDimensions;

        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
        /// Updates the dynamic aspect ratio of the device.
        ///
        /// - Parameter dynamicAspectRatio: The new ``AVCaptureAspectRatio`` the device should output.
        /// - Parameter handler: A block called by the device when `dynamicAspectRatio` is set to the value specified. If you call ``setDynamicAspectRatio:completionHandler:`` multiple times, the completion handlers are called in FIFO order. The block receives a timestamp which matches that of the first buffer to which all settings have been applied. Note that the timestamp is synchronized to the device clock, and thus must be converted to the ``AVCaptureSession/synchronizationClock`` prior to comparison with the timestamps of buffers delivered via an ``AVCaptureVideoDataOutput``. You may pass `nil` for the `handler` parameter if you do not need to know when the operation completes.
        ///
        /// This is the only way of setting ``dynamicAspectRatio``. This method throws an `NSInvalidArgumentException` if `dynamicAspectRatio` is not a supported aspect ratio found in the device's activeFormat's ``AVCaptureDeviceFormat/supportedDynamicAspectRatios``. This method throws an `NSGenericException` if you call it without first obtaining exclusive access to the device using ``AVCaptureDevice/lockForConfiguration:``.
        #[unsafe(method(setDynamicAspectRatio:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDynamicAspectRatio_completionHandler(
            &self,
            dynamic_aspect_ratio: &AVCaptureAspectRatio,
            handler: Option<&block2::DynBlock<dyn Fn(CMTime, *mut NSError)>>,
        );
    );
}

/// AVCaptureDeviceSmartFraming.
impl AVCaptureDevice {
    extern_methods!(
        /// A monitor owned by the device that recommends an optimal framing based on the content in the scene.
        ///
        /// An ultra wide camera device that supports dynamic aspect ratio configuration may also support "smart framing monitoring". If this property returns non `nil`, you may use it to listen for framing recommendations by configuring its ``AVCaptureSmartFramingMonitor/enabledFramings`` and calling ``AVCaptureSmartFramingMonitor/startMonitoringWithError:``. The smart framing monitor only makes recommendations when the current ``AVCaptureDevice/activeFormat`` supports smart framing (see ``AVCaptureDeviceFormat/smartFramingSupported``).
        #[unsafe(method(smartFramingMonitor))]
        #[unsafe(method_family = none)]
        pub unsafe fn smartFramingMonitor(&self) -> Option<Retained<AVCaptureSmartFramingMonitor>>;
    );
}

extern_class!(
    /// An object associated with a capture device that monitors the scene and suggests an optimal framing.
    ///
    /// A smart framing monitor observes its associated device for objects of interest entering and exiting the camera's field of view and recommends an optimal framing for good photographic composition. This framing recommendation consists of an aspect ratio and zoom factor. You may respond to the device's framing recommendation by calling ``AVCaptureDevice/setDynamicAspectRatio:completionHandler:`` and setting ``AVCaptureDevice/videoZoomFactor`` on the associated device in whatever order best matches your animation between old and new framings.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesmartframingmonitor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVCaptureSmartFramingMonitor;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for AVCaptureSmartFramingMonitor {}
);

impl AVCaptureSmartFramingMonitor {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        /// An array of framings supported by the monitor in its current configuration.
        ///
        /// The monitor is capable of recommending any of the framings in this array. This property is key-value observable and may change as the target capture device's ``AVCaptureDevice/activeFormat`` property changes. This array contains the full set of framings supported by the monitor in the device's current configuration. You must tell the monitor which smart framings you are interested in having recommended to you by setting the ``enabledFramings`` property.
        #[unsafe(method(supportedFramings))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportedFramings(&self) -> Retained<NSArray<AVCaptureFraming>>;

        /// An array of framings that the monitor is allowed to suggest.
        ///
        /// The monitor is capable of recommending any of the framings in the ``supportedFramings`` array. This property contains the subset of ``supportedFramings`` you would like to have recommended to you. You may set this property at any time while running your ``AVCaptureSession``. This property's default value is the empty array.
        #[unsafe(method(enabledFramings))]
        #[unsafe(method_family = none)]
        pub unsafe fn enabledFramings(&self) -> Retained<NSArray<AVCaptureFraming>>;

        /// Setter for [`enabledFramings`][Self::enabledFramings].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setEnabledFramings:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setEnabledFramings(&self, enabled_framings: &NSArray<AVCaptureFraming>);

        /// The latest recommended framing from the monitor.
        ///
        /// While your ``AVCaptureSession`` is running, the monitor continuously observes its device's scene to recommend the best framing. This recommended framing is always one of the values in ``enabledFramings``. This property may return `nil` if smart framing isn't supported for the device in its current configuration. Its default value is `nil`. This property is key-value observable, and when you observe a change, you may respond to the new recommendation by calling ``AVCaptureDevice/setDynamicAspectRatio:completionHandler:`` and setting ``AVCaptureDevice/videoZoomFactor`` on the associated device in whatever order best matches your animation between old and new framings.
        #[unsafe(method(recommendedFraming))]
        #[unsafe(method_family = none)]
        pub unsafe fn recommendedFraming(&self) -> Option<Retained<AVCaptureFraming>>;

        /// Begins monitoring the device's active scene and making framing recommendations.
        ///
        /// - Parameter outError: A pointer to an ``NSError`` indicating why ``startMonitoringWithError:`` failed, or to a `nil` ``NSError`` on success.
        /// - Returns: `true` if successful, `false` if monitoring could not be started.
        ///
        /// The monitor's ``recommendedFraming`` is `nil` when it is not actively running. Call this method to start monitoring. You may start monitoring before or after calling ``AVCaptureSession/startRunning``,  and you may stop active monitoring without stopping the capture session by calling ``stopMonitoring`` at any time, but you must set ``enabledFramings`` before running your capture session so that the monitor is prepared for your desired framing recommendations. While the monitor is running, you may set ``enabledFramings`` at any time to change the framing choices the monitor should consider in its recommendations.
        #[unsafe(method(startMonitoringWithError:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn startMonitoringWithError(&self) -> Result<(), Retained<NSError>>;

        /// Stops monitoring the device's active scene and making framing recommendations.
        ///
        /// The monitor's ``recommendedFraming`` is `nil` when it is not actively running. Call this method to stop actively monitoring the scene and making framing recommendations. You may start monitoring before or after calling ``AVCaptureSession/startRunning``, and may stop active monitoring without stopping the capture session by calling ``stopMonitoring`` at any time.
        #[unsafe(method(stopMonitoring))]
        #[unsafe(method_family = none)]
        pub unsafe fn stopMonitoring(&self);

        /// Yes when the receiver is actively monitoring.
        ///
        /// See ``startMonitoringWithError:`` and ``stopMonitoring``.
        #[unsafe(method(isMonitoring))]
        #[unsafe(method_family = none)]
        pub unsafe fn isMonitoring(&self) -> bool;
    );
}

extern_class!(
    /// A framing, consisting of an aspect ratio and a zoom factor.
    ///
    /// An ``AVCaptureSmartFramingMonitor`` provides framing recommendations using this object.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureframing?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVCaptureFraming;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for AVCaptureFraming {}
);

impl AVCaptureFraming {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        /// An aspect ratio.
        ///
        /// One of the enumerated aspect ratios  suitable for use with the ``AVCaptureDevice`` dynamic aspect ratio APIs.
        #[unsafe(method(aspectRatio))]
        #[unsafe(method_family = none)]
        pub unsafe fn aspectRatio(&self) -> Retained<AVCaptureAspectRatio>;

        /// A zoom factor.
        ///
        /// Suitable for use with the ``AVCaptureDevice/videoZoomFactor`` property or ``AVCaptureDevice/rampToVideoZoomFactor:withRate:``.
        #[unsafe(method(zoomFactor))]
        #[unsafe(method_family = none)]
        pub unsafe fn zoomFactor(&self) -> c_float;
    );
}

/// AVCaptureDeviceNominalFocalLengthIn35mmFilm.
impl AVCaptureDevice {
    extern_methods!(
        /// The nominal 35mm equivalent focal length of the capture device's lens.
        ///
        /// This value represents a nominal measurement of the device's field of view, expressed as a 35mm equivalent focal length, measured diagonally. The value is similar to the `FocalLengthIn35mmFormat` EXIF entry (see
        /// <doc
        /// ://com.apple.documentation/documentation/imageio/kcgimagepropertyexiffocallenin35mmfilm>) for a photo captured using the device's format where ``AVCaptureDeviceFormat/highestPhotoQualitySupported`` is `true` or when you've configured the session with the ``AVCaptureSessionPresetPhoto`` preset.
        ///
        /// This property value is `0` for virtual devices and external cameras.
        #[unsafe(method(nominalFocalLengthIn35mmFilm))]
        #[unsafe(method_family = none)]
        pub unsafe fn nominalFocalLengthIn35mmFilm(&self) -> c_float;
    );
}

extern_class!(
    /// The AVCaptureDeviceDiscoverySession allows clients to search for devices by certain criteria.
    ///
    ///
    /// This class allows clients to discover devices by providing certain search criteria. The objective of this class is to help find devices by device type and optionally by media type or position and allow you to key-value observe changes to the returned devices list.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicediscoverysession?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVCaptureDeviceDiscoverySession;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for AVCaptureDeviceDiscoverySession {}
);

impl AVCaptureDeviceDiscoverySession {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[cfg(feature = "AVMediaFormat")]
        /// Returns an AVCaptureDeviceDiscoverySession instance for the given device types, media type, and position.
        ///
        ///
        /// Parameter `deviceTypes`: An array specifying the device types to include in the list of discovered devices.
        ///
        /// Parameter `mediaType`: The media type, such as AVMediaTypeVideo, AVMediaTypeAudio, or AVMediaTypeMuxed, to include in the list of discovered devices. Pass nil to search for devices with any media type.
        ///
        /// Parameter `position`: The position to include in the list of discovered devices. Pass AVCaptureDevicePositionUnspecified to search for devices with any position.
        ///
        /// Returns: The AVCaptureDeviceDiscoverySession from which the list of devices can be obtained.
        ///
        ///
        /// The list of device types is mandatory. This is used to make sure that clients only get access to devices of types they expect. This prevents new device types from automatically being included in the list of devices.
        #[unsafe(method(discoverySessionWithDeviceTypes:mediaType:position:))]
        #[unsafe(method_family = none)]
        pub unsafe fn discoverySessionWithDeviceTypes_mediaType_position(
            device_types: &NSArray<AVCaptureDeviceType>,
            media_type: Option<&AVMediaType>,
            position: AVCaptureDevicePosition,
        ) -> Retained<Self>;

        /// The list of devices that comply to the search criteria specified on the discovery session.
        ///
        ///
        /// The returned array contains only devices that are available at the time the method is called. Applications can key-value observe this property to be notified when the list of available devices has changed. For apps linked against iOS 10, the devices returned are unsorted. For apps linked against iOS 11 or later, the devices are sorted by AVCaptureDeviceType, matching the order specified in the deviceTypes parameter of +[AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:mediaType:position:]. If a position of AVCaptureDevicePositionUnspecified is specified, the results are further ordered by position in the AVCaptureDevicePosition enum. Starting in Mac Catalyst 14.0, clients can key value observe the value of this property to be notified when the devices change.
        #[unsafe(method(devices))]
        #[unsafe(method_family = none)]
        pub unsafe fn devices(&self) -> Retained<NSArray<AVCaptureDevice>>;

        /// An array of sets of AVCaptureDevices that are allowed to be used simultaneously in an AVCaptureMultiCamSession.
        ///
        ///
        /// When using an AVCaptureMultiCamSession, multiple cameras may be used as device inputs to the session, so long as they are included in one of the supportedMultiCamDeviceSets. Starting in Mac Catalyst 14.0, clients can key value observe the value of this property to be notified when the device sets change.
        #[unsafe(method(supportedMultiCamDeviceSets))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportedMultiCamDeviceSets(
            &self,
        ) -> Retained<NSArray<NSSet<AVCaptureDevice>>>;
    );
}

extern_class!(
    /// The AVCaptureDeviceRotationCoordinator allows clients to monitor rotations of a given AVCaptureDevice instance and be provided the video rotation angle that should be applied for horizon-level preview and capture relative to gravity.
    ///
    ///
    /// Each instance of AVCaptureDeviceRotationCoordinator allows a client to coordinate with changes to the rotation of an AVCaptureDevice to ensure the camera's video preview and captured output are horizon-level. The coordinator delivers key-value updates on the main queue.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicerotationcoordinator?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVCaptureDeviceRotationCoordinator;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for AVCaptureDeviceRotationCoordinator {}
);

impl AVCaptureDeviceRotationCoordinator {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[cfg(feature = "objc2-quartz-core")]
        #[cfg(not(target_os = "watchos"))]
        /// Returns an AVCaptureDeviceRotationCoordinator instance that provides updates to the amount of rotation that should be applied for horizon-level preview and capture relative to gravity.
        ///
        ///
        /// Parameter `device`: The device for which to monitor rotation.
        ///
        /// Parameter `previewLayer`: A layer displaying the camera's video preview. If nil, the coordinator will return 0 degrees of rotation for horizon-level preview.
        ///
        /// Returns: An AVCaptureDeviceRotationCoordinator from which rotation angles for preview and capture can be obtained.
        ///
        ///
        /// An AVCaptureDeviceRotationCoordinator is only applicable to video devices. The given device and layer determine the amount of rotation that should be applied for horizon-level preview and capture.
        #[unsafe(method(initWithDevice:previewLayer:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDevice_previewLayer(
            this: Allocated<Self>,
            device: &AVCaptureDevice,
            preview_layer: Option<&CALayer>,
        ) -> Retained<Self>;

        /// The the device for which the coordinator provides video rotation angles.
        ///
        ///
        /// The value of this property is the AVCaptureDevice instance that was used to create the coordinator. The coordinator holds a weak reference to the device.
        #[unsafe(method(device))]
        #[unsafe(method_family = none)]
        pub unsafe fn device(&self) -> Option<Retained<AVCaptureDevice>>;

        #[cfg(feature = "objc2-quartz-core")]
        #[cfg(not(target_os = "watchos"))]
        /// The CALayer for which the coordinator calculates video rotation angles for horizon-level preview.
        ///
        ///
        /// The value of this property is the CALayer instance that was used to create the coordinator. Clients may specify an AVCaptureVideoPreviewLayer or other CALayer instance that displays a camera's video preview. The coordinator holds a weak reference to the layer. The coordinator will return 0 degrees of rotation from -videoRotationAngleForHorizonLevelPreview if a layer was not specified at initialization, the layer is not in a view hierarchy, or the layer has been deallocated.
        #[unsafe(method(previewLayer))]
        #[unsafe(method_family = none)]
        pub unsafe fn previewLayer(&self) -> Option<Retained<CALayer>>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Returns a video rotation angle in degrees for displaying the camera's video preview in the given CALayer.
        ///
        ///
        /// The video rotation angle represents by how much the camera's video preview should be rotated for display in the CALayer to be horizon-level relative to gravity. An angle of 0 degrees means that video will be output in the camera's unrotated, native sensor orientation. The video rotation angle for preview may differ between cameras at different positions. For example when an iOS device is held in portrait orientation, the video preview for built-in cameras may need to be rotated by 90 degrees while the video preview for an external camera should not be rotated. External cameras return 0 degrees of rotation even if they physically rotate when their position in physical space is unknown. This property is key-value observable and delivers updates on the main queue.
        #[unsafe(method(videoRotationAngleForHorizonLevelPreview))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoRotationAngleForHorizonLevelPreview(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Returns a video rotation angle in degrees for horizon-level capture from this camera.
        ///
        ///
        /// The video rotation angle represents by how much the photos or movies captured from the camera should be rotated to be horizon-level relative to gravity. A video rotation angle of 0 degrees means that the output will be in the camera's unrotated, native sensor orientation. The video rotation angle for capture may differ between cameras. For example when an iOS device is held in portrait orientation, photos and movies captured from built-in cameras may need to be rotated by 90 degrees while the photos and movies from an external camera should not be rotated. External cameras return 0 degrees of rotation even if they physically rotate when their position in physical space is unknown. The video rotation angle returned from this property is distinct from the angle returned by -videoRotationAngleForHorizonLevelPreview because in certain combinations of device and interface orientations, the video rotation angle needed for horizon-level preview may not match the amount of rotation needed for horizon-level capture. This property is key-value observable and delivers updates on the main queue.
        #[unsafe(method(videoRotationAngleForHorizonLevelCapture))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoRotationAngleForHorizonLevelCapture(&self) -> CGFloat;
    );
}

extern_class!(
    /// An AVExposureBiasRange expresses an inclusive range of supported exposure bias values, in EV units.
    ///
    ///
    /// This is used by AVCaptureSystemExposureBiasSlider for the range the slider uses.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avexposurebiasrange?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVExposureBiasRange;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for AVExposureBiasRange {}
);

impl AVExposureBiasRange {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        /// A float indicating the minimum exposure bias in EV units supported by this range.
        #[unsafe(method(minExposureBias))]
        #[unsafe(method_family = none)]
        pub unsafe fn minExposureBias(&self) -> c_float;

        /// A float indicating the maximum exposure bias in EV units supported by this range.
        #[unsafe(method(maxExposureBias))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxExposureBias(&self) -> c_float;

        /// Tests if a given exposure bias in EV units is within the exposure bias range.
        ///
        ///
        /// Parameter `exposureBias`: The exposure bias to test.
        ///
        /// Returns: Returns YES if the given exposure bias is within the exposure bias, NO otherwise.
        ///
        ///
        /// Note that the exposure bias ranges are inclusive.
        #[unsafe(method(containsExposureBias:))]
        #[unsafe(method_family = none)]
        pub unsafe fn containsExposureBias(&self, exposure_bias: c_float) -> bool;
    );
}

extern_class!(
    /// An AVFrameRateRange expresses a range of valid frame rates as min and max rate and min and max duration.
    ///
    ///
    /// An AVCaptureDevice exposes an array of formats, and its current activeFormat may be queried. The payload for the formats property is an array of AVCaptureDeviceFormat objects and the activeFormat property payload is an AVCaptureDeviceFormat. AVCaptureDeviceFormat wraps a CMFormatDescription and expresses a range of valid video frame rates as an NSArray of AVFrameRateRange objects. AVFrameRateRange expresses min and max frame rate as a rate in frames per second and duration (CMTime). An AVFrameRateRange object is immutable. Its values do not change for the life of the object.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avframeraterange?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVFrameRateRange;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for AVFrameRateRange {}
);

impl AVFrameRateRange {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        /// A Float64 indicating the minimum frame rate supported by this range.
        ///
        ///
        /// This read-only property indicates the minimum frame rate supported by this range in frames per second.
        #[unsafe(method(minFrameRate))]
        #[unsafe(method_family = none)]
        pub unsafe fn minFrameRate(&self) -> f64;

        /// A Float64 indicating the maximum frame rate supported by this range.
        ///
        ///
        /// This read-only property indicates the maximum frame rate supported by this range in frames per second.
        #[unsafe(method(maxFrameRate))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxFrameRate(&self) -> f64;

        #[cfg(feature = "objc2-core-media")]
        /// A CMTime indicating the maximum frame duration supported by this range.
        ///
        ///
        /// This read-only property indicates the maximum frame duration supported by this range. It is the reciprocal of minFrameRate, and expresses minFrameRate as a duration.
        #[unsafe(method(maxFrameDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxFrameDuration(&self) -> CMTime;

        #[cfg(feature = "objc2-core-media")]
        /// A CMTime indicating the minimum frame duration supported by this range.
        ///
        ///
        /// This read-only property indicates the minimum frame duration supported by this range. It is the reciprocal of maxFrameRate, and expresses maxFrameRate as a duration.
        #[unsafe(method(minFrameDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn minFrameDuration(&self) -> CMTime;
    );
}

extern_class!(
    /// An AVZoomRange expresses an inclusive range of supported zoom factors.
    ///
    ///
    /// This is used by features that have requirements on zoom factors falling within certain ranges.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avzoomrange?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVZoomRange;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for AVZoomRange {}
);

impl AVZoomRange {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// A CGFloat indicating the minimum zoom factor supported by this range.
        #[unsafe(method(minZoomFactor))]
        #[unsafe(method_family = none)]
        pub unsafe fn minZoomFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// A CGFloat indicating the maximum zoom factor supported by this range.
        #[unsafe(method(maxZoomFactor))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxZoomFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Tests if a given zoom factor is within the zoom range.
        ///
        /// Parameter `zoomFactor`: The zoom factor to test.
        ///
        /// Returns: Returns YES if the given zoom factor is within the zoom range, NO otherwise.
        ///
        /// Note that the zoom ranges are inclusive.
        #[unsafe(method(containsZoomFactor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn containsZoomFactor(&self, zoom_factor: CGFloat) -> bool;
    );
}

/// Constants indicating the modes of video stabilization supported by the device's format.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideostabilizationmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureVideoStabilizationMode(pub NSInteger);
impl AVCaptureVideoStabilizationMode {
    /// Indicates that video should not be stabilized.
    #[doc(alias = "AVCaptureVideoStabilizationModeOff")]
    pub const Off: Self = Self(0);
    /// Indicates that video should be stabilized using the standard video stabilization algorithm introduced with iOS 5.0. Standard video stabilization has a reduced field of view. Enabling video stabilization may introduce additional latency into the video capture pipeline.
    #[doc(alias = "AVCaptureVideoStabilizationModeStandard")]
    pub const Standard: Self = Self(1);
    /// Indicates that video should be stabilized using the cinematic stabilization algorithm for more dramatic results. Cinematic video stabilization has a reduced field of view compared to standard video stabilization. Enabling cinematic video stabilization introduces much more latency into the video capture pipeline than standard video stabilization and consumes significantly more system memory. Use narrow or identical min and max frame durations in conjunction with this mode.
    #[doc(alias = "AVCaptureVideoStabilizationModeCinematic")]
    pub const Cinematic: Self = Self(2);
    /// Indicates that the video should be stabilized using the extended cinematic stabilization algorithm. Enabling extended cinematic stabilization introduces longer latency into the video capture pipeline compared to the ``AVCaptureVideoStabilizationModeCinematic`` and consumes more memory, but yields improved stability. It is recommended to use identical or similar min and max frame durations in conjunction with this mode. Cinematic extended mode is face aware when enabled on a front-facing ultra wide camera on iPhone, and prioritizes stabilization of the subject of the frame rather than the background.
    #[doc(alias = "AVCaptureVideoStabilizationModeCinematicExtended")]
    pub const CinematicExtended: Self = Self(3);
    /// Indicates that video should be stabilized using the preview optimized stabilization algorithm. Preview stabilization is a low latency and low power algorithm which is supported only on connections which either have an associated preview layer or have a preview-sized ``AVCaptureVideoDataOutput``.
    #[doc(alias = "AVCaptureVideoStabilizationModePreviewOptimized")]
    pub const PreviewOptimized: Self = Self(4);
    /// Indicates that the video should be stabilized using the enhanced extended cinematic stabilization algorithm. Enhanced extended cinematic has a reduced field of view compared to extended cinematic, without any noticeable increase in latency, and it yields improved stability. It is recommended to use identical or similar min and max frame durations in conjunction with this mode. Cinematic extended enhanced mode is face aware when enabled on a front-facing ultra wide camera on iPhone, and prioritizes stabilization of the subject of the frame rather than the background.
    #[doc(alias = "AVCaptureVideoStabilizationModeCinematicExtendedEnhanced")]
    pub const CinematicExtendedEnhanced: Self = Self(5);
    /// Indicates that video should be stabilized using the low latency stabilization algorithm. Low Latency stabilization has a reduced field of view. Enabling low latency stabilization introduces no additional latency into the video capture pipeline.
    #[doc(alias = "AVCaptureVideoStabilizationModeLowLatency")]
    pub const LowLatency: Self = Self(6);
    /// Indicates that the most appropriate video stabilization mode for the device and format should be chosen.
    #[doc(alias = "AVCaptureVideoStabilizationModeAuto")]
    pub const Auto: Self = Self(-1);
}

unsafe impl Encode for AVCaptureVideoStabilizationMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureVideoStabilizationMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// Constants indicating the autofocus system.
///
///
/// Indicates that autofocus is not available.
///
/// Indicates that autofocus is achieved by contrast detection. Contrast detection performs a focus scan to find the optimal position.
///
/// Indicates that autofocus is achieved by phase detection. Phase detection has the ability to achieve focus in many cases without a focus scan. Phase detection autofocus is typically less visually intrusive than contrast detection autofocus.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureautofocussystem?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureAutoFocusSystem(pub NSInteger);
impl AVCaptureAutoFocusSystem {
    #[doc(alias = "AVCaptureAutoFocusSystemNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "AVCaptureAutoFocusSystemContrastDetection")]
    pub const ContrastDetection: Self = Self(1);
    #[doc(alias = "AVCaptureAutoFocusSystemPhaseDetection")]
    pub const PhaseDetection: Self = Self(2);
}

unsafe impl Encode for AVCaptureAutoFocusSystem {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureAutoFocusSystem {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// An AVCaptureDeviceFormat wraps a CMFormatDescription and other format-related information, such as min and max framerate.
    ///
    ///
    /// An AVCaptureDevice exposes an array of formats, and its current activeFormat may be queried. The payload for the formats property is an array of AVCaptureDeviceFormat objects and the activeFormat property payload is an AVCaptureDeviceFormat. AVCaptureDeviceFormat is a thin wrapper around a CMFormatDescription, and can carry associated device format information that doesn't go in a CMFormatDescription, such as min and max frame rate. An AVCaptureDeviceFormat object is immutable. Its values do not change for the life of the object.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedeviceformat?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVCaptureDeviceFormat;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for AVCaptureDeviceFormat {}
);

impl AVCaptureDeviceFormat {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[cfg(feature = "AVMediaFormat")]
        /// An NSString describing the media type of an AVCaptureDevice active or supported format.
        ///
        ///
        /// Supported mediaTypes are listed in AVMediaFormat.h. This is a read-only property. The caller assumes no ownership of the returned value and should not CFRelease it.
        #[unsafe(method(mediaType))]
        #[unsafe(method_family = none)]
        pub unsafe fn mediaType(&self) -> Retained<AVMediaType>;

        #[cfg(feature = "objc2-core-media")]
        /// A CMFormatDescription describing an AVCaptureDevice active or supported format.
        ///
        ///
        /// A CMFormatDescription describing an AVCaptureDevice active or supported format. This is a read-only property. The caller assumes no ownership of the returned value and should not CFRelease it.
        #[unsafe(method(formatDescription))]
        #[unsafe(method_family = none)]
        pub unsafe fn formatDescription(&self) -> Retained<CMFormatDescription>;

        /// A property indicating the format's supported frame rate ranges.
        ///
        ///
        /// videoSupportedFrameRateRanges is an array of AVFrameRateRange objects, one for each of the format's supported video frame rate ranges.
        #[unsafe(method(videoSupportedFrameRateRanges))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoSupportedFrameRateRanges(&self) -> Retained<NSArray<AVFrameRateRange>>;

        /// A property indicating the format's horizontal field of view.
        ///
        ///
        /// videoFieldOfView is a float value indicating the receiver's field of view in degrees. If field of view is unknown, a value of 0 is returned.
        #[unsafe(method(videoFieldOfView))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoFieldOfView(&self) -> c_float;

        /// A property indicating whether the format is binned.
        ///
        ///
        /// videoBinned is a BOOL indicating whether the format is a binned format. Binning is a pixel-combining process which can result in greater low light sensitivity at the cost of reduced resolution.
        #[unsafe(method(isVideoBinned))]
        #[unsafe(method_family = none)]
        pub unsafe fn isVideoBinned(&self) -> bool;

        /// Returns whether the format supports the given video stabilization mode.
        ///
        ///
        /// Parameter `videoStabilizationMode`: An AVCaptureVideoStabilizationMode to be checked.
        ///
        ///
        /// isVideoStabilizationModeSupported: returns a boolean value indicating whether the format can be stabilized using the given mode with -[AVCaptureConnection setPreferredVideoStabilizationMode:].
        #[unsafe(method(isVideoStabilizationModeSupported:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isVideoStabilizationModeSupported(
            &self,
            video_stabilization_mode: AVCaptureVideoStabilizationMode,
        ) -> bool;

        /// A property indicating whether the format supports video stabilization.
        ///
        ///
        /// videoStabilizationSupported is a BOOL indicating whether the format can be stabilized using AVCaptureConnection -setEnablesVideoStabilizationWhenAvailable. This property is deprecated. Use isVideoStabilizationModeSupported: instead.
        #[deprecated = "Use isVideoStabilizationModeSupported: instead."]
        #[unsafe(method(isVideoStabilizationSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isVideoStabilizationSupported(&self) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        /// Indicates the maximum zoom factor available for the AVCaptureDevice's videoZoomFactor property.
        ///
        ///
        /// If the device's videoZoomFactor property is assigned a larger value, an NSRangeException will be thrown. A maximum zoom factor of 1 indicates no zoom is available.
        #[unsafe(method(videoMaxZoomFactor))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoMaxZoomFactor(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Indicates the value of AVCaptureDevice's videoZoomFactor property at which the image output begins to require upscaling.
        ///
        ///
        /// In some cases the image sensor's dimensions are larger than the dimensions reported by the video AVCaptureDeviceFormat. As long as the sensor crop is larger than the reported dimensions of the AVCaptureDeviceFormat, the image will be downscaled. Setting videoZoomFactor to the value of videoZoomFactorUpscalingThreshold will provide a center crop of the sensor image data without any scaling. If a greater zoom factor is used, then the sensor data will be upscaled to the device format's dimensions.
        #[unsafe(method(videoZoomFactorUpscaleThreshold))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoZoomFactorUpscaleThreshold(&self) -> CGFloat;

        /// Indicates the system's recommended zoom range for this device format.
        ///
        ///
        /// This property can be used to create a slider in your app's user interface to control the device's zoom with a system-recommended video zoom range. When a recommendation is not available, this property returns nil. Clients can key value observe AVCaptureDevice's minAvailableVideoZoomFactor and maxAvailableVideoZoomFactor properties to know when a device's supported zoom is restricted within the recommended zoom range.
        ///
        /// The value of this property is also used for the AVCaptureSystemZoomSlider's range.
        #[unsafe(method(systemRecommendedVideoZoomRange))]
        #[unsafe(method_family = none)]
        pub unsafe fn systemRecommendedVideoZoomRange(&self) -> Option<Retained<AVZoomRange>>;

        #[cfg(feature = "objc2-core-media")]
        /// A CMTime indicating the minimum supported exposure duration.
        ///
        ///
        /// This read-only property indicates the minimum supported exposure duration.
        #[unsafe(method(minExposureDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn minExposureDuration(&self) -> CMTime;

        #[cfg(feature = "objc2-core-media")]
        /// A CMTime indicating the maximum supported exposure duration.
        ///
        ///
        /// This read-only property indicates the maximum supported exposure duration.
        #[unsafe(method(maxExposureDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxExposureDuration(&self) -> CMTime;

        /// Indicates the system's recommended exposure bias range for this device format.
        ///
        ///
        /// This property can be used to create a slider in your app's user interface to control the device's exposure bias with a system-recommended exposure bias range. When a recommendation is not available, this property returns nil.
        ///
        /// The value of this property is also used for the AVCaptureSystemExposureBiasSlider's range.
        #[unsafe(method(systemRecommendedExposureBiasRange))]
        #[unsafe(method_family = none)]
        pub unsafe fn systemRecommendedExposureBiasRange(
            &self,
        ) -> Option<Retained<AVExposureBiasRange>>;

        /// A float indicating the minimum supported exposure ISO value.
        ///
        ///
        /// This read-only property indicates the minimum supported exposure ISO value.
        #[unsafe(method(minISO))]
        #[unsafe(method_family = none)]
        pub unsafe fn minISO(&self) -> c_float;

        /// An float indicating the maximum supported exposure ISO value.
        ///
        ///
        /// This read-only property indicates the maximum supported exposure ISO value.
        #[unsafe(method(maxISO))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxISO(&self) -> c_float;

        /// A property indicating whether the format supports global tone mapping.
        ///
        ///
        /// globalToneMappingSupported is a BOOL indicating whether the format supports global tone mapping. See AVCaptureDevice's globalToneMappingEnabled property.
        #[unsafe(method(isGlobalToneMappingSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isGlobalToneMappingSupported(&self) -> bool;

        /// A property indicating whether the format supports high dynamic range streaming.
        ///
        ///
        /// videoHDRSupported is a BOOL indicating whether the format supports high dynamic range streaming, also known as Extended Dynamic Range (EDR). When enabled, the device streams at twice the published frame rate, capturing an under-exposed frame and correctly exposed frame for each frame time at the published rate. Portions of the under-exposed frame are combined with the correctly exposed frame to recover detail in darker areas of the scene. EDR is a separate and distinct feature from 10-bit HDR video (first seen in 2020 iPhones). 10-bit formats with HLG BT2020 color space have greater dynamic range by virtue of their expanded bit depth and HLG transfer function, and when captured in movies, contain Dolby Vision metadata. They are, in effect, "always on" HDR. And thus the videoHDRSupported property is always NO for 10-bit formats only supporting HLG BT2020 colorspace, since HDR cannot be enabled or disabled. To enable videoHDR (EDR), set the AVCaptureDevice.videoHDREnabled property.
        #[unsafe(method(isVideoHDRSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isVideoHDRSupported(&self) -> bool;

        #[cfg(feature = "objc2-core-media")]
        /// CMVideoDimensions indicating the highest resolution still image that can be produced by this format.
        ///
        ///
        /// By default, AVCapturePhotoOutput and AVCaptureStillImageOutput emit images with the same dimensions as their source AVCaptureDevice's activeFormat.formatDescription property. Some device formats support high resolution photo output. That is, they can stream video to an AVCaptureVideoDataOutput or AVCaptureMovieFileOutput at one resolution while outputting photos to AVCapturePhotoOutput at a higher resolution. You may query this property to discover a video format's supported high resolution still image dimensions. See -[AVCapturePhotoOutput highResolutionPhotoEnabled], -[AVCapturePhotoSettings highResolutionPhotoEnabled], and -[AVCaptureStillImageOutput highResolutionStillImageOutputEnabled].
        ///
        /// AVCaptureDeviceFormats of type AVMediaTypeDepthData may also support the delivery of a higher resolution depth data map to an AVCapturePhotoOutput. Chief differences are:
        /// - Depth data accompanying still images is not supported by AVCaptureStillImageOutput. You must use AVCapturePhotoOutput.
        /// - By opting in for depth data ( -[AVCapturePhotoSettings setDepthDataDeliveryEnabled:YES] ), you implicitly opt in for high resolution depth data if it's available. You may query the -[AVCaptureDevice activeDepthDataFormat]'s highResolutionStillImageDimensions to discover the depth data resolution that will be delivered with captured photos.
        #[deprecated = "Use supportedMaxPhotoDimensions instead."]
        #[unsafe(method(highResolutionStillImageDimensions))]
        #[unsafe(method_family = none)]
        pub unsafe fn highResolutionStillImageDimensions(&self) -> CMVideoDimensions;

        /// A boolean value specifying whether this format supports high photo quality when selecting an AVCapturePhotoQualityPrioritization of .balanced or .quality.
        ///
        ///
        /// If an AVCaptureDeviceFormat's highPhotoQualitySupported property is YES, the format produces higher image quality when selecting .balanced or .quality AVCapturePhotoQualityPrioritization compared to .speed. Such formats adhere to the following rules:
        /// - Photo requests with a prioritization of .speed produce the fastest image result (suitable for burst captures).
        /// - Photo requests with a prioritization of .balanced produce higher image quality without dropping frames if a video recording is underway.
        /// - Photo requests with a prioritization of .quality produce high image quality and may cause frame drops if a video recording is underway. For maximum backward compatibility, photo requests on high photo quality formats set to .quality only cause video frame drops if your app is linked on or after iOS 15.
        /// Formats that don't support high photo quality produce the same image quality whether you select .speed, .balanced, or .quality. Note that high photo quality is only attainable when using the AVCapturePhotoOutput with these supported formats.
        #[unsafe(method(isHighPhotoQualitySupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isHighPhotoQualitySupported(&self) -> bool;

        /// A boolean value specifying whether this format supports the highest possible photo quality that can be delivered on the current platform.
        ///
        ///
        /// Of the many formats supported by an AVCaptureDevice, only a few of them are designated as "photo" formats which can produce the highest possible quality, such as still image stabilization and Live Photos. If you intend to connect an AVCaptureDeviceInput to an AVCapturePhotoOutput and receive the best possible images, you should ensure that you are either using the AVCaptureSessionPresetPhoto as your preset, or if using the parallel AVCaptureDevice activeFormat API, select as your activeFormat one for which this property is YES.
        #[unsafe(method(isHighestPhotoQualitySupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isHighestPhotoQualitySupported(&self) -> bool;

        /// A property indicating the autofocus system.
        ///
        ///
        /// This read-only property indicates the autofocus system.
        #[unsafe(method(autoFocusSystem))]
        #[unsafe(method_family = none)]
        pub unsafe fn autoFocusSystem(&self) -> AVCaptureAutoFocusSystem;

        /// A property indicating the receiver's supported color spaces.
        ///
        ///
        /// This read-only property indicates the receiver's supported color spaces as an array of AVCaptureColorSpace constants sorted from narrow to wide color.
        #[unsafe(method(supportedColorSpaces))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportedColorSpaces(&self) -> Retained<NSArray<NSNumber>>;

        #[cfg(feature = "objc2-core-foundation")]
        /// A deprecated property. Please use supportedVideoZoomFactorsForDepthDataDelivery instead
        #[deprecated]
        #[unsafe(method(videoMinZoomFactorForDepthDataDelivery))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoMinZoomFactorForDepthDataDelivery(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// A deprecated property. Please use supportedVideoZoomFactorsForDepthDataDelivery instead
        #[deprecated]
        #[unsafe(method(videoMaxZoomFactorForDepthDataDelivery))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoMaxZoomFactorForDepthDataDelivery(&self) -> CGFloat;

        /// A deprecated property. Please use supportedVideoZoomRangesForDepthDataDelivery
        #[deprecated]
        #[unsafe(method(supportedVideoZoomFactorsForDepthDataDelivery))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportedVideoZoomFactorsForDepthDataDelivery(
            &self,
        ) -> Retained<NSArray<NSNumber>>;

        /// This property returns the zoom ranges within which depth data can be delivered.
        ///
        /// Virtual devices support limited zoom ranges when delivering depth data to any output. If this device format has no -supportedDepthDataFormats, this property returns an empty array.
        /// The presence of one or more ranges where the min and max zoom factors are not equal means that "continuous zoom" with depth is supported.
        /// For example:
        /// a) ranges:
        /// @
        /// [ [2..2], [4..4] ]
        /// only zoom factors 2 and 4 are allowed to be set when depthDataDelivery is enabled. Any other zoom factor results in an exception.
        /// b) ranges:
        /// @
        /// [ [2..5] ]
        /// depthDataDelivery is supported with zoom factors [2..5]. Zoom factors outside of this range may be set, but will result in loss of depthDataDeliery. Whenever zoom is set back to a value within the range of [2..5], depthDataDelivery will resume.
        ///
        /// When depth data delivery is enabled, the effective videoZoomFactorUpscaleThreshold will be 1.0, meaning that all zoom factors that are not native zoom factors (see AVCaptureDevice.virtualDeviceSwitchOverVideoZoomFactors and AVCaptureDevice.secondaryNativeResolutionZoomFactors) result in digital upscaling.
        #[unsafe(method(supportedVideoZoomRangesForDepthDataDelivery))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportedVideoZoomRangesForDepthDataDelivery(
            &self,
        ) -> Retained<NSArray<AVZoomRange>>;

        /// This property returns whether the format supports zoom factors outside of the supportedVideoZoomFactorRangesForDepthDataDelivery.
        ///
        /// When a zoom factor outside of the supportedVideoZoomFactorRangesForDepthDataDelivery is set, depth data delivery will be suspended until a zoom factor within the supportedVideoZoomFactorRangesForDepthDataDelivery is set.
        #[unsafe(method(zoomFactorsOutsideOfVideoZoomRangesForDepthDeliverySupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn zoomFactorsOutsideOfVideoZoomRangesForDepthDeliverySupported(&self) -> bool;

        /// Indicates this format's companion depth data formats.
        ///
        ///
        /// If no depth data formats are supported by the receiver, an empty array is returned. On virtual devices, the supportedDepthDataFormats list items always match the aspect ratio of their paired video format. When the receiver is set as the device's activeFormat, you may set the device's activeDepthDataFormat to one of these supported depth data formats.
        #[unsafe(method(supportedDepthDataFormats))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportedDepthDataFormats(&self) -> Retained<NSArray<AVCaptureDeviceFormat>>;

        /// A property indicating AVCaptureOutput subclasses the receiver does not support.
        ///
        ///
        /// As a rule, AVCaptureDeviceFormats of a given mediaType are available for use with all AVCaptureOutputs that accept that media type, but there are exceptions. For instance, on apps linked against iOS versions earlier than 12.0, the photo resolution video formats may not be used as sources for AVCaptureMovieFileOutput due to bandwidth limitations. On DualCamera devices, AVCaptureDepthDataOutput is not supported when outputting full resolution (i.e. 12 MP) video due to bandwidth limitations. In order to stream depth data plus video data from a photo format, ensure that your AVCaptureVideoDataOutput's deliversPreviewSizedOutputBuffers property is set to YES. Likewise, to stream depth data while capturing video to a movie file using AVCaptureMovieFileOutput, call -[AVCaptureSession setSessionPreset:AVCaptureSessionPresetPhoto]. When using the photo preset, video is captured at preview resolution rather than the full sensor resolution.
        #[unsafe(method(unsupportedCaptureOutputClasses))]
        #[unsafe(method_family = none)]
        pub unsafe fn unsupportedCaptureOutputClasses(&self) -> Retained<NSArray<AnyClass>>;

        /// This property lists all of the supported maximum photo dimensions for this format. The array contains CMVideoDimensions structs encoded as NSValues.
        ///
        /// Enumerate all supported resolution settings for which this format may be configured to capture photos. Use these values to set AVCapturePhotoOutput.maxPhotoDimensions and AVCapturePhotoSettings.maxPhotoDimensions.
        #[unsafe(method(supportedMaxPhotoDimensions))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportedMaxPhotoDimensions(&self) -> Retained<NSArray<NSValue>>;

        /// Indicates zoom factors at which this device transitions to secondary native resolution modes.
        ///
        /// Devices with this property have the means to switch their pixel sampling mode on the fly to produce a high-fidelity, non-upsampled images at a fixed zoom factor beyond 1.0x.
        #[unsafe(method(secondaryNativeResolutionZoomFactors))]
        #[unsafe(method_family = none)]
        pub unsafe fn secondaryNativeResolutionZoomFactors(&self) -> Retained<NSArray<NSNumber>>;

        /// Indicates whether the device format supports auto video frame rate.
        ///
        ///
        /// See -[AVCaptureDevice autoVideoFrameRateEnabled] (above) for a detailed description of the feature.
        #[unsafe(method(isAutoVideoFrameRateSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isAutoVideoFrameRateSupported(&self) -> bool;
    );
}

/// AVCaptureDeviceFormatDepthDataAdditions.
impl AVCaptureDeviceFormat {
    extern_methods!(
        #[unsafe(method(isPortraitEffectsMatteStillImageDeliverySupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isPortraitEffectsMatteStillImageDeliverySupported(&self) -> bool;
    );
}

/// AVCaptureDeviceFormatMultiCamAdditions.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// A property indicating whether this format is supported in an AVCaptureMultiCamSession.
        ///
        ///
        /// When using an AVCaptureSession (single camera capture), any of the formats in the device's -formats array may be set as the -activeFormat. However, when used with an AVCaptureMultiCamSession, the device's -activeFormat may only be set to one of the formats for which multiCamSupported answers YES. This limited subset of capture formats are known to run sustainably in a multi camera capture scenario.
        #[unsafe(method(isMultiCamSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isMultiCamSupported(&self) -> bool;
    );
}

/// AVCaptureDeviceFormatSpatialVideoCapture.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// Returns whether or not the format supports capturing spatial video to a file.
        #[unsafe(method(isSpatialVideoCaptureSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSpatialVideoCaptureSupported(&self) -> bool;
    );
}

/// AVCaptureDeviceFormatGeometricDistortionCorrection.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// A property indicating the format's horizontal field of view post geometric distortion correction.
        ///
        ///
        /// If the receiver's AVCaptureDevice does not support GDC, geometricDistortionCorrectedVideoFieldOfView matches the videoFieldOfView property.
        #[unsafe(method(geometricDistortionCorrectedVideoFieldOfView))]
        #[unsafe(method_family = none)]
        pub unsafe fn geometricDistortionCorrectedVideoFieldOfView(&self) -> c_float;
    );
}

/// AVCaptureDeviceFormatCenterStage.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// Indicates whether the format supports the Center Stage feature.
        ///
        ///
        /// This property returns YES if the format supports "Center Stage", which automatically adjusts the camera to keep people optimally framed within the field of view. See +AVCaptureDevice.centerStageEnabled for a detailed discussion.
        #[unsafe(method(isCenterStageSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isCenterStageSupported(&self) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        /// Indicates the minimum zoom factor available for the AVCaptureDevice's videoZoomFactor property when centerStageActive is YES.
        ///
        ///
        /// Devices support a limited zoom range when Center Stage is active. If this device format does not support Center Stage, this property returns 1.0.
        #[unsafe(method(videoMinZoomFactorForCenterStage))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoMinZoomFactorForCenterStage(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Indicates the maximum zoom factor available for the AVCaptureDevice's videoZoomFactor property when centerStageActive is YES.
        ///
        ///
        /// Devices support a limited zoom range when Center Stage is active. If this device format does not support Center Stage, this property returns videoMaxZoomFactor.
        #[unsafe(method(videoMaxZoomFactorForCenterStage))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoMaxZoomFactorForCenterStage(&self) -> CGFloat;

        /// Indicates the minimum / maximum frame rates available when centerStageActive is YES.
        ///
        ///
        /// Devices may support a limited frame rate range when Center Stage is active. If this device format does not support Center Stage, this property returns nil.
        #[unsafe(method(videoFrameRateRangeForCenterStage))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoFrameRateRangeForCenterStage(
            &self,
        ) -> Option<Retained<AVFrameRateRange>>;
    );
}

/// AVCaptureDeviceFormatPortraitEffect.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// Indicates whether the format supports the Portrait Effect feature.
        ///
        ///
        /// This property returns YES if the format supports Portrait Effect, the application of a shallow depth of field effect to objects in the background. See +AVCaptureDevice.portraitEffectEnabled for a detailed discussion.
        #[unsafe(method(isPortraitEffectSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isPortraitEffectSupported(&self) -> bool;

        /// Indicates the minimum / maximum frame rates available when portraitEffectActive is YES.
        ///
        ///
        /// Devices may support a limited frame rate range when Portrait Effect is active. If this device format does not support Portrait Effect, this property returns nil.
        #[unsafe(method(videoFrameRateRangeForPortraitEffect))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoFrameRateRangeForPortraitEffect(
            &self,
        ) -> Option<Retained<AVFrameRateRange>>;
    );
}

/// AVCaptureDeviceStudioLight.
impl AVCaptureDevice {
    extern_methods!(
        /// A class property indicating whether the Studio Light feature is currently enabled in Control Center.
        ///
        ///
        /// This property changes to reflect the Studio Light state in Control Center. It is key-value observable.  On iOS, Studio Light only applies to video conferencing apps by default (apps that use "voip" as one of their UIBackgroundModes). Non video conferencing apps may opt in for Studio Light by adding the following key to their Info.plist:
        /// <key
        /// >NSCameraStudioLightEnabled
        /// </key
        /// >
        /// <true
        /// />
        #[unsafe(method(isStudioLightEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isStudioLightEnabled() -> bool;

        /// Indicates whether Studio Light is currently active on a particular AVCaptureDevice.
        ///
        ///
        /// This readonly property returns YES when Studio Light is currently active on the receiver. When active, the subject's face is artificially lit to simulate the presence of a studio light near the camera.
        #[unsafe(method(isStudioLightActive))]
        #[unsafe(method_family = none)]
        pub unsafe fn isStudioLightActive(&self) -> bool;
    );
}

/// AVCaptureDeviceFormatStudioLight.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// Indicates whether the format supports the Studio Light feature.
        ///
        ///
        /// This property returns YES if the format supports Studio Light (artificial re-lighting of the subject's face). See +AVCaptureDevice.studioLightEnabled.
        #[unsafe(method(isStudioLightSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isStudioLightSupported(&self) -> bool;

        /// Indicates the minimum / maximum frame rates available when studioLight is YES.
        ///
        ///
        /// Devices may support a limited frame rate range when Studio Light is active. If this device format does not support Studio Light, this property returns nil.
        #[unsafe(method(videoFrameRateRangeForStudioLight))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoFrameRateRangeForStudioLight(
            &self,
        ) -> Option<Retained<AVFrameRateRange>>;
    );
}

/// AVCaptureDeviceFormatReactionEffects.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// Indicates whether the format supports the Reaction Effects feature.
        ///
        ///
        /// This property returns YES if the format supports Reaction Effects. See +AVCaptureDevice.reactionEffectsEnabled.
        #[unsafe(method(reactionEffectsSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn reactionEffectsSupported(&self) -> bool;

        /// Indicates the minimum / maximum frame rates available when a reaction effect is running.
        ///
        ///
        /// Unlike the other video effects, enabling reaction effects does not limit the stream's frame rate because most of the time no rendering is being performed. The frame rate will only ramp down when a reaction is actually being rendered on the stream (see AVCaptureDevice.reactionEffectsInProgress)
        #[unsafe(method(videoFrameRateRangeForReactionEffectsInProgress))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoFrameRateRangeForReactionEffectsInProgress(
            &self,
        ) -> Option<Retained<AVFrameRateRange>>;
    );
}

/// AVCaptureDeviceFormatBackgroundReplacement.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// Indicates whether the format supports the Background Replacement feature.
        ///
        ///
        /// This property returns YES if the format supports Background Replacement background replacement. See +AVCaptureDevice.backgroundReplacementEnabled.
        #[unsafe(method(isBackgroundReplacementSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isBackgroundReplacementSupported(&self) -> bool;

        /// Indicates the minimum / maximum frame rates available when background replacement is active.
        ///
        ///
        /// Devices may support a limited frame rate range when Background Replacement is active. If this device format does not support Background Replacement, this property returns nil.
        #[unsafe(method(videoFrameRateRangeForBackgroundReplacement))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoFrameRateRangeForBackgroundReplacement(
            &self,
        ) -> Option<Retained<AVFrameRateRange>>;
    );
}

/// AVCaptureDeviceFormatCinematicVideoSupport.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// Indicates whether the format supports Cinematic Video capture.
        ///
        /// This property returns `true` if the format supports Cinematic Video that produces a controllable, simulated depth of field and adds beautiful focus transitions for a cinema-grade look.
        #[unsafe(method(isCinematicVideoCaptureSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isCinematicVideoCaptureSupported(&self) -> bool;

        /// Default shallow depth of field simulated aperture.
        ///
        /// This property return a non-zero value on devices that support the shallow depth of field effect.
        #[unsafe(method(defaultSimulatedAperture))]
        #[unsafe(method_family = none)]
        pub unsafe fn defaultSimulatedAperture(&self) -> c_float;

        /// Minimum supported shallow depth of field simulated aperture.
        ///
        /// On devices that do not support changing the simulated aperture value, this returns a value of `0`.
        #[unsafe(method(minSimulatedAperture))]
        #[unsafe(method_family = none)]
        pub unsafe fn minSimulatedAperture(&self) -> c_float;

        /// Maximum supported shallow depth of field simulated aperture.
        ///
        /// On devices that do not support changing the simulated aperture value, this returns a value of `0`.
        #[unsafe(method(maxSimulatedAperture))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxSimulatedAperture(&self) -> c_float;

        #[cfg(feature = "objc2-core-foundation")]
        /// Indicates the minimum zoom factor available for the ``AVCaptureDevice/videoZoomFactor`` property when Cinematic Video capture is enabled on the device input.
        ///
        /// Devices support a limited zoom range when Cinematic Video capture is active. If this device format does not support Cinematic Video capture, this property returns `1.0`.
        #[unsafe(method(videoMinZoomFactorForCinematicVideo))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoMinZoomFactorForCinematicVideo(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Indicates the maximum zoom factor available for the ``AVCaptureDevice/videoZoomFactor`` property when Cinematic Video capture is enabled on the device input.
        ///
        /// Devices support a limited zoom range when Cinematic Video capture is active. If this device format does not support Cinematic Video capture, this property returns `1.0`.
        #[unsafe(method(videoMaxZoomFactorForCinematicVideo))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoMaxZoomFactorForCinematicVideo(&self) -> CGFloat;

        /// Indicates the minimum / maximum frame rates available when Cinematic Video capture is enabled on the device input.
        ///
        /// Devices may support a limited frame rate range when Cinematic Video capture is active. If this device format does not support Cinematic Video capture, this property returns `nil`.
        #[unsafe(method(videoFrameRateRangeForCinematicVideo))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoFrameRateRangeForCinematicVideo(
            &self,
        ) -> Option<Retained<AVFrameRateRange>>;
    );
}

/// DynamicAspectRatio.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// Indicates the supported aspect ratios for the device format.
        ///
        /// An array that describes the aspect ratios that are supported for this format. If this device format does not support dynamic aspect ratio, this property returns an empty array.
        #[unsafe(method(supportedDynamicAspectRatios))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportedDynamicAspectRatios(
            &self,
        ) -> Retained<NSArray<AVCaptureAspectRatio>>;

        /// Indicates the horizontal field of view for an aspect ratio, either uncorrected or corrected for geometric distortion.
        ///
        /// A float indicating the field of view for the corresponding ``AVCaptureAspectRatio``. Set ``AVCaptureDevice/geometricDistortionCorrected`` to `true` to receive the field of view corrected for geometric distortion. If this device format does not support dynamic aspect ratio, this function returns `0`.
        #[unsafe(method(videoFieldOfViewForAspectRatio:geometricDistortionCorrected:))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoFieldOfViewForAspectRatio_geometricDistortionCorrected(
            &self,
            aspect_ratio: &AVCaptureAspectRatio,
            geometric_distortion_corrected: bool,
        ) -> c_float;
    );
}

/// AVCaptureDeviceFormatSmartFraming.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// Returns `true` if smart framing is supported by the current format.
        ///
        /// An ultra wide camera device that supports dynamic aspect ratio configuration may also support "smart framing monitoring" on particular formats.
        #[unsafe(method(isSmartFramingSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isSmartFramingSupported(&self) -> bool;
    );
}

/// CameraLensSmudgeDetection.
impl AVCaptureDeviceFormat {
    extern_methods!(
        /// Whether camera lens smudge detection is supported.
        ///
        /// This property returns `true` if the session's current configuration supports lens smudge detection. When switching cameras or formats, this property may change. When this property changes from `true` to `false`, ``AVCaptureDevice/cameraLensSmudgeDetectionEnabled`` also reverts to `false`. If you opt in for lens smudge detection and then change configurations, you should set ``AVCaptureDevice/cameraLensSmudgeDetectionEnabled`` to `true` again.
        #[unsafe(method(isCameraLensSmudgeDetectionSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isCameraLensSmudgeDetectionSupported(&self) -> bool;
    );
}

/// Constants indicating the current camera lens smudge detection status.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturecameralenssmudgedetectionstatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AVCaptureCameraLensSmudgeDetectionStatus(pub NSInteger);
impl AVCaptureCameraLensSmudgeDetectionStatus {
    /// Indicates that the detection is not enabled.
    #[doc(alias = "AVCaptureCameraLensSmudgeDetectionStatusDisabled")]
    pub const Disabled: Self = Self(0);
    /// Indicates that the most recent detection found no smudge on the camera lens.
    #[doc(alias = "AVCaptureCameraLensSmudgeDetectionStatusSmudgeNotDetected")]
    pub const SmudgeNotDetected: Self = Self(1);
    /// Indicates that the most recent detection found the camera lens to be smudged.
    #[doc(alias = "AVCaptureCameraLensSmudgeDetectionStatusSmudged")]
    pub const Smudged: Self = Self(2);
    /// Indicates that the detection result has not settled, commonly caused by excessive camera movement or the content of the scene.
    #[doc(alias = "AVCaptureCameraLensSmudgeDetectionStatusUnknown")]
    pub const Unknown: Self = Self(3);
}

unsafe impl Encode for AVCaptureCameraLensSmudgeDetectionStatus {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for AVCaptureCameraLensSmudgeDetectionStatus {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// CameraLensSmudgeDetection.
impl AVCaptureDevice {
    extern_methods!(
        #[cfg(feature = "objc2-core-media")]
        /// Specify whether to enable camera lens smudge detection, and the interval time between each run of detections.
        ///
        /// - Parameter cameraLensSmudgeDetectionEnabled: Specify whether camera lens smudge detection should be enabled.
        /// - Parameter detectionInterval: The detection running interval if detection is enabled.
        ///
        /// Each run of detection processes frames over a short period, and produces one detection result. Use `detectionInterval` to specify the interval time between each run of detections. For example, when ``cameraLensSmudgeDetectionEnabled`` is set to `true` and `detectionInterval` is set to 1 minute, detection runs once per minute, and updates ``AVCaptureCameraLensSmudgeDetectionStatus``. If `detectionInterval` is set to ``kCMTimeInvalid``, detection runs only once after the session starts. If `detectionInterval` is set to ``kCMTimeZero``, detection runs continuously.
        ///
        /// ``AVCaptureDevice`` throws an `NSInvalidArgumentException` if the ``AVCaptureDeviceFormat/cameraLensSmudgeDetectionSupported`` property on the current active format returns `false`. Enabling detection requires a lengthy reconfiguration of the capture render pipeline, so you should enable detection before calling ``AVCaptureSession/startRunning`` or within ``AVCaptureSession/beginConfiguration`` and ``AVCaptureSession/commitConfiguration`` while running.
        #[unsafe(method(setCameraLensSmudgeDetectionEnabled:detectionInterval:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCameraLensSmudgeDetectionEnabled_detectionInterval(
            &self,
            camera_lens_smudge_detection_enabled: bool,
            detection_interval: CMTime,
        );

        /// Whether camera lens smudge detection is enabled.
        ///
        /// You enable lens smudge detection by calling ``setCameraLensSmudgeDetectionEnabled:detectionInterval:``. By default, this property is returns `false`.
        #[unsafe(method(isCameraLensSmudgeDetectionEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isCameraLensSmudgeDetectionEnabled(&self) -> bool;

        #[cfg(feature = "objc2-core-media")]
        /// The camera lens smudge detection interval.
        ///
        /// ``cameraLensSmudgeDetectionInterval`` is set by calling ``setCameraLensSmudgeDetectionEnabled:detectionInterval:``. By default, this property returns `kCMTimeInvalid`.
        #[unsafe(method(cameraLensSmudgeDetectionInterval))]
        #[unsafe(method_family = none)]
        pub unsafe fn cameraLensSmudgeDetectionInterval(&self) -> CMTime;

        /// A value specifying the status of camera lens smudge detection.
        ///
        /// During initial detection execution, ``cameraLensSmudgeDetectionStatus`` returns ``AVCaptureCameraLensSmudgeDetectionStatusUnknown`` until the detection result settles. Once a detection result is produced, ``cameraLensSmudgeDetectionStatus`` returns the most recent detection result. This property can be key-value observed.
        #[unsafe(method(cameraLensSmudgeDetectionStatus))]
        #[unsafe(method_family = none)]
        pub unsafe fn cameraLensSmudgeDetectionStatus(
            &self,
        ) -> AVCaptureCameraLensSmudgeDetectionStatus;
    );
}

extern_class!(
    /// An AVCaptureDeviceInputSource represents a distinct input source on an AVCaptureDevice object.
    ///
    ///
    /// An AVCaptureDevice may optionally present an array of inputSources, representing distinct mutually exclusive inputs to the device, for example, an audio AVCaptureDevice might have ADAT optical and analog input sources. A video AVCaptureDevice might have an HDMI input source, or a component input source.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedeviceinputsource?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct AVCaptureDeviceInputSource;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for AVCaptureDeviceInputSource {}
);

impl AVCaptureDeviceInputSource {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        /// An ID unique among the inputSources exposed by a given AVCaptureDevice.
        ///
        ///
        /// An AVCaptureDevice's inputSources array must contain AVCaptureInputSource objects with unique inputSourceIDs.
        #[unsafe(method(inputSourceID))]
        #[unsafe(method_family = none)]
        pub unsafe fn inputSourceID(&self) -> Retained<NSString>;

        /// A localized human-readable name for the receiver.
        ///
        ///
        /// This property can be used for displaying the name of the capture device input source in a user interface.
        #[unsafe(method(localizedName))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizedName(&self) -> Retained<NSString>;
    );
}