munim-ffmpeg 0.1.0

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.
Files changed (60) hide show
  1. package/LICENSE +178 -0
  2. package/NitroMunimFfmpeg.podspec +41 -0
  3. package/README.md +95 -0
  4. package/android/CMakeLists.txt +29 -0
  5. package/android/build.gradle +144 -0
  6. package/android/fix-prefab.gradle +51 -0
  7. package/android/gradle.properties +5 -0
  8. package/android/src/main/AndroidManifest.xml +2 -0
  9. package/android/src/main/cpp/cpp-adapter.cpp +9 -0
  10. package/android/src/main/java/com/margelo/nitro/munimffmpeg/HybridMunimFfmpeg.kt +141 -0
  11. package/android/src/main/java/com/margelo/nitro/munimffmpeg/NitroMunimFfmpegPackage.kt +18 -0
  12. package/app.plugin.js +5 -0
  13. package/ios/Bridge.h +8 -0
  14. package/ios/HybridMunimFfmpeg.swift +161 -0
  15. package/lib/index.d.ts +10 -0
  16. package/lib/index.js +21 -0
  17. package/lib/specs/MunimFfmpeg.nitro.d.ts +25 -0
  18. package/lib/specs/MunimFfmpeg.nitro.js +1 -0
  19. package/nitro.json +30 -0
  20. package/nitrogen/generated/.gitattributes +1 -0
  21. package/nitrogen/generated/android/NitroMunimFfmpeg+autolinking.cmake +81 -0
  22. package/nitrogen/generated/android/NitroMunimFfmpeg+autolinking.gradle +27 -0
  23. package/nitrogen/generated/android/NitroMunimFfmpegOnLoad.cpp +60 -0
  24. package/nitrogen/generated/android/NitroMunimFfmpegOnLoad.hpp +34 -0
  25. package/nitrogen/generated/android/c++/JFFmpegSessionResult.hpp +86 -0
  26. package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  27. package/nitrogen/generated/android/c++/JFunc_void_double_double_double_double_double_double_double.hpp +75 -0
  28. package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  29. package/nitrogen/generated/android/c++/JHybridMunimFfmpegSpec.cpp +138 -0
  30. package/nitrogen/generated/android/c++/JHybridMunimFfmpegSpec.hpp +67 -0
  31. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/FFmpegSessionResult.kt +86 -0
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/Func_void_double.kt +78 -0
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/Func_void_double_double_double_double_double_double_double.kt +78 -0
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/Func_void_std__string.kt +78 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/HybridMunimFfmpegSpec.kt +85 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/NitroMunimFfmpegOnLoad.kt +35 -0
  37. package/nitrogen/generated/ios/NitroMunimFfmpeg+autolinking.rb +62 -0
  38. package/nitrogen/generated/ios/NitroMunimFfmpeg-Swift-Cxx-Bridge.cpp +73 -0
  39. package/nitrogen/generated/ios/NitroMunimFfmpeg-Swift-Cxx-Bridge.hpp +298 -0
  40. package/nitrogen/generated/ios/NitroMunimFfmpeg-Swift-Cxx-Umbrella.hpp +51 -0
  41. package/nitrogen/generated/ios/NitroMunimFfmpegAutolinking.mm +33 -0
  42. package/nitrogen/generated/ios/NitroMunimFfmpegAutolinking.swift +26 -0
  43. package/nitrogen/generated/ios/c++/HybridMunimFfmpegSpecSwift.cpp +11 -0
  44. package/nitrogen/generated/ios/c++/HybridMunimFfmpegSpecSwift.hpp +119 -0
  45. package/nitrogen/generated/ios/swift/FFmpegSessionResult.swift +77 -0
  46. package/nitrogen/generated/ios/swift/Func_void_FFmpegSessionResult.swift +46 -0
  47. package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
  48. package/nitrogen/generated/ios/swift/Func_void_double_double_double_double_double_double_double.swift +46 -0
  49. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  50. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  51. package/nitrogen/generated/ios/swift/HybridMunimFfmpegSpec.swift +59 -0
  52. package/nitrogen/generated/ios/swift/HybridMunimFfmpegSpec_cxx.swift +277 -0
  53. package/nitrogen/generated/shared/c++/FFmpegSessionResult.hpp +112 -0
  54. package/nitrogen/generated/shared/c++/HybridMunimFfmpegSpec.cpp +26 -0
  55. package/nitrogen/generated/shared/c++/HybridMunimFfmpegSpec.hpp +72 -0
  56. package/package.json +131 -0
  57. package/react-native.config.js +16 -0
  58. package/scripts/patch-ffmpegkit-level.rb +45 -0
  59. package/src/index.ts +56 -0
  60. package/src/specs/MunimFfmpeg.nitro.ts +52 -0
