objc2_av_foundation/generated/AVCaptureReactions.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-media")]
6use objc2_core_media::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11/// AVCaptureReactionType string constants
12///
13///
14/// Constants indicating the type of reaction that can be performed in an effect.
15///
16/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturereactiontype?language=objc)
17// NS_TYPED_ENUM
18pub type AVCaptureReactionType = NSString;
19
20extern "C" {
21 /// Indicates a reaction which features a thumbs-up symbol.
22 ///
23 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturereactiontypethumbsup?language=objc)
24 pub static AVCaptureReactionTypeThumbsUp: &'static AVCaptureReactionType;
25}
26
27extern "C" {
28 /// Indicates a reaction which features a thumbs-down symbol.
29 ///
30 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturereactiontypethumbsdown?language=objc)
31 pub static AVCaptureReactionTypeThumbsDown: &'static AVCaptureReactionType;
32}
33
34extern "C" {
35 /// Indicates a reaction which features balloons rising through the scene.
36 ///
37 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturereactiontypeballoons?language=objc)
38 pub static AVCaptureReactionTypeBalloons: &'static AVCaptureReactionType;
39}
40
41extern "C" {
42 /// Indicates a reaction which features one or more heart symbols.
43 ///
44 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturereactiontypeheart?language=objc)
45 pub static AVCaptureReactionTypeHeart: &'static AVCaptureReactionType;
46}
47
48extern "C" {
49 /// Indicates a reaction which features fireworks bursting in the background.
50 ///
51 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturereactiontypefireworks?language=objc)
52 pub static AVCaptureReactionTypeFireworks: &'static AVCaptureReactionType;
53}
54
55extern "C" {
56 /// Indicates a reaction which features a dark and stormy night.
57 ///
58 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturereactiontyperain?language=objc)
59 pub static AVCaptureReactionTypeRain: &'static AVCaptureReactionType;
60}
61
62extern "C" {
63 /// Indicates a reaction which features festive spots of color falling through the scene.
64 ///
65 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturereactiontypeconfetti?language=objc)
66 pub static AVCaptureReactionTypeConfetti: &'static AVCaptureReactionType;
67}
68
69extern "C" {
70 /// Indicates a reaction which features a bright laser display projecting into the scene.
71 ///
72 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturereactiontypelasers?language=objc)
73 pub static AVCaptureReactionTypeLasers: &'static AVCaptureReactionType;
74}
75
76/// Returns the name for UIImage or NSImage systemImageNamed: method to obtain the recommended iconography for a specified reaction type.
77#[inline]
78pub unsafe extern "C-unwind" fn AVCaptureReactionSystemImageNameForType(
79 reaction_type: &AVCaptureReactionType,
80) -> Retained<NSString> {
81 extern "C-unwind" {
82 fn AVCaptureReactionSystemImageNameForType(
83 reaction_type: &AVCaptureReactionType,
84 ) -> *mut NSString;
85 }
86 let ret = unsafe { AVCaptureReactionSystemImageNameForType(reaction_type) };
87 unsafe { Retained::retain_autoreleased(ret) }
88 .expect("function was marked as returning non-null, but actually returned NULL")
89}
90
91extern_class!(
92 /// Reports the state of a reaction performed on an AVCaptureDevice.
93 ///
94 ///
95 /// AVCaptureReactionEffectState may be obtained by calling -[AVCaptureDevice reactionEffectsInProgress]. When -[AVCaptureDevice canPerformReactionEffects] returns YES, new entries are added either by calling -[AVCaptureDevice performEffectForReaction:], or by gesture detection in the capture stream when AVCaptureDevice.reactionEffectGesturesEnabled. The effect rendering is done before frames are given to the capture client, and these status objects let you know when these effects are performed.
96 ///
97 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturereactioneffectstate?language=objc)
98 #[unsafe(super(NSObject))]
99 #[derive(Debug, PartialEq, Eq, Hash)]
100 pub struct AVCaptureReactionEffectState;
101);
102
103extern_conformance!(
104 unsafe impl NSObjectProtocol for AVCaptureReactionEffectState {}
105);
106
107impl AVCaptureReactionEffectState {
108 extern_methods!(
109 /// Indicates the reaction which is running.
110 ///
111 ///
112 /// There may be multiple reactions of the same type at a given time. Some may come from gesture detection, some may come from calls to -[AVCaptureDevice performReactionEffect:]
113 #[unsafe(method(reactionType))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn reactionType(&self) -> Retained<AVCaptureReactionType>;
116
117 #[cfg(feature = "objc2-core-media")]
118 /// Provides the presentation time of the first frame where the effect is being rendered.
119 #[unsafe(method(startTime))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn startTime(&self) -> CMTime;
122
123 #[cfg(feature = "objc2-core-media")]
124 /// Provides the presentation time of the frame following the last frame where the effect is seen.
125 ///
126 ///
127 /// Will be kCMTimeInvalid while the effect is in progress, but will be updated to a valid time when the reaction effect completes and the AVCaptureReactionEffectState is removed from -[AVCaptureDevice reactionEffectsInProgress]. (If using NSKeyValueObservingOptionOld, you can access completed effects with valid end times via NSKeyValueChangeOldKey.)
128 #[unsafe(method(endTime))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn endTime(&self) -> CMTime;
131 );
132}
133
134/// Methods declared on superclass `NSObject`.
135impl AVCaptureReactionEffectState {
136 extern_methods!(
137 #[unsafe(method(init))]
138 #[unsafe(method_family = init)]
139 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
140
141 #[unsafe(method(new))]
142 #[unsafe(method_family = new)]
143 pub unsafe fn new() -> Retained<Self>;
144 );
145}