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,78 @@
1
+ ///
2
+ /// Func_void_double.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.munimffmpeg
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 `(sessionId: number) => 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_double: (Double) -> 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(sessionId: Double): Unit
31
+ }
32
+
33
+ /**
34
+ * Represents the JavaScript callback `(sessionId: number) => 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_double_cxx: Func_void_double {
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(sessionId: Double): Unit
59
+ = invoke_cxx(sessionId)
60
+
61
+ private external fun invoke_cxx(sessionId: Double): Unit
62
+ }
63
+
64
+ /**
65
+ * Represents the JavaScript callback `(sessionId: number) => void`.
66
+ * This is implemented in Java/Kotlin, via a `(Double) -> Unit`.
67
+ * The callback is always coming from native.
68
+ */
69
+ @DoNotStrip
70
+ @Keep
71
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
72
+ class Func_void_double_java(private val function: (Double) -> Unit): Func_void_double {
73
+ @DoNotStrip
74
+ @Keep
75
+ override fun invoke(sessionId: Double): Unit {
76
+ return this.function(sessionId)
77
+ }
78
+ }
@@ -0,0 +1,78 @@
1
+ ///
2
+ /// Func_void_double_double_double_double_double_double_double.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.munimffmpeg
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 `(timeMs: number, sizeBytes: number, bitrateKbits: number, speed: number, videoFrameNumber: number, fps: number, quality: number) => 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_double_double_double_double_double_double_double: (Double, Double, Double, Double, Double, Double, Double) -> 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(timeMs: Double, sizeBytes: Double, bitrateKbits: Double, speed: Double, videoFrameNumber: Double, fps: Double, quality: Double): Unit
31
+ }
32
+
33
+ /**
34
+ * Represents the JavaScript callback `(timeMs: number, sizeBytes: number, bitrateKbits: number, speed: number, videoFrameNumber: number, fps: number, quality: number) => 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_double_double_double_double_double_double_double_cxx: Func_void_double_double_double_double_double_double_double {
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(timeMs: Double, sizeBytes: Double, bitrateKbits: Double, speed: Double, videoFrameNumber: Double, fps: Double, quality: Double): Unit
59
+ = invoke_cxx(timeMs,sizeBytes,bitrateKbits,speed,videoFrameNumber,fps,quality)
60
+
61
+ private external fun invoke_cxx(timeMs: Double, sizeBytes: Double, bitrateKbits: Double, speed: Double, videoFrameNumber: Double, fps: Double, quality: Double): Unit
62
+ }
63
+
64
+ /**
65
+ * Represents the JavaScript callback `(timeMs: number, sizeBytes: number, bitrateKbits: number, speed: number, videoFrameNumber: number, fps: number, quality: number) => void`.
66
+ * This is implemented in Java/Kotlin, via a `(Double, Double, Double, Double, Double, Double, Double) -> Unit`.
67
+ * The callback is always coming from native.
68
+ */
69
+ @DoNotStrip
70
+ @Keep
71
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
72
+ class Func_void_double_double_double_double_double_double_double_java(private val function: (Double, Double, Double, Double, Double, Double, Double) -> Unit): Func_void_double_double_double_double_double_double_double {
73
+ @DoNotStrip
74
+ @Keep
75
+ override fun invoke(timeMs: Double, sizeBytes: Double, bitrateKbits: Double, speed: Double, videoFrameNumber: Double, fps: Double, quality: Double): Unit {
76
+ return this.function(timeMs, sizeBytes, bitrateKbits, speed, videoFrameNumber, fps, quality)
77
+ }
78
+ }
@@ -0,0 +1,78 @@
1
+ ///
2
+ /// Func_void_std__string.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.munimffmpeg
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 `(message: string) => 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__string: (String) -> 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(message: String): Unit
31
+ }
32
+
33
+ /**
34
+ * Represents the JavaScript callback `(message: string) => 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__string_cxx: Func_void_std__string {
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(message: String): Unit
59
+ = invoke_cxx(message)
60
+
61
+ private external fun invoke_cxx(message: String): Unit
62
+ }
63
+
64
+ /**
65
+ * Represents the JavaScript callback `(message: string) => void`.
66
+ * This is implemented in Java/Kotlin, via a `(String) -> Unit`.
67
+ * The callback is always coming from native.
68
+ */
69
+ @DoNotStrip
70
+ @Keep
71
+ @Suppress("ClassName", "RedundantUnitReturnType", "unused")
72
+ class Func_void_std__string_java(private val function: (String) -> Unit): Func_void_std__string {
73
+ @DoNotStrip
74
+ @Keep
75
+ override fun invoke(message: String): Unit {
76
+ return this.function(message)
77
+ }
78
+ }
@@ -0,0 +1,85 @@
1
+ ///
2
+ /// HybridMunimFfmpegSpec.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.munimffmpeg
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+ import com.margelo.nitro.core.Promise
15
+ import com.margelo.nitro.core.HybridObject
16
+
17
+ /**
18
+ * A Kotlin class representing the MunimFfmpeg HybridObject.
19
+ * Implement this abstract class to create Kotlin-based instances of MunimFfmpeg.
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress(
24
+ "KotlinJniMissingFunction", "unused",
25
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
26
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
27
+ )
28
+ abstract class HybridMunimFfmpegSpec: HybridObject() {
29
+ // Properties
30
+ @get:DoNotStrip
31
+ @get:Keep
32
+ abstract val ffmpegVersion: String
33
+
34
+ // Methods
35
+ abstract fun execute(arguments_: Array<String>, onLog: ((message: String) -> Unit)?, onStatistics: ((timeMs: Double, sizeBytes: Double, bitrateKbits: Double, speed: Double, videoFrameNumber: Double, fps: Double, quality: Double) -> Unit)?, onSessionCreated: ((sessionId: Double) -> Unit)?): Promise<FFmpegSessionResult>
36
+
37
+ @DoNotStrip
38
+ @Keep
39
+ private fun execute_cxx(arguments_: Array<String>, onLog: Func_void_std__string?, onStatistics: Func_void_double_double_double_double_double_double_double?, onSessionCreated: Func_void_double?): Promise<FFmpegSessionResult> {
40
+ val __result = execute(arguments_, onLog?.let { it }, onStatistics?.let { it }, onSessionCreated?.let { it })
41
+ return __result
42
+ }
43
+
44
+ abstract fun probe(arguments_: Array<String>, onLog: ((message: String) -> Unit)?, onSessionCreated: ((sessionId: Double) -> Unit)?): Promise<FFmpegSessionResult>
45
+
46
+ @DoNotStrip
47
+ @Keep
48
+ private fun probe_cxx(arguments_: Array<String>, onLog: Func_void_std__string?, onSessionCreated: Func_void_double?): Promise<FFmpegSessionResult> {
49
+ val __result = probe(arguments_, onLog?.let { it }, onSessionCreated?.let { it })
50
+ return __result
51
+ }
52
+
53
+ @DoNotStrip
54
+ @Keep
55
+ abstract fun getMediaInformation(path: String): Promise<String>
56
+
57
+ @DoNotStrip
58
+ @Keep
59
+ abstract fun cancel(sessionId: Double?): Unit
60
+
61
+ @DoNotStrip
62
+ @Keep
63
+ abstract fun cancelAll(): Unit
64
+
65
+ // Default implementation of `HybridObject.toString()`
66
+ override fun toString(): String {
67
+ return "[HybridObject MunimFfmpeg]"
68
+ }
69
+
70
+ // C++ backing class
71
+ @DoNotStrip
72
+ @Keep
73
+ protected open class CxxPart(javaPart: HybridMunimFfmpegSpec): HybridObject.CxxPart(javaPart) {
74
+ // C++ JHybridMunimFfmpegSpec::CxxPart::initHybrid(...)
75
+ @FastNative
76
+ external override fun initHybrid(): HybridData
77
+ }
78
+ override fun createCxxPart(): CxxPart {
79
+ return CxxPart(this)
80
+ }
81
+
82
+ companion object {
83
+ protected const val TAG = "HybridMunimFfmpegSpec"
84
+ }
85
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// NitroMunimFfmpegOnLoad.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.munimffmpeg
9
+
10
+ import android.util.Log
11
+
12
+ internal class NitroMunimFfmpegOnLoad {
13
+ companion object {
14
+ private const val TAG = "NitroMunimFfmpegOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "NitroMunimFfmpeg".
18
+ * This method is idempotent and can be called more than once.
19
+ */
20
+ @JvmStatic
21
+ fun initializeNative() {
22
+ if (didLoad) return
23
+ try {
24
+ Log.i(TAG, "Loading NitroMunimFfmpeg C++ library...")
25
+ System.loadLibrary("NitroMunimFfmpeg")
26
+ Log.i(TAG, "Successfully loaded NitroMunimFfmpeg C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load NitroMunimFfmpeg C++ library! Is it properly installed and linked? " +
30
+ "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
31
+ throw e
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,62 @@
1
+ #
2
+ # NitroMunimFfmpeg+autolinking.rb
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
+ # This is a Ruby script that adds all files generated by Nitrogen
9
+ # to the given podspec.
10
+ #
11
+ # To use it, add this to your .podspec:
12
+ # ```ruby
13
+ # Pod::Spec.new do |spec|
14
+ # # ...
15
+ #
16
+ # # Add all files generated by Nitrogen
17
+ # load 'nitrogen/generated/ios/NitroMunimFfmpeg+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 NitroMunimFfmpeg is boosted by nitro!"
24
+
25
+ spec.dependency "NitroModules"
26
+
27
+ current_source_files = Array(spec.attributes_hash['source_files'])
28
+ spec.source_files = current_source_files + [
29
+ # Generated cross-platform specs
30
+ "nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
31
+ # Generated bridges for the cross-platform specs
32
+ "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
33
+ ]
34
+
35
+ current_public_header_files = Array(spec.attributes_hash['public_header_files'])
36
+ spec.public_header_files = current_public_header_files + [
37
+ # Generated specs
38
+ "nitrogen/generated/shared/**/*.{h,hpp}",
39
+ # Swift to C++ bridging helpers
40
+ "nitrogen/generated/ios/NitroMunimFfmpeg-Swift-Cxx-Bridge.hpp"
41
+ ]
42
+
43
+ current_private_header_files = Array(spec.attributes_hash['private_header_files'])
44
+ spec.private_header_files = current_private_header_files + [
45
+ # iOS specific specs
46
+ "nitrogen/generated/ios/c++/**/*.{h,hpp}",
47
+ # Views are framework-specific and should be private
48
+ "nitrogen/generated/shared/**/views/**/*"
49
+ ]
50
+
51
+ current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
52
+ spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
53
+ # Use C++ 20
54
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
55
+ # Enables C++ <-> Swift interop (by default it's only ObjC)
56
+ "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
+ # Enables stricter modular headers
58
+ "DEFINES_MODULE" => "YES",
59
+ # Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
60
+ "SWIFT_INSTALL_OBJC_HEADER" => "NO",
61
+ })
62
+ end
@@ -0,0 +1,73 @@
1
+ ///
2
+ /// NitroMunimFfmpeg-Swift-Cxx-Bridge.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 "NitroMunimFfmpeg-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+ #include "HybridMunimFfmpegSpecSwift.hpp"
12
+ #include "NitroMunimFfmpeg-Swift-Cxx-Umbrella.hpp"
13
+ #include <NitroModules/NitroDefines.hpp>
14
+
15
+ namespace margelo::nitro::munimffmpeg::bridge::swift {
16
+
17
+ // pragma MARK: std::function<void(const FFmpegSessionResult& /* result */)>
18
+ Func_void_FFmpegSessionResult create_Func_void_FFmpegSessionResult(void* NON_NULL swiftClosureWrapper) noexcept {
19
+ auto swiftClosure = NitroMunimFfmpeg::Func_void_FFmpegSessionResult::fromUnsafe(swiftClosureWrapper);
20
+ return [swiftClosure = std::move(swiftClosure)](const FFmpegSessionResult& result) mutable -> void {
21
+ swiftClosure.call(result);
22
+ };
23
+ }
24
+
25
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
26
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
27
+ auto swiftClosure = NitroMunimFfmpeg::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
28
+ return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
29
+ swiftClosure.call(error);
30
+ };
31
+ }
32
+
33
+ // pragma MARK: std::function<void(const std::string& /* message */)>
34
+ Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
35
+ auto swiftClosure = NitroMunimFfmpeg::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
36
+ return [swiftClosure = std::move(swiftClosure)](const std::string& message) mutable -> void {
37
+ swiftClosure.call(message);
38
+ };
39
+ }
40
+
41
+ // pragma MARK: std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>
42
+ Func_void_double_double_double_double_double_double_double create_Func_void_double_double_double_double_double_double_double(void* NON_NULL swiftClosureWrapper) noexcept {
43
+ auto swiftClosure = NitroMunimFfmpeg::Func_void_double_double_double_double_double_double_double::fromUnsafe(swiftClosureWrapper);
44
+ return [swiftClosure = std::move(swiftClosure)](double timeMs, double sizeBytes, double bitrateKbits, double speed, double videoFrameNumber, double fps, double quality) mutable -> void {
45
+ swiftClosure.call(timeMs, sizeBytes, bitrateKbits, speed, videoFrameNumber, fps, quality);
46
+ };
47
+ }
48
+
49
+ // pragma MARK: std::function<void(double /* sessionId */)>
50
+ Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept {
51
+ auto swiftClosure = NitroMunimFfmpeg::Func_void_double::fromUnsafe(swiftClosureWrapper);
52
+ return [swiftClosure = std::move(swiftClosure)](double sessionId) mutable -> void {
53
+ swiftClosure.call(sessionId);
54
+ };
55
+ }
56
+
57
+ // pragma MARK: std::shared_ptr<HybridMunimFfmpegSpec>
58
+ std::shared_ptr<HybridMunimFfmpegSpec> create_std__shared_ptr_HybridMunimFfmpegSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
59
+ NitroMunimFfmpeg::HybridMunimFfmpegSpec_cxx swiftPart = NitroMunimFfmpeg::HybridMunimFfmpegSpec_cxx::fromUnsafe(swiftUnsafePointer);
60
+ return std::make_shared<margelo::nitro::munimffmpeg::HybridMunimFfmpegSpecSwift>(swiftPart);
61
+ }
62
+ void* NON_NULL get_std__shared_ptr_HybridMunimFfmpegSpec_(std__shared_ptr_HybridMunimFfmpegSpec_ cppType) {
63
+ std::shared_ptr<margelo::nitro::munimffmpeg::HybridMunimFfmpegSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::munimffmpeg::HybridMunimFfmpegSpecSwift>(cppType);
64
+ #ifdef NITRO_DEBUG
65
+ if (swiftWrapper == nullptr) [[unlikely]] {
66
+ throw std::runtime_error("Class \"HybridMunimFfmpegSpec\" is not implemented in Swift!");
67
+ }
68
+ #endif
69
+ NitroMunimFfmpeg::HybridMunimFfmpegSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
70
+ return swiftPart.toUnsafe();
71
+ }
72
+
73
+ } // namespace margelo::nitro::munimffmpeg::bridge::swift