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.
- package/LICENSE +178 -0
- package/NitroMunimFfmpeg.podspec +41 -0
- package/README.md +95 -0
- package/android/CMakeLists.txt +29 -0
- package/android/build.gradle +144 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +9 -0
- package/android/src/main/java/com/margelo/nitro/munimffmpeg/HybridMunimFfmpeg.kt +141 -0
- package/android/src/main/java/com/margelo/nitro/munimffmpeg/NitroMunimFfmpegPackage.kt +18 -0
- package/app.plugin.js +5 -0
- package/ios/Bridge.h +8 -0
- package/ios/HybridMunimFfmpeg.swift +161 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +21 -0
- package/lib/specs/MunimFfmpeg.nitro.d.ts +25 -0
- package/lib/specs/MunimFfmpeg.nitro.js +1 -0
- package/nitro.json +30 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroMunimFfmpeg+autolinking.cmake +81 -0
- package/nitrogen/generated/android/NitroMunimFfmpeg+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroMunimFfmpegOnLoad.cpp +60 -0
- package/nitrogen/generated/android/NitroMunimFfmpegOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JFFmpegSessionResult.hpp +86 -0
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_double_double_double_double_double_double_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridMunimFfmpegSpec.cpp +138 -0
- package/nitrogen/generated/android/c++/JHybridMunimFfmpegSpec.hpp +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/FFmpegSessionResult.kt +86 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/Func_void_double.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/Func_void_double_double_double_double_double_double_double.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/Func_void_std__string.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/HybridMunimFfmpegSpec.kt +85 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/NitroMunimFfmpegOnLoad.kt +35 -0
- package/nitrogen/generated/ios/NitroMunimFfmpeg+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroMunimFfmpeg-Swift-Cxx-Bridge.cpp +73 -0
- package/nitrogen/generated/ios/NitroMunimFfmpeg-Swift-Cxx-Bridge.hpp +298 -0
- package/nitrogen/generated/ios/NitroMunimFfmpeg-Swift-Cxx-Umbrella.hpp +51 -0
- package/nitrogen/generated/ios/NitroMunimFfmpegAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroMunimFfmpegAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridMunimFfmpegSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridMunimFfmpegSpecSwift.hpp +119 -0
- package/nitrogen/generated/ios/swift/FFmpegSessionResult.swift +77 -0
- package/nitrogen/generated/ios/swift/Func_void_FFmpegSessionResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double_double_double_double_double_double_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridMunimFfmpegSpec.swift +59 -0
- package/nitrogen/generated/ios/swift/HybridMunimFfmpegSpec_cxx.swift +277 -0
- package/nitrogen/generated/shared/c++/FFmpegSessionResult.hpp +112 -0
- package/nitrogen/generated/shared/c++/HybridMunimFfmpegSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridMunimFfmpegSpec.hpp +72 -0
- package/package.json +131 -0
- package/react-native.config.js +16 -0
- package/scripts/patch-ffmpegkit-level.rb +45 -0
- package/src/index.ts +56 -0
- package/src/specs/MunimFfmpeg.nitro.ts +52 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFFmpegSessionResult.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 <fbjni/fbjni.h>
|
|
11
|
+
#include "FFmpegSessionResult.hpp"
|
|
12
|
+
|
|
13
|
+
#include <optional>
|
|
14
|
+
#include <string>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::munimffmpeg {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The C++ JNI bridge between the C++ struct "FFmpegSessionResult" and the Kotlin data class "FFmpegSessionResult".
|
|
22
|
+
*/
|
|
23
|
+
struct JFFmpegSessionResult final: public jni::JavaClass<JFFmpegSessionResult> {
|
|
24
|
+
public:
|
|
25
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/munimffmpeg/FFmpegSessionResult;";
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* Convert this Java/Kotlin-based struct to the C++ struct FFmpegSessionResult by copying all values to C++.
|
|
30
|
+
*/
|
|
31
|
+
[[maybe_unused]]
|
|
32
|
+
[[nodiscard]]
|
|
33
|
+
FFmpegSessionResult toCpp() const {
|
|
34
|
+
static const auto clazz = javaClassStatic();
|
|
35
|
+
static const auto fieldSessionId = clazz->getField<double>("sessionId");
|
|
36
|
+
double sessionId = this->getFieldValue(fieldSessionId);
|
|
37
|
+
static const auto fieldReturnCode = clazz->getField<double>("returnCode");
|
|
38
|
+
double returnCode = this->getFieldValue(fieldReturnCode);
|
|
39
|
+
static const auto fieldSuccess = clazz->getField<jboolean>("success");
|
|
40
|
+
jboolean success = this->getFieldValue(fieldSuccess);
|
|
41
|
+
static const auto fieldCancelled = clazz->getField<jboolean>("cancelled");
|
|
42
|
+
jboolean cancelled = this->getFieldValue(fieldCancelled);
|
|
43
|
+
static const auto fieldState = clazz->getField<jni::JString>("state");
|
|
44
|
+
jni::local_ref<jni::JString> state = this->getFieldValue(fieldState);
|
|
45
|
+
static const auto fieldDurationMs = clazz->getField<double>("durationMs");
|
|
46
|
+
double durationMs = this->getFieldValue(fieldDurationMs);
|
|
47
|
+
static const auto fieldOutput = clazz->getField<jni::JString>("output");
|
|
48
|
+
jni::local_ref<jni::JString> output = this->getFieldValue(fieldOutput);
|
|
49
|
+
static const auto fieldFailStackTrace = clazz->getField<jni::JString>("failStackTrace");
|
|
50
|
+
jni::local_ref<jni::JString> failStackTrace = this->getFieldValue(fieldFailStackTrace);
|
|
51
|
+
return FFmpegSessionResult(
|
|
52
|
+
sessionId,
|
|
53
|
+
returnCode,
|
|
54
|
+
static_cast<bool>(success),
|
|
55
|
+
static_cast<bool>(cancelled),
|
|
56
|
+
state->toStdString(),
|
|
57
|
+
durationMs,
|
|
58
|
+
output->toStdString(),
|
|
59
|
+
failStackTrace != nullptr ? std::make_optional(failStackTrace->toStdString()) : std::nullopt
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
/**
|
|
65
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
66
|
+
*/
|
|
67
|
+
[[maybe_unused]]
|
|
68
|
+
static jni::local_ref<JFFmpegSessionResult::javaobject> fromCpp(const FFmpegSessionResult& value) {
|
|
69
|
+
using JSignature = JFFmpegSessionResult(double, double, jboolean, jboolean, jni::alias_ref<jni::JString>, double, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
|
|
70
|
+
static const auto clazz = javaClassStatic();
|
|
71
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
72
|
+
return create(
|
|
73
|
+
clazz,
|
|
74
|
+
value.sessionId,
|
|
75
|
+
value.returnCode,
|
|
76
|
+
value.success,
|
|
77
|
+
value.cancelled,
|
|
78
|
+
jni::make_jstring(value.state),
|
|
79
|
+
value.durationMs,
|
|
80
|
+
jni::make_jstring(value.output),
|
|
81
|
+
value.failStackTrace.has_value() ? jni::make_jstring(value.failStackTrace.value()) : nullptr
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
} // namespace margelo::nitro::munimffmpeg
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_double.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 <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <functional>
|
|
14
|
+
#include <NitroModules/JNICallable.hpp>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::munimffmpeg {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents the Java/Kotlin callback `(sessionId: Double) -> Unit`.
|
|
22
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
23
|
+
*/
|
|
24
|
+
struct JFunc_void_double: public jni::JavaClass<JFunc_void_double> {
|
|
25
|
+
public:
|
|
26
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/munimffmpeg/Func_void_double;";
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/**
|
|
30
|
+
* Invokes the function this `JFunc_void_double` instance holds through JNI.
|
|
31
|
+
*/
|
|
32
|
+
void invoke(double sessionId) const {
|
|
33
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* sessionId */)>("invoke");
|
|
34
|
+
method(self(), sessionId);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An implementation of Func_void_double that is backed by a C++ implementation (using `std::function<...>`)
|
|
40
|
+
*/
|
|
41
|
+
class JFunc_void_double_cxx final: public jni::HybridClass<JFunc_void_double_cxx, JFunc_void_double> {
|
|
42
|
+
public:
|
|
43
|
+
static jni::local_ref<JFunc_void_double::javaobject> fromCpp(const std::function<void(double /* sessionId */)>& func) {
|
|
44
|
+
return JFunc_void_double_cxx::newObjectCxxArgs(func);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_double_cxx` instance holds.
|
|
50
|
+
*/
|
|
51
|
+
void invoke_cxx(double sessionId) {
|
|
52
|
+
_func(sessionId);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
[[nodiscard]]
|
|
57
|
+
inline const std::function<void(double /* sessionId */)>& getFunction() const {
|
|
58
|
+
return _func;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/munimffmpeg/Func_void_double_cxx;";
|
|
63
|
+
static void registerNatives() {
|
|
64
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_double_cxx::invoke_cxx)});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private:
|
|
68
|
+
explicit JFunc_void_double_cxx(const std::function<void(double /* sessionId */)>& func): _func(func) { }
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
friend HybridBase;
|
|
72
|
+
std::function<void(double /* sessionId */)> _func;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::munimffmpeg
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_double_double_double_double_double_double_double.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 <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <functional>
|
|
14
|
+
#include <NitroModules/JNICallable.hpp>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::munimffmpeg {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents the Java/Kotlin callback `(timeMs: Double, sizeBytes: Double, bitrateKbits: Double, speed: Double, videoFrameNumber: Double, fps: Double, quality: Double) -> Unit`.
|
|
22
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
23
|
+
*/
|
|
24
|
+
struct JFunc_void_double_double_double_double_double_double_double: public jni::JavaClass<JFunc_void_double_double_double_double_double_double_double> {
|
|
25
|
+
public:
|
|
26
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/munimffmpeg/Func_void_double_double_double_double_double_double_double;";
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/**
|
|
30
|
+
* Invokes the function this `JFunc_void_double_double_double_double_double_double_double` instance holds through JNI.
|
|
31
|
+
*/
|
|
32
|
+
void invoke(double timeMs, double sizeBytes, double bitrateKbits, double speed, double videoFrameNumber, double fps, double quality) const {
|
|
33
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>("invoke");
|
|
34
|
+
method(self(), timeMs, sizeBytes, bitrateKbits, speed, videoFrameNumber, fps, quality);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An implementation of Func_void_double_double_double_double_double_double_double that is backed by a C++ implementation (using `std::function<...>`)
|
|
40
|
+
*/
|
|
41
|
+
class JFunc_void_double_double_double_double_double_double_double_cxx final: public jni::HybridClass<JFunc_void_double_double_double_double_double_double_double_cxx, JFunc_void_double_double_double_double_double_double_double> {
|
|
42
|
+
public:
|
|
43
|
+
static jni::local_ref<JFunc_void_double_double_double_double_double_double_double::javaobject> fromCpp(const std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>& func) {
|
|
44
|
+
return JFunc_void_double_double_double_double_double_double_double_cxx::newObjectCxxArgs(func);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_double_double_double_double_double_double_double_cxx` instance holds.
|
|
50
|
+
*/
|
|
51
|
+
void invoke_cxx(double timeMs, double sizeBytes, double bitrateKbits, double speed, double videoFrameNumber, double fps, double quality) {
|
|
52
|
+
_func(timeMs, sizeBytes, bitrateKbits, speed, videoFrameNumber, fps, quality);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
[[nodiscard]]
|
|
57
|
+
inline const std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>& getFunction() const {
|
|
58
|
+
return _func;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/munimffmpeg/Func_void_double_double_double_double_double_double_double_cxx;";
|
|
63
|
+
static void registerNatives() {
|
|
64
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_double_double_double_double_double_double_double_cxx::invoke_cxx)});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private:
|
|
68
|
+
explicit JFunc_void_double_double_double_double_double_double_double_cxx(const std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)>& func): _func(func) { }
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
friend HybridBase;
|
|
72
|
+
std::function<void(double /* timeMs */, double /* sizeBytes */, double /* bitrateKbits */, double /* speed */, double /* videoFrameNumber */, double /* fps */, double /* quality */)> _func;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::munimffmpeg
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_std__string.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 <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::munimffmpeg {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents the Java/Kotlin callback `(message: String) -> Unit`.
|
|
23
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
24
|
+
*/
|
|
25
|
+
struct JFunc_void_std__string: public jni::JavaClass<JFunc_void_std__string> {
|
|
26
|
+
public:
|
|
27
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/munimffmpeg/Func_void_std__string;";
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
/**
|
|
31
|
+
* Invokes the function this `JFunc_void_std__string` instance holds through JNI.
|
|
32
|
+
*/
|
|
33
|
+
void invoke(const std::string& message) const {
|
|
34
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* message */)>("invoke");
|
|
35
|
+
method(self(), jni::make_jstring(message));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* An implementation of Func_void_std__string that is backed by a C++ implementation (using `std::function<...>`)
|
|
41
|
+
*/
|
|
42
|
+
class JFunc_void_std__string_cxx final: public jni::HybridClass<JFunc_void_std__string_cxx, JFunc_void_std__string> {
|
|
43
|
+
public:
|
|
44
|
+
static jni::local_ref<JFunc_void_std__string::javaobject> fromCpp(const std::function<void(const std::string& /* message */)>& func) {
|
|
45
|
+
return JFunc_void_std__string_cxx::newObjectCxxArgs(func);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
/**
|
|
50
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_std__string_cxx` instance holds.
|
|
51
|
+
*/
|
|
52
|
+
void invoke_cxx(jni::alias_ref<jni::JString> message) {
|
|
53
|
+
_func(message->toStdString());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
[[nodiscard]]
|
|
58
|
+
inline const std::function<void(const std::string& /* message */)>& getFunction() const {
|
|
59
|
+
return _func;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/munimffmpeg/Func_void_std__string_cxx;";
|
|
64
|
+
static void registerNatives() {
|
|
65
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_cxx::invoke_cxx)});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
explicit JFunc_void_std__string_cxx(const std::function<void(const std::string& /* message */)>& func): _func(func) { }
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
friend HybridBase;
|
|
73
|
+
std::function<void(const std::string& /* message */)> _func;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro::munimffmpeg
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridMunimFfmpegSpec.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 "JHybridMunimFfmpegSpec.hpp"
|
|
9
|
+
|
|
10
|
+
// Forward declaration of `FFmpegSessionResult` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::munimffmpeg { struct FFmpegSessionResult; }
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include "FFmpegSessionResult.hpp"
|
|
15
|
+
#include <NitroModules/Promise.hpp>
|
|
16
|
+
#include <NitroModules/JPromise.hpp>
|
|
17
|
+
#include "JFFmpegSessionResult.hpp"
|
|
18
|
+
#include <optional>
|
|
19
|
+
#include <vector>
|
|
20
|
+
#include <functional>
|
|
21
|
+
#include "JFunc_void_std__string.hpp"
|
|
22
|
+
#include <NitroModules/JNICallable.hpp>
|
|
23
|
+
#include "JFunc_void_double_double_double_double_double_double_double.hpp"
|
|
24
|
+
#include "JFunc_void_double.hpp"
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::munimffmpeg {
|
|
27
|
+
|
|
28
|
+
std::shared_ptr<JHybridMunimFfmpegSpec> JHybridMunimFfmpegSpec::JavaPart::getJHybridMunimFfmpegSpec() {
|
|
29
|
+
auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
|
|
30
|
+
auto castHybridObject = std::dynamic_pointer_cast<JHybridMunimFfmpegSpec>(hybridObject);
|
|
31
|
+
if (castHybridObject == nullptr) [[unlikely]] {
|
|
32
|
+
throw std::runtime_error("Failed to downcast JHybridObject to JHybridMunimFfmpegSpec!");
|
|
33
|
+
}
|
|
34
|
+
return castHybridObject;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
jni::local_ref<JHybridMunimFfmpegSpec::CxxPart::jhybriddata> JHybridMunimFfmpegSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
38
|
+
return makeCxxInstance(jThis);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
std::shared_ptr<JHybridObject> JHybridMunimFfmpegSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
|
|
42
|
+
auto castJavaPart = jni::dynamic_ref_cast<JHybridMunimFfmpegSpec::JavaPart>(javaPart);
|
|
43
|
+
if (castJavaPart == nullptr) [[unlikely]] {
|
|
44
|
+
throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridMunimFfmpegSpec::JavaPart!");
|
|
45
|
+
}
|
|
46
|
+
return std::make_shared<JHybridMunimFfmpegSpec>(castJavaPart);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
void JHybridMunimFfmpegSpec::CxxPart::registerNatives() {
|
|
50
|
+
registerHybrid({
|
|
51
|
+
makeNativeMethod("initHybrid", JHybridMunimFfmpegSpec::CxxPart::initHybrid),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Properties
|
|
56
|
+
std::string JHybridMunimFfmpegSpec::getFfmpegVersion() {
|
|
57
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getFfmpegVersion");
|
|
58
|
+
auto __result = method(_javaPart);
|
|
59
|
+
return __result->toStdString();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Methods
|
|
63
|
+
std::shared_ptr<Promise<FFmpegSessionResult>> JHybridMunimFfmpegSpec::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) {
|
|
64
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JArrayClass<jni::JString>> /* arguments_ */, jni::alias_ref<JFunc_void_std__string::javaobject> /* onLog */, jni::alias_ref<JFunc_void_double_double_double_double_double_double_double::javaobject> /* onStatistics */, jni::alias_ref<JFunc_void_double::javaobject> /* onSessionCreated */)>("execute_cxx");
|
|
65
|
+
auto __result = method(_javaPart, [&](auto&& __input) {
|
|
66
|
+
size_t __size = __input.size();
|
|
67
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
68
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
69
|
+
const auto& __element = __input[__i];
|
|
70
|
+
auto __elementJni = jni::make_jstring(__element);
|
|
71
|
+
__array->setElement(__i, *__elementJni);
|
|
72
|
+
}
|
|
73
|
+
return __array;
|
|
74
|
+
}(arguments_), onLog.has_value() ? JFunc_void_std__string_cxx::fromCpp(onLog.value()) : nullptr, onStatistics.has_value() ? JFunc_void_double_double_double_double_double_double_double_cxx::fromCpp(onStatistics.value()) : nullptr, onSessionCreated.has_value() ? JFunc_void_double_cxx::fromCpp(onSessionCreated.value()) : nullptr);
|
|
75
|
+
return [&]() {
|
|
76
|
+
auto __promise = Promise<FFmpegSessionResult>::create();
|
|
77
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
78
|
+
auto __result = jni::static_ref_cast<JFFmpegSessionResult>(__boxedResult);
|
|
79
|
+
__promise->resolve(__result->toCpp());
|
|
80
|
+
});
|
|
81
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
82
|
+
jni::JniException __jniError(__throwable);
|
|
83
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
84
|
+
});
|
|
85
|
+
return __promise;
|
|
86
|
+
}();
|
|
87
|
+
}
|
|
88
|
+
std::shared_ptr<Promise<FFmpegSessionResult>> JHybridMunimFfmpegSpec::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) {
|
|
89
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JArrayClass<jni::JString>> /* arguments_ */, jni::alias_ref<JFunc_void_std__string::javaobject> /* onLog */, jni::alias_ref<JFunc_void_double::javaobject> /* onSessionCreated */)>("probe_cxx");
|
|
90
|
+
auto __result = method(_javaPart, [&](auto&& __input) {
|
|
91
|
+
size_t __size = __input.size();
|
|
92
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
93
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
94
|
+
const auto& __element = __input[__i];
|
|
95
|
+
auto __elementJni = jni::make_jstring(__element);
|
|
96
|
+
__array->setElement(__i, *__elementJni);
|
|
97
|
+
}
|
|
98
|
+
return __array;
|
|
99
|
+
}(arguments_), onLog.has_value() ? JFunc_void_std__string_cxx::fromCpp(onLog.value()) : nullptr, onSessionCreated.has_value() ? JFunc_void_double_cxx::fromCpp(onSessionCreated.value()) : nullptr);
|
|
100
|
+
return [&]() {
|
|
101
|
+
auto __promise = Promise<FFmpegSessionResult>::create();
|
|
102
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
103
|
+
auto __result = jni::static_ref_cast<JFFmpegSessionResult>(__boxedResult);
|
|
104
|
+
__promise->resolve(__result->toCpp());
|
|
105
|
+
});
|
|
106
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
107
|
+
jni::JniException __jniError(__throwable);
|
|
108
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
109
|
+
});
|
|
110
|
+
return __promise;
|
|
111
|
+
}();
|
|
112
|
+
}
|
|
113
|
+
std::shared_ptr<Promise<std::string>> JHybridMunimFfmpegSpec::getMediaInformation(const std::string& path) {
|
|
114
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* path */)>("getMediaInformation");
|
|
115
|
+
auto __result = method(_javaPart, jni::make_jstring(path));
|
|
116
|
+
return [&]() {
|
|
117
|
+
auto __promise = Promise<std::string>::create();
|
|
118
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
119
|
+
auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
|
|
120
|
+
__promise->resolve(__result->toStdString());
|
|
121
|
+
});
|
|
122
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
123
|
+
jni::JniException __jniError(__throwable);
|
|
124
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
125
|
+
});
|
|
126
|
+
return __promise;
|
|
127
|
+
}();
|
|
128
|
+
}
|
|
129
|
+
void JHybridMunimFfmpegSpec::cancel(std::optional<double> sessionId) {
|
|
130
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* sessionId */)>("cancel");
|
|
131
|
+
method(_javaPart, sessionId.has_value() ? jni::JDouble::valueOf(sessionId.value()) : nullptr);
|
|
132
|
+
}
|
|
133
|
+
void JHybridMunimFfmpegSpec::cancelAll() {
|
|
134
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("cancelAll");
|
|
135
|
+
method(_javaPart);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
} // namespace margelo::nitro::munimffmpeg
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridMunimFfmpegSpec.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 <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridMunimFfmpegSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::munimffmpeg {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridMunimFfmpegSpec: public virtual HybridMunimFfmpegSpec, public virtual JHybridObject {
|
|
22
|
+
public:
|
|
23
|
+
struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/munimffmpeg/HybridMunimFfmpegSpec;";
|
|
25
|
+
std::shared_ptr<JHybridMunimFfmpegSpec> getJHybridMunimFfmpegSpec();
|
|
26
|
+
};
|
|
27
|
+
struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
|
|
28
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/munimffmpeg/HybridMunimFfmpegSpec$CxxPart;";
|
|
29
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
30
|
+
static void registerNatives();
|
|
31
|
+
using HybridBase::HybridBase;
|
|
32
|
+
protected:
|
|
33
|
+
std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
explicit JHybridMunimFfmpegSpec(const jni::local_ref<JHybridMunimFfmpegSpec::JavaPart>& javaPart):
|
|
38
|
+
HybridObject(HybridMunimFfmpegSpec::TAG),
|
|
39
|
+
JHybridObject(javaPart),
|
|
40
|
+
_javaPart(jni::make_global(javaPart)) {}
|
|
41
|
+
~JHybridMunimFfmpegSpec() override {
|
|
42
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
43
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline const jni::global_ref<JHybridMunimFfmpegSpec::JavaPart>& getJavaPart() const noexcept {
|
|
48
|
+
return _javaPart;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Properties
|
|
53
|
+
std::string getFfmpegVersion() override;
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
// Methods
|
|
57
|
+
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;
|
|
58
|
+
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;
|
|
59
|
+
std::shared_ptr<Promise<std::string>> getMediaInformation(const std::string& path) override;
|
|
60
|
+
void cancel(std::optional<double> sessionId) override;
|
|
61
|
+
void cancelAll() override;
|
|
62
|
+
|
|
63
|
+
private:
|
|
64
|
+
jni::global_ref<JHybridMunimFfmpegSpec::JavaPart> _javaPart;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace margelo::nitro::munimffmpeg
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimffmpeg/FFmpegSessionResult.kt
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// FFmpegSessionResult.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.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "FFmpegSessionResult".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class FFmpegSessionResult(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val sessionId: Double,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val returnCode: Double,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val success: Boolean,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val cancelled: Boolean,
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@Keep
|
|
35
|
+
val state: String,
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
@Keep
|
|
38
|
+
val durationMs: Double,
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
val output: String,
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
@Keep
|
|
44
|
+
val failStackTrace: String?
|
|
45
|
+
) {
|
|
46
|
+
/* primary constructor */
|
|
47
|
+
|
|
48
|
+
override fun equals(other: Any?): Boolean {
|
|
49
|
+
if (this === other) return true
|
|
50
|
+
if (other !is FFmpegSessionResult) return false
|
|
51
|
+
return Objects.deepEquals(this.sessionId, other.sessionId)
|
|
52
|
+
&& Objects.deepEquals(this.returnCode, other.returnCode)
|
|
53
|
+
&& Objects.deepEquals(this.success, other.success)
|
|
54
|
+
&& Objects.deepEquals(this.cancelled, other.cancelled)
|
|
55
|
+
&& Objects.deepEquals(this.state, other.state)
|
|
56
|
+
&& Objects.deepEquals(this.durationMs, other.durationMs)
|
|
57
|
+
&& Objects.deepEquals(this.output, other.output)
|
|
58
|
+
&& Objects.deepEquals(this.failStackTrace, other.failStackTrace)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override fun hashCode(): Int {
|
|
62
|
+
return arrayOf<Any?>(
|
|
63
|
+
sessionId,
|
|
64
|
+
returnCode,
|
|
65
|
+
success,
|
|
66
|
+
cancelled,
|
|
67
|
+
state,
|
|
68
|
+
durationMs,
|
|
69
|
+
output,
|
|
70
|
+
failStackTrace
|
|
71
|
+
).contentDeepHashCode()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
companion object {
|
|
75
|
+
/**
|
|
76
|
+
* Constructor called from C++
|
|
77
|
+
*/
|
|
78
|
+
@DoNotStrip
|
|
79
|
+
@Keep
|
|
80
|
+
@Suppress("unused")
|
|
81
|
+
@JvmStatic
|
|
82
|
+
private fun fromCpp(sessionId: Double, returnCode: Double, success: Boolean, cancelled: Boolean, state: String, durationMs: Double, output: String, failStackTrace: String?): FFmpegSessionResult {
|
|
83
|
+
return FFmpegSessionResult(sessionId, returnCode, success, cancelled, state, durationMs, output, failStackTrace)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|