react-native-vision-camera-spoof-detector 1.2.0 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -3
- package/android/build.gradle +1 -0
- package/android/src/main/java/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorFactory.kt +4 -0
- package/android/src/main/java/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorOutput.kt +403 -214
- package/index.d.ts +14 -0
- package/index.js +50 -3
- package/ios/HybridSpoofDetectorOutput.swift +186 -2
- package/nitrogen/generated/android/VisionCameraSpoofDetectorOnLoad.cpp +4 -0
- package/nitrogen/generated/android/c++/JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult.hpp +80 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_SpoofDetectedFace_.hpp +98 -0
- package/nitrogen/generated/android/c++/JHybridSpoofDetectorFactorySpec.cpp +15 -0
- package/nitrogen/generated/android/c++/JHybridSpoofDetectorFactorySpec.hpp +1 -0
- package/nitrogen/generated/android/c++/JSpoofDetectedFace.hpp +58 -0
- package/nitrogen/generated/android/c++/JSpoofDetectedFaceBounds.hpp +69 -0
- package/nitrogen/generated/android/c++/JSpoofDetectorOutputOptions.hpp +56 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/Func_void_std__vector_SpoofDetectedFace_.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorFactorySpec.kt +4 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/SpoofDetectedFace.kt +51 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/SpoofDetectedFaceBounds.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/SpoofDetectorOutputOptions.kt +44 -4
- package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Bridge.cpp +16 -0
- package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Bridge.hpp +116 -0
- package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Umbrella.hpp +7 -0
- package/nitrogen/generated/ios/c++/HybridSpoofDetectorFactorySpecSwift.hpp +13 -0
- package/nitrogen/generated/ios/swift/Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_SpoofDetectedFace_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridSpoofDetectorFactorySpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridSpoofDetectorFactorySpec_cxx.swift +15 -0
- package/nitrogen/generated/ios/swift/SpoofDetectedFace.swift +29 -0
- package/nitrogen/generated/ios/swift/SpoofDetectedFaceBounds.swift +44 -0
- package/nitrogen/generated/ios/swift/SpoofDetectorOutputOptions.swift +167 -1
- package/nitrogen/generated/shared/c++/HybridSpoofDetectorFactorySpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridSpoofDetectorFactorySpec.hpp +1 -0
- package/nitrogen/generated/shared/c++/SpoofDetectedFace.hpp +84 -0
- package/nitrogen/generated/shared/c++/SpoofDetectedFaceBounds.hpp +95 -0
- package/nitrogen/generated/shared/c++/SpoofDetectorOutputOptions.hpp +41 -2
- package/package.json +1 -1
- package/src/specs/SpoofDetectorFactory.nitro.ts +47 -24
|
@@ -13,14 +13,21 @@
|
|
|
13
13
|
#include "AntiSpoofingResult.hpp"
|
|
14
14
|
#include "JAntiSpoofingResult.hpp"
|
|
15
15
|
#include "JFunc_void_AntiSpoofingResult.hpp"
|
|
16
|
+
#include "JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult.hpp"
|
|
16
17
|
#include "JFunc_void_std__exception_ptr.hpp"
|
|
18
|
+
#include "JFunc_void_std__vector_SpoofDetectedFace_.hpp"
|
|
17
19
|
#include "JSize.hpp"
|
|
20
|
+
#include "JSpoofDetectedFace.hpp"
|
|
21
|
+
#include "JSpoofDetectedFaceBounds.hpp"
|
|
18
22
|
#include "Size.hpp"
|
|
23
|
+
#include "SpoofDetectedFace.hpp"
|
|
24
|
+
#include "SpoofDetectedFaceBounds.hpp"
|
|
19
25
|
#include <NitroModules/JNICallable.hpp>
|
|
20
26
|
#include <exception>
|
|
21
27
|
#include <functional>
|
|
22
28
|
#include <optional>
|
|
23
29
|
#include <string>
|
|
30
|
+
#include <vector>
|
|
24
31
|
|
|
25
32
|
namespace margelo::nitro::camera::spoofdetector {
|
|
26
33
|
|
|
@@ -43,12 +50,34 @@ namespace margelo::nitro::camera::spoofdetector {
|
|
|
43
50
|
static const auto clazz = javaClassStatic();
|
|
44
51
|
static const auto fieldTargetResolution = clazz->getField<JSize>("targetResolution");
|
|
45
52
|
jni::local_ref<JSize> targetResolution = this->getFieldValue(fieldTargetResolution);
|
|
53
|
+
static const auto fieldAntispoofLevel = clazz->getField<jni::JDouble>("antispoofLevel");
|
|
54
|
+
jni::local_ref<jni::JDouble> antispoofLevel = this->getFieldValue(fieldAntispoofLevel);
|
|
55
|
+
static const auto fieldStableFrames = clazz->getField<jni::JDouble>("stableFrames");
|
|
56
|
+
jni::local_ref<jni::JDouble> stableFrames = this->getFieldValue(fieldStableFrames);
|
|
57
|
+
static const auto fieldRequiredLiveFrames = clazz->getField<jni::JDouble>("requiredLiveFrames");
|
|
58
|
+
jni::local_ref<jni::JDouble> requiredLiveFrames = this->getFieldValue(fieldRequiredLiveFrames);
|
|
59
|
+
static const auto fieldLaplacianThreshold = clazz->getField<jni::JDouble>("laplacianThreshold");
|
|
60
|
+
jni::local_ref<jni::JDouble> laplacianThreshold = this->getFieldValue(fieldLaplacianThreshold);
|
|
61
|
+
static const auto fieldMaxNeuralSpoofScore = clazz->getField<jni::JDouble>("maxNeuralSpoofScore");
|
|
62
|
+
jni::local_ref<jni::JDouble> maxNeuralSpoofScore = this->getFieldValue(fieldMaxNeuralSpoofScore);
|
|
63
|
+
static const auto fieldUiUpdateIntervalMs = clazz->getField<jni::JDouble>("uiUpdateIntervalMs");
|
|
64
|
+
jni::local_ref<jni::JDouble> uiUpdateIntervalMs = this->getFieldValue(fieldUiUpdateIntervalMs);
|
|
46
65
|
static const auto fieldOnResult = clazz->getField<JFunc_void_AntiSpoofingResult::javaobject>("onResult");
|
|
47
66
|
jni::local_ref<JFunc_void_AntiSpoofingResult::javaobject> onResult = this->getFieldValue(fieldOnResult);
|
|
67
|
+
static const auto fieldOnFacesDetected = clazz->getField<JFunc_void_std__vector_SpoofDetectedFace_::javaobject>("onFacesDetected");
|
|
68
|
+
jni::local_ref<JFunc_void_std__vector_SpoofDetectedFace_::javaobject> onFacesDetected = this->getFieldValue(fieldOnFacesDetected);
|
|
69
|
+
static const auto fieldOnStableFaceDetected = clazz->getField<JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult::javaobject>("onStableFaceDetected");
|
|
70
|
+
jni::local_ref<JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult::javaobject> onStableFaceDetected = this->getFieldValue(fieldOnStableFaceDetected);
|
|
48
71
|
static const auto fieldOnError = clazz->getField<JFunc_void_std__exception_ptr::javaobject>("onError");
|
|
49
72
|
jni::local_ref<JFunc_void_std__exception_ptr::javaobject> onError = this->getFieldValue(fieldOnError);
|
|
50
73
|
return SpoofDetectorOutputOptions(
|
|
51
74
|
targetResolution != nullptr ? std::make_optional(targetResolution->toCpp()) : std::nullopt,
|
|
75
|
+
antispoofLevel != nullptr ? std::make_optional(antispoofLevel->value()) : std::nullopt,
|
|
76
|
+
stableFrames != nullptr ? std::make_optional(stableFrames->value()) : std::nullopt,
|
|
77
|
+
requiredLiveFrames != nullptr ? std::make_optional(requiredLiveFrames->value()) : std::nullopt,
|
|
78
|
+
laplacianThreshold != nullptr ? std::make_optional(laplacianThreshold->value()) : std::nullopt,
|
|
79
|
+
maxNeuralSpoofScore != nullptr ? std::make_optional(maxNeuralSpoofScore->value()) : std::nullopt,
|
|
80
|
+
uiUpdateIntervalMs != nullptr ? std::make_optional(uiUpdateIntervalMs->value()) : std::nullopt,
|
|
52
81
|
[&]() -> std::function<void(const AntiSpoofingResult& /* result */)> {
|
|
53
82
|
if (onResult->isInstanceOf(JFunc_void_AntiSpoofingResult_cxx::javaClassStatic())) [[likely]] {
|
|
54
83
|
auto downcast = jni::static_ref_cast<JFunc_void_AntiSpoofingResult_cxx::javaobject>(onResult);
|
|
@@ -58,6 +87,24 @@ namespace margelo::nitro::camera::spoofdetector {
|
|
|
58
87
|
return JNICallable<JFunc_void_AntiSpoofingResult, void(AntiSpoofingResult)>(std::move(onResultRef));
|
|
59
88
|
}
|
|
60
89
|
}(),
|
|
90
|
+
onFacesDetected != nullptr ? std::make_optional([&]() -> std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)> {
|
|
91
|
+
if (onFacesDetected->isInstanceOf(JFunc_void_std__vector_SpoofDetectedFace__cxx::javaClassStatic())) [[likely]] {
|
|
92
|
+
auto downcast = jni::static_ref_cast<JFunc_void_std__vector_SpoofDetectedFace__cxx::javaobject>(onFacesDetected);
|
|
93
|
+
return downcast->cthis()->getFunction();
|
|
94
|
+
} else {
|
|
95
|
+
auto onFacesDetectedRef = jni::make_global(onFacesDetected);
|
|
96
|
+
return JNICallable<JFunc_void_std__vector_SpoofDetectedFace_, void(std::vector<SpoofDetectedFace>)>(std::move(onFacesDetectedRef));
|
|
97
|
+
}
|
|
98
|
+
}()) : std::nullopt,
|
|
99
|
+
onStableFaceDetected != nullptr ? std::make_optional([&]() -> std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)> {
|
|
100
|
+
if (onStableFaceDetected->isInstanceOf(JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult_cxx::javaClassStatic())) [[likely]] {
|
|
101
|
+
auto downcast = jni::static_ref_cast<JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult_cxx::javaobject>(onStableFaceDetected);
|
|
102
|
+
return downcast->cthis()->getFunction();
|
|
103
|
+
} else {
|
|
104
|
+
auto onStableFaceDetectedRef = jni::make_global(onStableFaceDetected);
|
|
105
|
+
return JNICallable<JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult, void(SpoofDetectedFaceBounds, AntiSpoofingResult)>(std::move(onStableFaceDetectedRef));
|
|
106
|
+
}
|
|
107
|
+
}()) : std::nullopt,
|
|
61
108
|
onError != nullptr ? std::make_optional([&]() -> std::function<void(const std::exception_ptr& /* error */)> {
|
|
62
109
|
if (onError->isInstanceOf(JFunc_void_std__exception_ptr_cxx::javaClassStatic())) [[likely]] {
|
|
63
110
|
auto downcast = jni::static_ref_cast<JFunc_void_std__exception_ptr_cxx::javaobject>(onError);
|
|
@@ -76,13 +123,21 @@ namespace margelo::nitro::camera::spoofdetector {
|
|
|
76
123
|
*/
|
|
77
124
|
[[maybe_unused]]
|
|
78
125
|
static jni::local_ref<JSpoofDetectorOutputOptions::javaobject> fromCpp(const SpoofDetectorOutputOptions& value) {
|
|
79
|
-
using JSignature = JSpoofDetectorOutputOptions(jni::alias_ref<JSize>, jni::alias_ref<JFunc_void_AntiSpoofingResult::javaobject>, jni::alias_ref<JFunc_void_std__exception_ptr::javaobject>);
|
|
126
|
+
using JSignature = JSpoofDetectorOutputOptions(jni::alias_ref<JSize>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JFunc_void_AntiSpoofingResult::javaobject>, jni::alias_ref<JFunc_void_std__vector_SpoofDetectedFace_::javaobject>, jni::alias_ref<JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult::javaobject>, jni::alias_ref<JFunc_void_std__exception_ptr::javaobject>);
|
|
80
127
|
static const auto clazz = javaClassStatic();
|
|
81
128
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
82
129
|
return create(
|
|
83
130
|
clazz,
|
|
84
131
|
value.targetResolution.has_value() ? JSize::fromCpp(value.targetResolution.value()) : nullptr,
|
|
132
|
+
value.antispoofLevel.has_value() ? jni::JDouble::valueOf(value.antispoofLevel.value()) : nullptr,
|
|
133
|
+
value.stableFrames.has_value() ? jni::JDouble::valueOf(value.stableFrames.value()) : nullptr,
|
|
134
|
+
value.requiredLiveFrames.has_value() ? jni::JDouble::valueOf(value.requiredLiveFrames.value()) : nullptr,
|
|
135
|
+
value.laplacianThreshold.has_value() ? jni::JDouble::valueOf(value.laplacianThreshold.value()) : nullptr,
|
|
136
|
+
value.maxNeuralSpoofScore.has_value() ? jni::JDouble::valueOf(value.maxNeuralSpoofScore.value()) : nullptr,
|
|
137
|
+
value.uiUpdateIntervalMs.has_value() ? jni::JDouble::valueOf(value.uiUpdateIntervalMs.value()) : nullptr,
|
|
85
138
|
JFunc_void_AntiSpoofingResult_cxx::fromCpp(value.onResult),
|
|
139
|
+
value.onFacesDetected.has_value() ? JFunc_void_std__vector_SpoofDetectedFace__cxx::fromCpp(value.onFacesDetected.value()) : nullptr,
|
|
140
|
+
value.onStableFaceDetected.has_value() ? JFunc_void_SpoofDetectedFaceBounds_AntiSpoofingResult_cxx::fromCpp(value.onStableFaceDetected.value()) : nullptr,
|
|
86
141
|
value.onError.has_value() ? JFunc_void_std__exception_ptr_cxx::fromCpp(value.onError.value()) : nullptr
|
|
87
142
|
);
|
|
88
143
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.camera.spoofdetector
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(face: struct, result: struct) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult: (SpoofDetectedFaceBounds, AntiSpoofingResult) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(face: SpoofDetectedFaceBounds, result: AntiSpoofingResult): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(face: struct, result: struct) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult_cxx: Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(face: SpoofDetectedFaceBounds, result: AntiSpoofingResult): Unit
|
|
59
|
+
= invoke_cxx(face,result)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(face: SpoofDetectedFaceBounds, result: AntiSpoofingResult): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(face: struct, result: struct) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(SpoofDetectedFaceBounds, AntiSpoofingResult) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult_java(private val function: (SpoofDetectedFaceBounds, AntiSpoofingResult) -> Unit): Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(face: SpoofDetectedFaceBounds, result: AntiSpoofingResult): Unit {
|
|
76
|
+
return this.function(face, result)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__vector_SpoofDetectedFace_.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.camera.spoofdetector
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(faces: array) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_std__vector_SpoofDetectedFace_: (Array<SpoofDetectedFace>) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(faces: Array<SpoofDetectedFace>): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(faces: array) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_std__vector_SpoofDetectedFace__cxx: Func_void_std__vector_SpoofDetectedFace_ {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(faces: Array<SpoofDetectedFace>): Unit
|
|
59
|
+
= invoke_cxx(faces)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(faces: Array<SpoofDetectedFace>): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(faces: array) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(Array<SpoofDetectedFace>) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_std__vector_SpoofDetectedFace__java(private val function: (Array<SpoofDetectedFace>) -> Unit): Func_void_std__vector_SpoofDetectedFace_ {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(faces: Array<SpoofDetectedFace>): Unit {
|
|
76
|
+
return this.function(faces)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -33,6 +33,10 @@ abstract class HybridSpoofDetectorFactorySpec: HybridObject() {
|
|
|
33
33
|
@DoNotStrip
|
|
34
34
|
@Keep
|
|
35
35
|
abstract fun createSpoofDetectorOutput(options: SpoofDetectorOutputOptions): com.margelo.nitro.camera.HybridCameraOutputSpec
|
|
36
|
+
|
|
37
|
+
@DoNotStrip
|
|
38
|
+
@Keep
|
|
39
|
+
abstract fun resetSpoofDetectorOutput(output: com.margelo.nitro.camera.HybridCameraOutputSpec): Unit
|
|
36
40
|
|
|
37
41
|
// Default implementation of `HybridObject.toString()`
|
|
38
42
|
override fun toString(): String {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SpoofDetectedFace.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.camera.spoofdetector
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "SpoofDetectedFace".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class SpoofDetectedFace(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val bounds: SpoofDetectedFaceBounds
|
|
24
|
+
) {
|
|
25
|
+
/* primary constructor */
|
|
26
|
+
|
|
27
|
+
override fun equals(other: Any?): Boolean {
|
|
28
|
+
if (this === other) return true
|
|
29
|
+
if (other !is SpoofDetectedFace) return false
|
|
30
|
+
return Objects.deepEquals(this.bounds, other.bounds)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override fun hashCode(): Int {
|
|
34
|
+
return arrayOf<Any?>(
|
|
35
|
+
bounds
|
|
36
|
+
).contentDeepHashCode()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
companion object {
|
|
40
|
+
/**
|
|
41
|
+
* Constructor called from C++
|
|
42
|
+
*/
|
|
43
|
+
@DoNotStrip
|
|
44
|
+
@Keep
|
|
45
|
+
@Suppress("unused")
|
|
46
|
+
@JvmStatic
|
|
47
|
+
private fun fromCpp(bounds: SpoofDetectedFaceBounds): SpoofDetectedFace {
|
|
48
|
+
return SpoofDetectedFace(bounds)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SpoofDetectedFaceBounds.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.camera.spoofdetector
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "SpoofDetectedFaceBounds".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class SpoofDetectedFaceBounds(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val x: Double,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val y: Double,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val width: Double,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val height: Double
|
|
33
|
+
) {
|
|
34
|
+
/* primary constructor */
|
|
35
|
+
|
|
36
|
+
override fun equals(other: Any?): Boolean {
|
|
37
|
+
if (this === other) return true
|
|
38
|
+
if (other !is SpoofDetectedFaceBounds) return false
|
|
39
|
+
return Objects.deepEquals(this.x, other.x)
|
|
40
|
+
&& Objects.deepEquals(this.y, other.y)
|
|
41
|
+
&& Objects.deepEquals(this.width, other.width)
|
|
42
|
+
&& Objects.deepEquals(this.height, other.height)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
override fun hashCode(): Int {
|
|
46
|
+
return arrayOf<Any?>(
|
|
47
|
+
x,
|
|
48
|
+
y,
|
|
49
|
+
width,
|
|
50
|
+
height
|
|
51
|
+
).contentDeepHashCode()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
/**
|
|
56
|
+
* Constructor called from C++
|
|
57
|
+
*/
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
@Suppress("unused")
|
|
61
|
+
@JvmStatic
|
|
62
|
+
private fun fromCpp(x: Double, y: Double, width: Double, height: Double): SpoofDetectedFaceBounds {
|
|
63
|
+
return SpoofDetectedFaceBounds(x, y, width, height)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -23,29 +23,69 @@ data class SpoofDetectorOutputOptions(
|
|
|
23
23
|
val targetResolution: Size?,
|
|
24
24
|
@DoNotStrip
|
|
25
25
|
@Keep
|
|
26
|
+
val antispoofLevel: Double?,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val stableFrames: Double?,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val requiredLiveFrames: Double?,
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@Keep
|
|
35
|
+
val laplacianThreshold: Double?,
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
@Keep
|
|
38
|
+
val maxNeuralSpoofScore: Double?,
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
val uiUpdateIntervalMs: Double?,
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
@Keep
|
|
26
44
|
val onResult: Func_void_AntiSpoofingResult,
|
|
27
45
|
@DoNotStrip
|
|
28
46
|
@Keep
|
|
47
|
+
val onFacesDetected: Func_void_std__vector_SpoofDetectedFace_?,
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
val onStableFaceDetected: Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult?,
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
29
53
|
val onError: Func_void_std__exception_ptr?
|
|
30
54
|
) {
|
|
31
55
|
/**
|
|
32
56
|
* Create a new instance of SpoofDetectorOutputOptions from Kotlin
|
|
33
57
|
*/
|
|
34
|
-
constructor(targetResolution: Size?, onResult: (result: AntiSpoofingResult) -> Unit, onError: ((error: Throwable) -> Unit)?):
|
|
35
|
-
this(targetResolution, Func_void_AntiSpoofingResult_java(onResult), onError?.let { Func_void_std__exception_ptr_java(it) })
|
|
58
|
+
constructor(targetResolution: Size?, antispoofLevel: Double?, stableFrames: Double?, requiredLiveFrames: Double?, laplacianThreshold: Double?, maxNeuralSpoofScore: Double?, uiUpdateIntervalMs: Double?, onResult: (result: AntiSpoofingResult) -> Unit, onFacesDetected: ((faces: Array<SpoofDetectedFace>) -> Unit)?, onStableFaceDetected: ((face: SpoofDetectedFaceBounds, result: AntiSpoofingResult) -> Unit)?, onError: ((error: Throwable) -> Unit)?):
|
|
59
|
+
this(targetResolution, antispoofLevel, stableFrames, requiredLiveFrames, laplacianThreshold, maxNeuralSpoofScore, uiUpdateIntervalMs, Func_void_AntiSpoofingResult_java(onResult), onFacesDetected?.let { Func_void_std__vector_SpoofDetectedFace__java(it) }, onStableFaceDetected?.let { Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult_java(it) }, onError?.let { Func_void_std__exception_ptr_java(it) })
|
|
36
60
|
|
|
37
61
|
override fun equals(other: Any?): Boolean {
|
|
38
62
|
if (this === other) return true
|
|
39
63
|
if (other !is SpoofDetectorOutputOptions) return false
|
|
40
64
|
return Objects.deepEquals(this.targetResolution, other.targetResolution)
|
|
65
|
+
&& Objects.deepEquals(this.antispoofLevel, other.antispoofLevel)
|
|
66
|
+
&& Objects.deepEquals(this.stableFrames, other.stableFrames)
|
|
67
|
+
&& Objects.deepEquals(this.requiredLiveFrames, other.requiredLiveFrames)
|
|
68
|
+
&& Objects.deepEquals(this.laplacianThreshold, other.laplacianThreshold)
|
|
69
|
+
&& Objects.deepEquals(this.maxNeuralSpoofScore, other.maxNeuralSpoofScore)
|
|
70
|
+
&& Objects.deepEquals(this.uiUpdateIntervalMs, other.uiUpdateIntervalMs)
|
|
41
71
|
&& Objects.deepEquals(this.onResult, other.onResult)
|
|
72
|
+
&& Objects.deepEquals(this.onFacesDetected, other.onFacesDetected)
|
|
73
|
+
&& Objects.deepEquals(this.onStableFaceDetected, other.onStableFaceDetected)
|
|
42
74
|
&& Objects.deepEquals(this.onError, other.onError)
|
|
43
75
|
}
|
|
44
76
|
|
|
45
77
|
override fun hashCode(): Int {
|
|
46
78
|
return arrayOf<Any?>(
|
|
47
79
|
targetResolution,
|
|
80
|
+
antispoofLevel,
|
|
81
|
+
stableFrames,
|
|
82
|
+
requiredLiveFrames,
|
|
83
|
+
laplacianThreshold,
|
|
84
|
+
maxNeuralSpoofScore,
|
|
85
|
+
uiUpdateIntervalMs,
|
|
48
86
|
onResult,
|
|
87
|
+
onFacesDetected,
|
|
88
|
+
onStableFaceDetected,
|
|
49
89
|
onError
|
|
50
90
|
).contentDeepHashCode()
|
|
51
91
|
}
|
|
@@ -58,8 +98,8 @@ data class SpoofDetectorOutputOptions(
|
|
|
58
98
|
@Keep
|
|
59
99
|
@Suppress("unused")
|
|
60
100
|
@JvmStatic
|
|
61
|
-
private fun fromCpp(targetResolution: Size?, onResult: Func_void_AntiSpoofingResult, onError: Func_void_std__exception_ptr?): SpoofDetectorOutputOptions {
|
|
62
|
-
return SpoofDetectorOutputOptions(targetResolution, onResult, onError)
|
|
101
|
+
private fun fromCpp(targetResolution: Size?, antispoofLevel: Double?, stableFrames: Double?, requiredLiveFrames: Double?, laplacianThreshold: Double?, maxNeuralSpoofScore: Double?, uiUpdateIntervalMs: Double?, onResult: Func_void_AntiSpoofingResult, onFacesDetected: Func_void_std__vector_SpoofDetectedFace_?, onStableFaceDetected: Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult?, onError: Func_void_std__exception_ptr?): SpoofDetectorOutputOptions {
|
|
102
|
+
return SpoofDetectorOutputOptions(targetResolution, antispoofLevel, stableFrames, requiredLiveFrames, laplacianThreshold, maxNeuralSpoofScore, uiUpdateIntervalMs, onResult, onFacesDetected, onStableFaceDetected, onError)
|
|
63
103
|
}
|
|
64
104
|
}
|
|
65
105
|
}
|
|
@@ -33,6 +33,22 @@ namespace margelo::nitro::camera::spoofdetector::bridge::swift {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
// pragma MARK: std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>
|
|
37
|
+
Func_void_std__vector_SpoofDetectedFace_ create_Func_void_std__vector_SpoofDetectedFace_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
38
|
+
auto swiftClosure = VisionCameraSpoofDetector::Func_void_std__vector_SpoofDetectedFace_::fromUnsafe(swiftClosureWrapper);
|
|
39
|
+
return [swiftClosure = std::move(swiftClosure)](const std::vector<SpoofDetectedFace>& faces) mutable -> void {
|
|
40
|
+
swiftClosure.call(faces);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// pragma MARK: std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>
|
|
45
|
+
Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult create_Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
46
|
+
auto swiftClosure = VisionCameraSpoofDetector::Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult::fromUnsafe(swiftClosureWrapper);
|
|
47
|
+
return [swiftClosure = std::move(swiftClosure)](const SpoofDetectedFaceBounds& face, const AntiSpoofingResult& result) mutable -> void {
|
|
48
|
+
swiftClosure.call(face, result);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
36
52
|
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
37
53
|
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
38
54
|
auto swiftClosure = VisionCameraSpoofDetector::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
@@ -16,6 +16,10 @@ namespace margelo::nitro::camera { class HybridCameraOutputSpec; }
|
|
|
16
16
|
namespace margelo::nitro::camera::spoofdetector { class HybridSpoofDetectorFactorySpec; }
|
|
17
17
|
// Forward declaration of `Size` to properly resolve imports.
|
|
18
18
|
namespace margelo::nitro::camera::spoofdetector { struct Size; }
|
|
19
|
+
// Forward declaration of `SpoofDetectedFaceBounds` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::camera::spoofdetector { struct SpoofDetectedFaceBounds; }
|
|
21
|
+
// Forward declaration of `SpoofDetectedFace` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::camera::spoofdetector { struct SpoofDetectedFace; }
|
|
19
23
|
|
|
20
24
|
// Forward declarations of Swift defined types
|
|
21
25
|
// Forward declaration of `HybridCameraOutputSpec_cxx` to properly resolve imports.
|
|
@@ -27,6 +31,8 @@ namespace VisionCameraSpoofDetector { class HybridSpoofDetectorFactorySpec_cxx;
|
|
|
27
31
|
#include "AntiSpoofingResult.hpp"
|
|
28
32
|
#include "HybridSpoofDetectorFactorySpec.hpp"
|
|
29
33
|
#include "Size.hpp"
|
|
34
|
+
#include "SpoofDetectedFace.hpp"
|
|
35
|
+
#include "SpoofDetectedFaceBounds.hpp"
|
|
30
36
|
#include <NitroModules/Result.hpp>
|
|
31
37
|
#include <VisionCamera/HybridCameraOutputSpec.hpp>
|
|
32
38
|
#include <exception>
|
|
@@ -34,6 +40,7 @@ namespace VisionCameraSpoofDetector { class HybridSpoofDetectorFactorySpec_cxx;
|
|
|
34
40
|
#include <memory>
|
|
35
41
|
#include <optional>
|
|
36
42
|
#include <string>
|
|
43
|
+
#include <vector>
|
|
37
44
|
|
|
38
45
|
/**
|
|
39
46
|
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
@@ -68,6 +75,21 @@ namespace margelo::nitro::camera::spoofdetector::bridge::swift {
|
|
|
68
75
|
return optional.value();
|
|
69
76
|
}
|
|
70
77
|
|
|
78
|
+
// pragma MARK: std::optional<double>
|
|
79
|
+
/**
|
|
80
|
+
* Specialized version of `std::optional<double>`.
|
|
81
|
+
*/
|
|
82
|
+
using std__optional_double_ = std::optional<double>;
|
|
83
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
84
|
+
return std::optional<double>(value);
|
|
85
|
+
}
|
|
86
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
87
|
+
return optional.has_value();
|
|
88
|
+
}
|
|
89
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
90
|
+
return optional.value();
|
|
91
|
+
}
|
|
92
|
+
|
|
71
93
|
// pragma MARK: std::function<void(const AntiSpoofingResult& /* result */)>
|
|
72
94
|
/**
|
|
73
95
|
* Specialized version of `std::function<void(const AntiSpoofingResult&)>`.
|
|
@@ -90,6 +112,91 @@ namespace margelo::nitro::camera::spoofdetector::bridge::swift {
|
|
|
90
112
|
return Func_void_AntiSpoofingResult_Wrapper(std::move(value));
|
|
91
113
|
}
|
|
92
114
|
|
|
115
|
+
// pragma MARK: std::vector<SpoofDetectedFace>
|
|
116
|
+
/**
|
|
117
|
+
* Specialized version of `std::vector<SpoofDetectedFace>`.
|
|
118
|
+
*/
|
|
119
|
+
using std__vector_SpoofDetectedFace_ = std::vector<SpoofDetectedFace>;
|
|
120
|
+
inline std::vector<SpoofDetectedFace> create_std__vector_SpoofDetectedFace_(size_t size) noexcept {
|
|
121
|
+
std::vector<SpoofDetectedFace> vector;
|
|
122
|
+
vector.reserve(size);
|
|
123
|
+
return vector;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// pragma MARK: std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>
|
|
127
|
+
/**
|
|
128
|
+
* Specialized version of `std::function<void(const std::vector<SpoofDetectedFace>&)>`.
|
|
129
|
+
*/
|
|
130
|
+
using Func_void_std__vector_SpoofDetectedFace_ = std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>;
|
|
131
|
+
/**
|
|
132
|
+
* Wrapper class for a `std::function<void(const std::vector<SpoofDetectedFace>& / * faces * /)>`, this can be used from Swift.
|
|
133
|
+
*/
|
|
134
|
+
class Func_void_std__vector_SpoofDetectedFace__Wrapper final {
|
|
135
|
+
public:
|
|
136
|
+
explicit Func_void_std__vector_SpoofDetectedFace__Wrapper(std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>&& func): _function(std::make_unique<std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>>(std::move(func))) {}
|
|
137
|
+
inline void call(std::vector<SpoofDetectedFace> faces) const noexcept {
|
|
138
|
+
_function->operator()(faces);
|
|
139
|
+
}
|
|
140
|
+
private:
|
|
141
|
+
std::unique_ptr<std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>> _function;
|
|
142
|
+
} SWIFT_NONCOPYABLE;
|
|
143
|
+
Func_void_std__vector_SpoofDetectedFace_ create_Func_void_std__vector_SpoofDetectedFace_(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
144
|
+
inline Func_void_std__vector_SpoofDetectedFace__Wrapper wrap_Func_void_std__vector_SpoofDetectedFace_(Func_void_std__vector_SpoofDetectedFace_ value) noexcept {
|
|
145
|
+
return Func_void_std__vector_SpoofDetectedFace__Wrapper(std::move(value));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// pragma MARK: std::optional<std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>>
|
|
149
|
+
/**
|
|
150
|
+
* Specialized version of `std::optional<std::function<void(const std::vector<SpoofDetectedFace>& / * faces * /)>>`.
|
|
151
|
+
*/
|
|
152
|
+
using std__optional_std__function_void_const_std__vector_SpoofDetectedFace______faces______ = std::optional<std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>>;
|
|
153
|
+
inline std::optional<std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>> create_std__optional_std__function_void_const_std__vector_SpoofDetectedFace______faces______(const std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>& value) noexcept {
|
|
154
|
+
return std::optional<std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>>(value);
|
|
155
|
+
}
|
|
156
|
+
inline bool has_value_std__optional_std__function_void_const_std__vector_SpoofDetectedFace______faces______(const std::optional<std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>>& optional) noexcept {
|
|
157
|
+
return optional.has_value();
|
|
158
|
+
}
|
|
159
|
+
inline std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)> get_std__optional_std__function_void_const_std__vector_SpoofDetectedFace______faces______(const std::optional<std::function<void(const std::vector<SpoofDetectedFace>& /* faces */)>>& optional) noexcept {
|
|
160
|
+
return optional.value();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// pragma MARK: std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>
|
|
164
|
+
/**
|
|
165
|
+
* Specialized version of `std::function<void(const SpoofDetectedFaceBounds&, const AntiSpoofingResult&)>`.
|
|
166
|
+
*/
|
|
167
|
+
using Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult = std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>;
|
|
168
|
+
/**
|
|
169
|
+
* Wrapper class for a `std::function<void(const SpoofDetectedFaceBounds& / * face * /, const AntiSpoofingResult& / * result * /)>`, this can be used from Swift.
|
|
170
|
+
*/
|
|
171
|
+
class Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult_Wrapper final {
|
|
172
|
+
public:
|
|
173
|
+
explicit Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult_Wrapper(std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>&& func): _function(std::make_unique<std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>>(std::move(func))) {}
|
|
174
|
+
inline void call(SpoofDetectedFaceBounds face, AntiSpoofingResult result) const noexcept {
|
|
175
|
+
_function->operator()(face, result);
|
|
176
|
+
}
|
|
177
|
+
private:
|
|
178
|
+
std::unique_ptr<std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>> _function;
|
|
179
|
+
} SWIFT_NONCOPYABLE;
|
|
180
|
+
Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult create_Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
181
|
+
inline Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult_Wrapper wrap_Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult(Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult value) noexcept {
|
|
182
|
+
return Func_void_SpoofDetectedFaceBounds_AntiSpoofingResult_Wrapper(std::move(value));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// pragma MARK: std::optional<std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>>
|
|
186
|
+
/**
|
|
187
|
+
* Specialized version of `std::optional<std::function<void(const SpoofDetectedFaceBounds& / * face * /, const AntiSpoofingResult& / * result * /)>>`.
|
|
188
|
+
*/
|
|
189
|
+
using std__optional_std__function_void_const_SpoofDetectedFaceBounds_____face_____const_AntiSpoofingResult_____result______ = std::optional<std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>>;
|
|
190
|
+
inline std::optional<std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>> create_std__optional_std__function_void_const_SpoofDetectedFaceBounds_____face_____const_AntiSpoofingResult_____result______(const std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>& value) noexcept {
|
|
191
|
+
return std::optional<std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>>(value);
|
|
192
|
+
}
|
|
193
|
+
inline bool has_value_std__optional_std__function_void_const_SpoofDetectedFaceBounds_____face_____const_AntiSpoofingResult_____result______(const std::optional<std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>>& optional) noexcept {
|
|
194
|
+
return optional.has_value();
|
|
195
|
+
}
|
|
196
|
+
inline std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)> get_std__optional_std__function_void_const_SpoofDetectedFaceBounds_____face_____const_AntiSpoofingResult_____result______(const std::optional<std::function<void(const SpoofDetectedFaceBounds& /* face */, const AntiSpoofingResult& /* result */)>>& optional) noexcept {
|
|
197
|
+
return optional.value();
|
|
198
|
+
}
|
|
199
|
+
|
|
93
200
|
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
94
201
|
/**
|
|
95
202
|
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
@@ -147,5 +254,14 @@ namespace margelo::nitro::camera::spoofdetector::bridge::swift {
|
|
|
147
254
|
inline Result_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec__ create_Result_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec__(const std::exception_ptr& error) noexcept {
|
|
148
255
|
return Result<std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec>>::withError(error);
|
|
149
256
|
}
|
|
257
|
+
|
|
258
|
+
// pragma MARK: Result<void>
|
|
259
|
+
using Result_void_ = Result<void>;
|
|
260
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
261
|
+
return Result<void>::withValue();
|
|
262
|
+
}
|
|
263
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
264
|
+
return Result<void>::withError(error);
|
|
265
|
+
}
|
|
150
266
|
|
|
151
267
|
} // namespace margelo::nitro::camera::spoofdetector::bridge::swift
|