@@ -0,0 +1,298 @@
1
+ ///
2
+ /// NitroMunimFfmpeg-Swift-Cxx-Bridge.hpp
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
+ #pragma once
9
+
10
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `FFmpegSessionResult` to properly resolve imports.
12
+ namespace margelo::nitro::munimffmpeg { struct FFmpegSessionResult; }
13
+ // Forward declaration of `HybridMunimFfmpegSpec` to properly resolve imports.
14
+ namespace margelo::nitro::munimffmpeg { class HybridMunimFfmpegSpec; }
15
+
16
+ // Forward declarations of Swift defined types
17
+ // Forward declaration of `HybridMunimFfmpegSpec_cxx` to properly resolve imports.
18
+ namespace NitroMunimFfmpeg { class HybridMunimFfmpegSpec_cxx; }
19
+
20
+ // Include C++ defined types
21
+ #include "FFmpegSessionResult.hpp"
22
+ #include "HybridMunimFfmpegSpec.hpp"
23
+ #include <NitroModules/Promise.hpp>
24
+ #include <NitroModules/PromiseHolder.hpp>
25
+ #include <NitroModules/Result.hpp>
26
+ #include <exception>
27
+ #include <functional>
28
+ #include <memory>
29
+ #include <optional>
30
+ #include <string>
31
+ #include <vector>
32
+
33
+ /**
34
+ * Contains specialized versions of C++ templated types so they can be accessed from Swift,
35
+ * as well as helper functions to interact with those C++ types from Swift.
36
+ */
37
+ namespace margelo::nitro::munimffmpeg::bridge::swift {
38
+
39
+ // pragma MARK: std::optional<std::string>
40
+ /**
41
+ * Specialized version of `std::optional<std::string>`.
42
+ */
43
+ using std__optional_std__string_ = std::optional<std::string>;
44
+ inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
45
+ return std::optional<std::string>(value);
46
+ }
47
+ inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
48
+ return optional.has_value();
49
+ }
50
+ inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
51
+ return optional.value();
52
+ }
53
+
54
+ // pragma MARK: std::shared_ptr<Promise<FFmpegSessionResult>>
55
+ /**
56
+ * Specialized version of `std::shared_ptr<Promise<FFmpegSessionResult>>`.
57
+ */
58
+ using std__shared_ptr_Promise_FFmpegSessionResult__ = std::shared_ptr<Promise<FFmpegSessionResult>>;
59
+ inline std::shared_ptr<Promise<FFmpegSessionResult>> create_std__shared_ptr_Promise_FFmpegSessionResult__() noexcept {
60
+ return Promise<FFmpegSessionResult>::create();
61
+ }
62
+ inline PromiseHolder<FFmpegSessionResult> wrap_std__shared_ptr_Promise_FFmpegSessionResult__(std::shared_ptr<Promise<FFmpegSessionResult>> promise) noexcept {
63
+ return PromiseHolder<FFmpegSessionResult>(std::move(promise));
64
+ }
65
+
66
+ // pragma MARK: std::function<void(const FFmpegSessionResult& /* result */)>
67
+ /**
68
+ * Specialized version of `std::function<void(const FFmpegSessionResult&)>`.
69
+ */
70
+ using Func_void_FFmpegSessionResult = std::function<void(const FFmpegSessionResult& /* result */)>;
71
+ /**
72
+ * Wrapper class for a `std::function<void(const FFmpegSessionResult& / * result * /)>`, this can be used from Swift.
73
+ */
74
+ class Func_void_FFmpegSessionResult_Wrapper final {
75
+ public:
76
+ explicit Func_void_FFmpegSessionResult_Wrapper(std::function<void(const FFmpegSessionResult& /* result */)>&& func): _function(std::make_unique<std::function<void(const FFmpegSessionResult& /* result */)>>(std::move(func))) {}
77
+ inline void call(FFmpegSessionResult result) const noexcept {
78
+ _function->operator()(result);
79
+ }
80
+ private:
81
+ std::unique_ptr<std::function<void(const FFmpegSessionResult& /* result */)>> _function;
82
+ } SWIFT_NONCOPYABLE;
83
+ Func_void_FFmpegSessionResult create_Func_void_FFmpegSessionResult(void* NON_NULL swiftClosureWrapper) noexcept;
84
+ inline Func_void_FFmpegSessionResult_Wrapper wrap_Func_void_FFmpegSessionResult(Func_void_FFmpegSessionResult value) noexcept {
85
+ return Func_void_FFmpegSessionResult_Wrapper(std::move(value));
86
+ }
87
+
88
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
89
+ /**
90
+ * Specialized version of `std::function<void(const std::exception_ptr&)>`.
91
+ */
92
+ using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
93
+ /**
94
+ * Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
95
+ */
96
+ class Func_void_std__exception_ptr_Wrapper final {
97
+ public:
98
+ explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
99
+ inline void call(std::exception_ptr error) const noexcept {
100
+ _function->operator()(error);
101
+ }
102
+ private:
103
+ std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
104
+ } SWIFT_NONCOPYABLE;
105
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
106
+ inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
107
+ return Func_void_std__exception_ptr_Wrapper(std::move(value));
108
+ }
109
+
110
+ // pragma MARK: std::vector<std::string>
111
+ /**
112
+ * Specialized version of `std::vector<std::string>`.
113
+ */
114
+ using std__vector_std__string_ = std::vector<std::string>;
115
+ inline std::vector<std::string> create_std__vector_std__string_(size_t size) noexcept {
116
+ std::vector<std::string> vector;
117
+ vector.reserve(size);
118
+ return vector;
119
+ }
120
+
121
+ // pragma MARK: std::function<void(const std::string& /* message */)>
122
+ /**
123
+ * Specialized version of `std::function<void(const std::string&)>`.
124
+ */
125
+ using Func_void_std__string = std::function<void(const std::string& /* message */)>;
126
+ /**
127
+ * Wrapper class for a `std::function<void(const std::string& / * message * /)>`, this can be used from Swift.
128
+ */
129
+ class Func_void_std__string_Wrapper final {
130
+ public:
131
+ explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /* message */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* message */)>>(std::move(func))) {}
132
+ inline void call(std::string message) const noexcept {
133
+ _function->operator()(message);
134
+ }
135
+ private:
136
+ std::unique_ptr<std::function<void(const std::string& /* message */)>> _function;
137
+ } SWIFT_NONCOPYABLE;
138
+ Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept;
139
+ inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) noexcept {
140
+ return Func_void_std__string_Wrapper(std::move(value));
141
+ }
142
+
143
+ // pragma MARK: std::optional<std::function<void(const std::string& /* message */)>>
144
+ /**
145
+ * Specialized version of `std::optional<std::function<void(const std::string& / * message * /)>>`.
146
+ */
147
+ using std__optional_std__function_void_const_std__string_____message______ = std::optional<std::function<void(const std::string& /* message */)>>;
148
+ inline std::optional<std::function<void(const std::string& /* message */)>> create_std__optional_std__function_void_const_std__string_____message______(const std::function<void(const std::string& /* message */)>& value) noexcept {
149
+ return std::optional<std::function<void(const std::string& /* message */)>>(value);
150
+ }
151
+ inline bool has_value_std__optional_std__function_void_const_std__string_____message______(const std::optional<std::function<void(const std::string& /* message */)>>& optional) noexcept {
152
+ return optional.has_value();
153
+ }
154
+ inline std::function<void(const std::string& /* message */)> get_std__optional_std__function_void_const_std__string_____message______(const std::optional<std::function<void(const std::string& /* message */)>>& optional) noexcept {
155
+ return optional.value();
156
+ }
157
+
158
+ // pragma MARK: std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>
159
+ /**
160
+ * Specialized version of `std::function<void(double, double, double, double, double, double, double)>`.
161
+ */
162
+ using Func_void_double_double_double_double_double_double_double = std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>;
163
+ /**
164
+ * Wrapper class for a `std::function<void(double / * timeMs * /, double / * sizeBytes * /, double / * bitrateKbits * /, double / * speed * /, double / * videoFrameNumber * /, double / * fps * /, double / * quality * /)>`, this can be used from Swift.
165
+ */
166
+ class Func_void_double_double_double_double_double_double_double_Wrapper final {
167
+ public:
168
+ explicit Func_void_double_double_double_double_double_double_double_Wrapper(std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>&& func): _function(std::make_unique<std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>>(std::move(func))) {}
169
+ inline void call(double timeMs, double sizeBytes, double bitrateKbits, double speed, double videoFrameNumber, double fps, double quality) const noexcept {
170
+ _function->operator()(timeMs, sizeBytes, bitrateKbits, speed, videoFrameNumber, fps, quality);
171
+ }
172
+ private:
173
+ std::unique_ptr<std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>> _function;
174
+ } SWIFT_NONCOPYABLE;
175
+ Func_void_double_double_double_double_double_double_double create_Func_void_double_double_double_double_double_double_double(void* NON_NULL swiftClosureWrapper) noexcept;
176
+ inline Func_void_double_double_double_double_double_double_double_Wrapper wrap_Func_void_double_double_double_double_double_double_double(Func_void_double_double_double_double_double_double_double value) noexcept {
177
+ return Func_void_double_double_double_double_double_double_double_Wrapper(std::move(value));
178
+ }
179
+
180
+ // pragma MARK: std::optional<std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>>
181
+ /**
182
+ * Specialized version of `std::optional<std::function<void(double / * timeMs * /, double / * sizeBytes * /, double / * bitrateKbits * /, double / * speed * /, double / * videoFrameNumber * /, double / * fps * /, double / * quality * /)>>`.
183
+ */
184
+ using std__optional_std__function_void_double____timeMs_____double____sizeBytes_____double____bitrateKbits_____double____speed_____double____videoFrameNumber_____double____fps_____double____quality______ = std::optional<std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>>;
185
+ inline std::optional<std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>> create_std__optional_std__function_void_double____timeMs_____double____sizeBytes_____double____bitrateKbits_____double____speed_____double____videoFrameNumber_____double____fps_____double____quality______(const std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>& value) noexcept {
186
+ return std::optional<std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>>(value);
187
+ }
188
+ inline bool has_value_std__optional_std__function_void_double____timeMs_____double____sizeBytes_____double____bitrateKbits_____double____speed_____double____videoFrameNumber_____double____fps_____double____quality______(const std::optional<std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>>& optional) noexcept {
189
+ return optional.has_value();
190
+ }
191
+ inline std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)> get_std__optional_std__function_void_double____timeMs_____double____sizeBytes_____double____bitrateKbits_____double____speed_____double____videoFrameNumber_____double____fps_____double____quality______(const std::optional<std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>>& optional) noexcept {
192
+ return optional.value();
193
+ }
194
+
195
+ // pragma MARK: std::function<void(double /* sessionId */)>
196
+ /**
197
+ * Specialized version of `std::function<void(double)>`.
198
+ */
199
+ using Func_void_double = std::function<void(double /* sessionId */)>;
200
+ /**
201
+ * Wrapper class for a `std::function<void(double / * sessionId * /)>`, this can be used from Swift.
202
+ */
203
+ class Func_void_double_Wrapper final {
204
+ public:
205
+ explicit Func_void_double_Wrapper(std::function<void(double /* sessionId */)>&& func): _function(std::make_unique<std::function<void(double /* sessionId */)>>(std::move(func))) {}
206
+ inline void call(double sessionId) const noexcept {
207
+ _function->operator()(sessionId);
208
+ }
209
+ private:
210
+ std::unique_ptr<std::function<void(double /* sessionId */)>> _function;
211
+ } SWIFT_NONCOPYABLE;
212
+ Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept;
213
+ inline Func_void_double_Wrapper wrap_Func_void_double(Func_void_double value) noexcept {
214
+ return Func_void_double_Wrapper(std::move(value));
215
+ }
216
+
217
+ // pragma MARK: std::optional<std::function<void(double /* sessionId */)>>
218
+ /**
219
+ * Specialized version of `std::optional<std::function<void(double / * sessionId * /)>>`.
220
+ */
221
+ using std__optional_std__function_void_double____sessionId______ = std::optional<std::function<void(double /* sessionId */)>>;
222
+ inline std::optional<std::function<void(double /* sessionId */)>> create_std__optional_std__function_void_double____sessionId______(const std::function<void(double /* sessionId */)>& value) noexcept {
223
+ return std::optional<std::function<void(double /* sessionId */)>>(value);
224
+ }
225
+ inline bool has_value_std__optional_std__function_void_double____sessionId______(const std::optional<std::function<void(double /* sessionId */)>>& optional) noexcept {
226
+ return optional.has_value();
227
+ }
228
+ inline std::function<void(double /* sessionId */)> get_std__optional_std__function_void_double____sessionId______(const std::optional<std::function<void(double /* sessionId */)>>& optional) noexcept {
229
+ return optional.value();
230
+ }
231
+
232
+ // pragma MARK: std::shared_ptr<Promise<std::string>>
233
+ /**
234
+ * Specialized version of `std::shared_ptr<Promise<std::string>>`.
235
+ */
236
+ using std__shared_ptr_Promise_std__string__ = std::shared_ptr<Promise<std::string>>;
237
+ inline std::shared_ptr<Promise<std::string>> create_std__shared_ptr_Promise_std__string__() noexcept {
238
+ return Promise<std::string>::create();
239
+ }
240
+ inline PromiseHolder<std::string> wrap_std__shared_ptr_Promise_std__string__(std::shared_ptr<Promise<std::string>> promise) noexcept {
241
+ return PromiseHolder<std::string>(std::move(promise));
242
+ }
243
+
244
+ // pragma MARK: std::optional<double>
245
+ /**
246
+ * Specialized version of `std::optional<double>`.
247
+ */
248
+ using std__optional_double_ = std::optional<double>;
249
+ inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
250
+ return std::optional<double>(value);
251
+ }
252
+ inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
253
+ return optional.has_value();
254
+ }
255
+ inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
256
+ return optional.value();
257
+ }
258
+
259
+ // pragma MARK: std::shared_ptr<HybridMunimFfmpegSpec>
260
+ /**
261
+ * Specialized version of `std::shared_ptr<HybridMunimFfmpegSpec>`.
262
+ */
263
+ using std__shared_ptr_HybridMunimFfmpegSpec_ = std::shared_ptr<HybridMunimFfmpegSpec>;
264
+ std::shared_ptr<HybridMunimFfmpegSpec> create_std__shared_ptr_HybridMunimFfmpegSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
265
+ void* NON_NULL get_std__shared_ptr_HybridMunimFfmpegSpec_(std__shared_ptr_HybridMunimFfmpegSpec_ cppType);
266
+
267
+ // pragma MARK: std::weak_ptr<HybridMunimFfmpegSpec>
268
+ using std__weak_ptr_HybridMunimFfmpegSpec_ = std::weak_ptr<HybridMunimFfmpegSpec>;
269
+ inline std__weak_ptr_HybridMunimFfmpegSpec_ weakify_std__shared_ptr_HybridMunimFfmpegSpec_(const std::shared_ptr<HybridMunimFfmpegSpec>& strong) noexcept { return strong; }
270
+
271
+ // pragma MARK: Result<std::shared_ptr<Promise<FFmpegSessionResult>>>
272
+ using Result_std__shared_ptr_Promise_FFmpegSessionResult___ = Result<std::shared_ptr<Promise<FFmpegSessionResult>>>;
273
+ inline Result_std__shared_ptr_Promise_FFmpegSessionResult___ create_Result_std__shared_ptr_Promise_FFmpegSessionResult___(const std::shared_ptr<Promise<FFmpegSessionResult>>& value) noexcept {
274
+ return Result<std::shared_ptr<Promise<FFmpegSessionResult>>>::withValue(value);
275
+ }
276
+ inline Result_std__shared_ptr_Promise_FFmpegSessionResult___ create_Result_std__shared_ptr_Promise_FFmpegSessionResult___(const std::exception_ptr& error) noexcept {
277
+ return Result<std::shared_ptr<Promise<FFmpegSessionResult>>>::withError(error);
278
+ }
279
+
280
+ // pragma MARK: Result<std::shared_ptr<Promise<std::string>>>
281
+ using Result_std__shared_ptr_Promise_std__string___ = Result<std::shared_ptr<Promise<std::string>>>;
282
+ inline Result_std__shared_ptr_Promise_std__string___ create_Result_std__shared_ptr_Promise_std__string___(const std::shared_ptr<Promise<std::string>>& value) noexcept {
283
+ return Result<std::shared_ptr<Promise<std::string>>>::withValue(value);
284
+ }
285
+ inline Result_std__shared_ptr_Promise_std__string___ create_Result_std__shared_ptr_Promise_std__string___(const std::exception_ptr& error) noexcept {
286
+ return Result<std::shared_ptr<Promise<std::string>>>::withError(error);
287
+ }
288
+
289
+ // pragma MARK: Result<void>
290
+ using Result_void_ = Result<void>;
291
+ inline Result_void_ create_Result_void_() noexcept {
292
+ return Result<void>::withValue();
293
+ }
294
+ inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
295
+ return Result<void>::withError(error);
296
+ }
297
+
298
+ } // namespace margelo::nitro::munimffmpeg::bridge::swift
@@ -0,0 +1,51 @@
1
+ ///
2
+ /// NitroMunimFfmpeg-Swift-Cxx-Umbrella.hpp
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
+ #pragma once
9
+
10
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `FFmpegSessionResult` to properly resolve imports.
12
+ namespace margelo::nitro::munimffmpeg { struct FFmpegSessionResult; }
13
+ // Forward declaration of `HybridMunimFfmpegSpec` to properly resolve imports.
14
+ namespace margelo::nitro::munimffmpeg { class HybridMunimFfmpegSpec; }
15
+
16
+ // Include C++ defined types
17
+ #include "FFmpegSessionResult.hpp"
18
+ #include "HybridMunimFfmpegSpec.hpp"
19
+ #include <NitroModules/Promise.hpp>
20
+ #include <NitroModules/Result.hpp>
21
+ #include <exception>
22
+ #include <functional>
23
+ #include <memory>
24
+ #include <optional>
25
+ #include <string>
26
+ #include <vector>
27
+
28
+ // C++ helpers for Swift
29
+ #include "NitroMunimFfmpeg-Swift-Cxx-Bridge.hpp"
30
+
31
+ // Common C++ types used in Swift
32
+ #include <NitroModules/ArrayBufferHolder.hpp>
33
+ #include <NitroModules/AnyMapUtils.hpp>
34
+ #include <NitroModules/RuntimeError.hpp>
35
+ #include <NitroModules/DateToChronoDate.hpp>
36
+
37
+ // Forward declarations of Swift defined types
38
+ // Forward declaration of `HybridMunimFfmpegSpec_cxx` to properly resolve imports.
39
+ namespace NitroMunimFfmpeg { class HybridMunimFfmpegSpec_cxx; }
40
+
41
+ // Include Swift defined types
42
+ #if __has_include("NitroMunimFfmpeg-Swift.h")
43
+ // This header is generated by Xcode/Swift on every app build.
44
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroMunimFfmpeg".
45
+ #include "NitroMunimFfmpeg-Swift.h"
46
+ // Same as above, but used when building with frameworks (`use_frameworks`)
47
+ #elif __has_include(<NitroMunimFfmpeg/NitroMunimFfmpeg-Swift.h>)
48
+ #include <NitroMunimFfmpeg/NitroMunimFfmpeg-Swift.h>
49
+ #else
50
+ #error NitroMunimFfmpeg's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroMunimFfmpeg", and try building the app first.
51
+ #endif
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// NitroMunimFfmpegAutolinking.mm
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
+ #import <Foundation/Foundation.h>
9
+ #import <NitroModules/HybridObjectRegistry.hpp>
10
+ #import "NitroMunimFfmpeg-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridMunimFfmpegSpecSwift.hpp"
14
+
15
+ @interface NitroMunimFfmpegAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation NitroMunimFfmpegAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::munimffmpeg;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "MunimFfmpeg",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ std::shared_ptr<HybridMunimFfmpegSpec> hybridObject = NitroMunimFfmpeg::NitroMunimFfmpegAutolinking::createMunimFfmpeg();
28
+ return hybridObject;
29
+ }
30
+ );
31
+ }
32
+
33
+ @end
@@ -0,0 +1,26 @@
1
+ ///
2
+ /// NitroMunimFfmpegAutolinking.swift
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
+ import NitroModules
9
+
10
+ // TODO: Use empty enums once Swift supports exporting them as namespaces
11
+ // See: https://github.com/swiftlang/swift/pull/83616
12
+ public final class NitroMunimFfmpegAutolinking {
13
+ public typealias bridge = margelo.nitro.munimffmpeg.bridge.swift
14
+
15
+ public static func createMunimFfmpeg() -> bridge.std__shared_ptr_HybridMunimFfmpegSpec_ {
16
+ let hybridObject = HybridMunimFfmpeg()
17
+ return { () -> bridge.std__shared_ptr_HybridMunimFfmpegSpec_ in
18
+ let __cxxWrapped = hybridObject.getCxxWrapper()
19
+ return __cxxWrapped.getCxxPart()
20
+ }()
21
+ }
22
+
23
+ public static func isMunimFfmpegRecyclable() -> Bool {
24
+ return HybridMunimFfmpeg.self is any RecyclableView.Type
25
+ }
26
+ }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridMunimFfmpegSpecSwift.cpp
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
+ #include "HybridMunimFfmpegSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::munimffmpeg {
11
+ } // namespace margelo::nitro::munimffmpeg
@@ -0,0 +1,119 @@
1
+ ///
2
+ /// HybridMunimFfmpegSpecSwift.hpp
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
+ #pragma once
9
+
10
+ #include "HybridMunimFfmpegSpec.hpp"
11
+
12
+ // Forward declaration of `HybridMunimFfmpegSpec_cxx` to properly resolve imports.
13
+ namespace NitroMunimFfmpeg { class HybridMunimFfmpegSpec_cxx; }
14
+
15
+ // Forward declaration of `FFmpegSessionResult` to properly resolve imports.
16
+ namespace margelo::nitro::munimffmpeg { struct FFmpegSessionResult; }
17
+
18
+ #include <string>
19
+ #include "FFmpegSessionResult.hpp"
20
+ #include <NitroModules/Promise.hpp>
21
+ #include <optional>
22
+ #include <vector>
23
+ #include <functional>
24
+
25
+ #include "NitroMunimFfmpeg-Swift-Cxx-Umbrella.hpp"
26
+
27
+ namespace margelo::nitro::munimffmpeg {
28
+
29
+ /**
30
+ * The C++ part of HybridMunimFfmpegSpec_cxx.swift.
31
+ *
32
+ * HybridMunimFfmpegSpecSwift (C++) accesses HybridMunimFfmpegSpec_cxx (Swift), and might
33
+ * contain some additional bridging code for C++ <> Swift interop.
34
+ *
35
+ * Since this obviously introduces an overhead, I hope at some point in
36
+ * the future, HybridMunimFfmpegSpec_cxx can directly inherit from the C++ class HybridMunimFfmpegSpec
37
+ * to simplify the whole structure and memory management.
38
+ */
39
+ class HybridMunimFfmpegSpecSwift: public virtual HybridMunimFfmpegSpec {
40
+ public:
41
+ // Constructor from a Swift instance
42
+ explicit HybridMunimFfmpegSpecSwift(const NitroMunimFfmpeg::HybridMunimFfmpegSpec_cxx& swiftPart):
43
+ HybridObject(HybridMunimFfmpegSpec::TAG),
44
+ _swiftPart(swiftPart) { }
45
+
46
+ public:
47
+ // Get the Swift part
48
+ inline NitroMunimFfmpeg::HybridMunimFfmpegSpec_cxx& getSwiftPart() noexcept {
49
+ return _swiftPart;
50
+ }
51
+
52
+ public:
53
+ inline size_t getExternalMemorySize() noexcept override {
54
+ return _swiftPart.getMemorySize();
55
+ }
56
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
57
+ if (auto otherCast = std::dynamic_pointer_cast<HybridMunimFfmpegSpecSwift>(other)) {
58
+ return _swiftPart.equals(otherCast->_swiftPart);
59
+ }
60
+ return false;
61
+ }
62
+ void dispose() noexcept override {
63
+ _swiftPart.dispose();
64
+ }
65
+ std::string toString() override {
66
+ return _swiftPart.toString();
67
+ }
68
+
69
+ public:
70
+ // Properties
71
+ inline std::string getFfmpegVersion() noexcept override {
72
+ auto __result = _swiftPart.getFfmpegVersion();
73
+ return __result;
74
+ }
75
+
76
+ public:
77
+ // Methods
78
+ inline std::shared_ptr<Promise<FFmpegSessionResult>> execute(const std::vector<std::string>& arguments_, const std::optional<std::function<void(const std::string& /* message */)>>& onLog, const std::optional<std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>>& onStatistics, const std::optional<std::function<void(double /* sessionId */)>>& onSessionCreated) override {
79
+ auto __result = _swiftPart.execute(arguments_, onLog, onStatistics, onSessionCreated);
80
+ if (__result.hasError()) [[unlikely]] {
81
+ std::rethrow_exception(__result.error());
82
+ }
83
+ auto __value = std::move(__result.value());
84
+ return __value;
85
+ }
86
+ inline std::shared_ptr<Promise<FFmpegSessionResult>> probe(const std::vector<std::string>& arguments_, const std::optional<std::function<void(const std::string& /* message */)>>& onLog, const std::optional<std::function<void(double /* sessionId */)>>& onSessionCreated) override {
87
+ auto __result = _swiftPart.probe(arguments_, onLog, onSessionCreated);
88
+ if (__result.hasError()) [[unlikely]] {
89
+ std::rethrow_exception(__result.error());
90
+ }
91
+ auto __value = std::move(__result.value());
92
+ return __value;
93
+ }
94
+ inline std::shared_ptr<Promise<std::string>> getMediaInformation(const std::string& path) override {
95
+ auto __result = _swiftPart.getMediaInformation(path);
96
+ if (__result.hasError()) [[unlikely]] {
97
+ std::rethrow_exception(__result.error());
98
+ }
99
+ auto __value = std::move(__result.value());
100
+ return __value;
101
+ }
102
+ inline void cancel(std::optional<double> sessionId) override {
103
+ auto __result = _swiftPart.cancel(sessionId);
104
+ if (__result.hasError()) [[unlikely]] {
105
+ std::rethrow_exception(__result.error());
106
+ }
107
+ }
108
+ inline void cancelAll() override {
109
+ auto __result = _swiftPart.cancelAll();
110
+ if (__result.hasError()) [[unlikely]] {
111
+ std::rethrow_exception(__result.error());
112
+ }
113
+ }
114
+
115
+ private:
116
+ NitroMunimFfmpeg::HybridMunimFfmpegSpec_cxx _swiftPart;
117
+ };
118
+
119
+ } // namespace margelo::nitro::munimffmpeg
@@ -0,0 +1,77 @@
1
+ ///
2
+ /// FFmpegSessionResult.swift
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
+ import NitroModules
9
+
10
+ /**
11
+ * Represents an instance of `FFmpegSessionResult`, backed by a C++ struct.
12
+ */
13
+ public typealias FFmpegSessionResult = margelo.nitro.munimffmpeg.FFmpegSessionResult
14
+
15
+ public extension FFmpegSessionResult {
16
+ private typealias bridge = margelo.nitro.munimffmpeg.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `FFmpegSessionResult`.
20
+ */
21
+ init(sessionId: Double, returnCode: Double, success: Bool, cancelled: Bool, state: String, durationMs: Double, output: String, failStackTrace: String?) {
22
+ self.init(sessionId, returnCode, success, cancelled, std.string(state), durationMs, std.string(output), { () -> bridge.std__optional_std__string_ in
23
+ if let __unwrappedValue = failStackTrace {
24
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
25
+ } else {
26
+ return .init()
27
+ }
28
+ }())
29
+ }
30
+
31
+ @inline(__always)
32
+ var sessionId: Double {
33
+ return self.__sessionId
34
+ }
35
+
36
+ @inline(__always)
37
+ var returnCode: Double {
38
+ return self.__returnCode
39
+ }
40
+
41
+ @inline(__always)
42
+ var success: Bool {
43
+ return self.__success
44
+ }
45
+
46
+ @inline(__always)
47
+ var cancelled: Bool {
48
+ return self.__cancelled
49
+ }
50
+
51
+ @inline(__always)
52
+ var state: String {
53
+ return String(self.__state)
54
+ }
55
+
56
+ @inline(__always)
57
+ var durationMs: Double {
58
+ return self.__durationMs
59
+ }
60
+
61
+ @inline(__always)
62
+ var output: String {
63
+ return String(self.__output)
64
+ }
65
+
66
+ @inline(__always)
67
+ var failStackTrace: String? {
68
+ return { () -> String? in
69
+ if bridge.has_value_std__optional_std__string_(self.__failStackTrace) {
70
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__failStackTrace)
71
+ return String(__unwrapped)
72
+ } else {
73
+ return nil
74
+ }
75
+ }()
76
+ }
77
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_FFmpegSessionResult.swift
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
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: FFmpegSessionResult) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_FFmpegSessionResult {
15
+ public typealias bridge = margelo.nitro.munimffmpeg.bridge.swift
16
+
17
+ private let closure: (_ value: FFmpegSessionResult) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: FFmpegSessionResult) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: FFmpegSessionResult) -> Void {
25
+ self.closure(value)
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_FFmpegSessionResult`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_FFmpegSessionResult>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_FFmpegSessionResult {
44
+ return Unmanaged<Func_void_FFmpegSessionResult>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }