react-native-video-trim 3.0.10 → 4.0.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 +1 -1
- package/README.md +46 -57
- package/VideoTrim.podspec +24 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +76 -51
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +4 -2
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/videotrim/VideoTrim.kt +629 -0
- package/android/src/main/java/com/margelo/nitro/videotrim/VideoTrimPackage.kt +22 -0
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/enums/ErrorCode.java +1 -1
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/interfaces/IVideoTrimmerView.java +1 -1
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/interfaces/VideoTrimListener.java +6 -5
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/utils/MediaMetadataUtil.java +1 -1
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/utils/StorageUtil.java +3 -1
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/utils/VideoTrimmerUtil.java +22 -20
- package/android/src/main/java/com/{videotrim → margelo/nitro/videotrim}/widgets/VideoTrimmerView.java +38 -66
- package/ios/AssetLoader.swift +2 -2
- package/ios/ErrorCode.swift +2 -2
- package/ios/ProgressAlertController.swift +2 -2
- package/ios/VideoTrim.swift +48 -838
- package/ios/VideoTrimImpl.swift +860 -0
- package/ios/VideoTrimmer.swift +2 -3
- package/ios/VideoTrimmerThumb.swift +33 -26
- package/ios/VideoTrimmerViewController.swift +47 -28
- package/lib/module/VideoTrim.nitro.js +4 -0
- package/lib/module/VideoTrim.nitro.js.map +1 -0
- package/lib/module/index.js +71 -22
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/{index.d.ts → src/VideoTrim.nitro.d.ts} +63 -89
- package/lib/typescript/src/VideoTrim.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +41 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JEditorConfig.hpp +229 -0
- package/nitrogen/generated/android/c++/JFileValidationResult.hpp +61 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +74 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_std__unordered_map_std__string__std__string_.hpp +89 -0
- package/nitrogen/generated/android/c++/JHybridVideoTrimSpec.cpp +131 -0
- package/nitrogen/generated/android/c++/JHybridVideoTrimSpec.hpp +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/EditorConfig.kt +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/FileValidationResult.kt +28 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/Func_void_std__string_std__unordered_map_std__string__std__string_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/HybridVideoTrimSpec.kt +82 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videotrim/videotrimOnLoad.kt +35 -0
- package/nitrogen/generated/android/videotrim+autolinking.cmake +78 -0
- package/nitrogen/generated/android/videotrim+autolinking.gradle +27 -0
- package/nitrogen/generated/android/videotrimOnLoad.cpp +50 -0
- package/nitrogen/generated/android/videotrimOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/VideoTrim+autolinking.rb +60 -0
- package/nitrogen/generated/ios/VideoTrim-Swift-Cxx-Bridge.cpp +88 -0
- package/nitrogen/generated/ios/VideoTrim-Swift-Cxx-Bridge.hpp +331 -0
- package/nitrogen/generated/ios/VideoTrim-Swift-Cxx-Umbrella.hpp +53 -0
- package/nitrogen/generated/ios/VideoTrimAutolinking.mm +33 -0
- package/nitrogen/generated/ios/VideoTrimAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridVideoTrimSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoTrimSpecSwift.hpp +116 -0
- package/nitrogen/generated/ios/swift/EditorConfig.swift +519 -0
- package/nitrogen/generated/ios/swift/FileValidationResult.swift +57 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_FileValidationResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_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_std__unordered_map_std__string__std__string_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridVideoTrimSpec.swift +53 -0
- package/nitrogen/generated/ios/swift/HybridVideoTrimSpec_cxx.swift +222 -0
- package/nitrogen/generated/shared/c++/EditorConfig.hpp +245 -0
- package/nitrogen/generated/shared/c++/FileValidationResult.hpp +77 -0
- package/nitrogen/generated/shared/c++/HybridVideoTrimSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridVideoTrimSpec.hpp +76 -0
- package/package.json +75 -71
- package/src/VideoTrim.nitro.ts +244 -0
- package/src/index.tsx +87 -258
- package/android/src/main/AndroidManifestDeprecated.xml +0 -3
- package/android/src/main/java/com/videotrim/VideoTrimModule.java +0 -603
- package/android/src/main/java/com/videotrim/VideoTrimPackage.java +0 -28
- package/ios/VideoTrim-Bridging-Header.h +0 -2
- package/ios/VideoTrim.mm +0 -17
- package/ios/VideoTrim.xcodeproj/project.pbxproj +0 -283
- package/lib/commonjs/index.js +0 -87
- package/lib/commonjs/index.js.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/react-native-video-trim.podspec +0 -43
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_double.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ value: Double) -> 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_double {
|
|
15
|
+
public typealias bridge = margelo.nitro.videotrim.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: Double) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: Double) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: Double) -> 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_double`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_double>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double {
|
|
44
|
+
return Unmanaged<Func_void_double>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ error: Error) -> 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_std__exception_ptr {
|
|
15
|
+
public typealias bridge = margelo.nitro.videotrim.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ error: Error) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(error: std.exception_ptr) -> Void {
|
|
25
|
+
self.closure(RuntimeError.from(cppError: error))
|
|
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_std__exception_ptr`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
44
|
+
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string_std__unordered_map_std__string__std__string_.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ eventName: String, _ payload: Dictionary<String, String>) -> 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_std__string_std__unordered_map_std__string__std__string_ {
|
|
15
|
+
public typealias bridge = margelo.nitro.videotrim.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ eventName: String, _ payload: Dictionary<String, String>) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ eventName: String, _ payload: Dictionary<String, String>) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(eventName: std.string, payload: bridge.std__unordered_map_std__string__std__string_) -> Void {
|
|
25
|
+
self.closure(String(eventName), { () -> Dictionary<String, String> in
|
|
26
|
+
var __dictionary = Dictionary<String, String>(minimumCapacity: payload.size())
|
|
27
|
+
let __keys = bridge.get_std__unordered_map_std__string__std__string__keys(payload)
|
|
28
|
+
for __key in __keys {
|
|
29
|
+
let __value = payload[__key]!
|
|
30
|
+
__dictionary[String(__key)] = String(__value)
|
|
31
|
+
}
|
|
32
|
+
return __dictionary
|
|
33
|
+
}())
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
38
|
+
* This acquires one additional strong reference on the object!
|
|
39
|
+
*/
|
|
40
|
+
@inline(__always)
|
|
41
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
42
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Casts an unsafe pointer to a `Func_void_std__string_std__unordered_map_std__string__std__string_`.
|
|
47
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__string_std__unordered_map_std__string__std__string_>`.
|
|
48
|
+
* This removes one strong reference from the object!
|
|
49
|
+
*/
|
|
50
|
+
@inline(__always)
|
|
51
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__string_std__unordered_map_std__string__std__string_ {
|
|
52
|
+
return Unmanaged<Func_void_std__string_std__unordered_map_std__string__std__string_>.fromOpaque(pointer).takeRetainedValue()
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__vector_std__string_.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ value: [String]) -> 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_std__vector_std__string_ {
|
|
15
|
+
public typealias bridge = margelo.nitro.videotrim.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: [String]) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: [String]) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: bridge.std__vector_std__string_) -> Void {
|
|
25
|
+
self.closure(value.map({ __item in String(__item) }))
|
|
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_std__vector_std__string_`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_std__string_>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_std__string_ {
|
|
44
|
+
return Unmanaged<Func_void_std__vector_std__string_>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridVideoTrimSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/// See ``HybridVideoTrimSpec``
|
|
12
|
+
public protocol HybridVideoTrimSpec_protocol: HybridObject {
|
|
13
|
+
// Properties
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
func showEditor(filePath: String, config: EditorConfig, onEvent: @escaping (_ eventName: String, _ payload: Dictionary<String, String>) -> Void) throws -> Void
|
|
18
|
+
func listFiles() throws -> Promise<[String]>
|
|
19
|
+
func cleanFiles() throws -> Promise<Double>
|
|
20
|
+
func deleteFile(filePath: String) throws -> Promise<Bool>
|
|
21
|
+
func closeEditor(onComplete: @escaping () -> Void) throws -> Void
|
|
22
|
+
func isValidFile(url: String) throws -> Promise<FileValidationResult>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// See ``HybridVideoTrimSpec``
|
|
26
|
+
public class HybridVideoTrimSpec_base {
|
|
27
|
+
private weak var cxxWrapper: HybridVideoTrimSpec_cxx? = nil
|
|
28
|
+
public func getCxxWrapper() -> HybridVideoTrimSpec_cxx {
|
|
29
|
+
#if DEBUG
|
|
30
|
+
guard self is HybridVideoTrimSpec else {
|
|
31
|
+
fatalError("`self` is not a `HybridVideoTrimSpec`! Did you accidentally inherit from `HybridVideoTrimSpec_base` instead of `HybridVideoTrimSpec`?")
|
|
32
|
+
}
|
|
33
|
+
#endif
|
|
34
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
35
|
+
return cxxWrapper
|
|
36
|
+
} else {
|
|
37
|
+
let cxxWrapper = HybridVideoTrimSpec_cxx(self as! HybridVideoTrimSpec)
|
|
38
|
+
self.cxxWrapper = cxxWrapper
|
|
39
|
+
return cxxWrapper
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A Swift base-protocol representing the VideoTrim HybridObject.
|
|
46
|
+
* Implement this protocol to create Swift-based instances of VideoTrim.
|
|
47
|
+
* ```swift
|
|
48
|
+
* class HybridVideoTrim : HybridVideoTrimSpec {
|
|
49
|
+
* // ...
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
public typealias HybridVideoTrimSpec = HybridVideoTrimSpec_protocol & HybridVideoTrimSpec_base
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridVideoTrimSpec_cxx.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A class implementation that bridges HybridVideoTrimSpec over to C++.
|
|
13
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
14
|
+
*
|
|
15
|
+
* Also, some Swift types need to be bridged with special handling:
|
|
16
|
+
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
17
|
+
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
18
|
+
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
19
|
+
*/
|
|
20
|
+
public class HybridVideoTrimSpec_cxx {
|
|
21
|
+
/**
|
|
22
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::videotrim::bridge::swift`)
|
|
23
|
+
* from `VideoTrim-Swift-Cxx-Bridge.hpp`.
|
|
24
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
25
|
+
*/
|
|
26
|
+
public typealias bridge = margelo.nitro.videotrim.bridge.swift
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Holds an instance of the `HybridVideoTrimSpec` Swift protocol.
|
|
30
|
+
*/
|
|
31
|
+
private var __implementation: any HybridVideoTrimSpec
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
35
|
+
*/
|
|
36
|
+
private var __cxxPart: bridge.std__weak_ptr_margelo__nitro__videotrim__HybridVideoTrimSpec_
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create a new `HybridVideoTrimSpec_cxx` that wraps the given `HybridVideoTrimSpec`.
|
|
40
|
+
* All properties and methods bridge to C++ types.
|
|
41
|
+
*/
|
|
42
|
+
public init(_ implementation: any HybridVideoTrimSpec) {
|
|
43
|
+
self.__implementation = implementation
|
|
44
|
+
self.__cxxPart = .init()
|
|
45
|
+
/* no base class */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the actual `HybridVideoTrimSpec` instance this class wraps.
|
|
50
|
+
*/
|
|
51
|
+
@inline(__always)
|
|
52
|
+
public func getHybridVideoTrimSpec() -> any HybridVideoTrimSpec {
|
|
53
|
+
return __implementation
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
58
|
+
* This acquires one additional strong reference on the object!
|
|
59
|
+
*/
|
|
60
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
61
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Casts an unsafe pointer to a `HybridVideoTrimSpec_cxx`.
|
|
66
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridVideoTrimSpec_cxx>`.
|
|
67
|
+
* This removes one strong reference from the object!
|
|
68
|
+
*/
|
|
69
|
+
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridVideoTrimSpec_cxx {
|
|
70
|
+
return Unmanaged<HybridVideoTrimSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
75
|
+
* The C++ part is a `std::shared_ptr<margelo::nitro::videotrim::HybridVideoTrimSpec>`.
|
|
76
|
+
*/
|
|
77
|
+
public func getCxxPart() -> bridge.std__shared_ptr_margelo__nitro__videotrim__HybridVideoTrimSpec_ {
|
|
78
|
+
let cachedCxxPart = self.__cxxPart.lock()
|
|
79
|
+
if cachedCxxPart.__convertToBool() {
|
|
80
|
+
return cachedCxxPart
|
|
81
|
+
} else {
|
|
82
|
+
let newCxxPart = bridge.create_std__shared_ptr_margelo__nitro__videotrim__HybridVideoTrimSpec_(self.toUnsafe())
|
|
83
|
+
__cxxPart = bridge.weakify_std__shared_ptr_margelo__nitro__videotrim__HybridVideoTrimSpec_(newCxxPart)
|
|
84
|
+
return newCxxPart
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
92
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
93
|
+
*/
|
|
94
|
+
@inline(__always)
|
|
95
|
+
public var memorySize: Int {
|
|
96
|
+
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Properties
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
// Methods
|
|
103
|
+
@inline(__always)
|
|
104
|
+
public final func showEditor(filePath: std.string, config: EditorConfig, onEvent: bridge.Func_void_std__string_std__unordered_map_std__string__std__string_) -> bridge.Result_void_ {
|
|
105
|
+
do {
|
|
106
|
+
try self.__implementation.showEditor(filePath: String(filePath), config: config, onEvent: { () -> (String, Dictionary<String, String>) -> Void in
|
|
107
|
+
let __wrappedFunction = bridge.wrap_Func_void_std__string_std__unordered_map_std__string__std__string_(onEvent)
|
|
108
|
+
return { (__eventName: String, __payload: Dictionary<String, String>) -> Void in
|
|
109
|
+
__wrappedFunction.call(std.string(__eventName), { () -> bridge.std__unordered_map_std__string__std__string_ in
|
|
110
|
+
var __map = bridge.create_std__unordered_map_std__string__std__string_(__payload.count)
|
|
111
|
+
for (__k, __v) in __payload {
|
|
112
|
+
bridge.emplace_std__unordered_map_std__string__std__string_(&__map, std.string(__k), std.string(__v))
|
|
113
|
+
}
|
|
114
|
+
return __map
|
|
115
|
+
}())
|
|
116
|
+
}
|
|
117
|
+
}())
|
|
118
|
+
return bridge.create_Result_void_()
|
|
119
|
+
} catch (let __error) {
|
|
120
|
+
let __exceptionPtr = __error.toCpp()
|
|
121
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@inline(__always)
|
|
126
|
+
public final func listFiles() -> bridge.Result_std__shared_ptr_Promise_std__vector_std__string____ {
|
|
127
|
+
do {
|
|
128
|
+
let __result = try self.__implementation.listFiles()
|
|
129
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__vector_std__string___ in
|
|
130
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__vector_std__string___()
|
|
131
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__vector_std__string___(__promise)
|
|
132
|
+
__result
|
|
133
|
+
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__vector_std__string_ in
|
|
134
|
+
var __vector = bridge.create_std__vector_std__string_(__result.count)
|
|
135
|
+
for __item in __result {
|
|
136
|
+
__vector.push_back(std.string(__item))
|
|
137
|
+
}
|
|
138
|
+
return __vector
|
|
139
|
+
}()) })
|
|
140
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
141
|
+
return __promise
|
|
142
|
+
}()
|
|
143
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__vector_std__string____(__resultCpp)
|
|
144
|
+
} catch (let __error) {
|
|
145
|
+
let __exceptionPtr = __error.toCpp()
|
|
146
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__vector_std__string____(__exceptionPtr)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@inline(__always)
|
|
151
|
+
public final func cleanFiles() -> bridge.Result_std__shared_ptr_Promise_double___ {
|
|
152
|
+
do {
|
|
153
|
+
let __result = try self.__implementation.cleanFiles()
|
|
154
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_double__ in
|
|
155
|
+
let __promise = bridge.create_std__shared_ptr_Promise_double__()
|
|
156
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_double__(__promise)
|
|
157
|
+
__result
|
|
158
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
159
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
160
|
+
return __promise
|
|
161
|
+
}()
|
|
162
|
+
return bridge.create_Result_std__shared_ptr_Promise_double___(__resultCpp)
|
|
163
|
+
} catch (let __error) {
|
|
164
|
+
let __exceptionPtr = __error.toCpp()
|
|
165
|
+
return bridge.create_Result_std__shared_ptr_Promise_double___(__exceptionPtr)
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@inline(__always)
|
|
170
|
+
public final func deleteFile(filePath: std.string) -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
171
|
+
do {
|
|
172
|
+
let __result = try self.__implementation.deleteFile(filePath: String(filePath))
|
|
173
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
|
174
|
+
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
|
175
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
|
176
|
+
__result
|
|
177
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
178
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
179
|
+
return __promise
|
|
180
|
+
}()
|
|
181
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
|
182
|
+
} catch (let __error) {
|
|
183
|
+
let __exceptionPtr = __error.toCpp()
|
|
184
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@inline(__always)
|
|
189
|
+
public final func closeEditor(onComplete: bridge.Func_void) -> bridge.Result_void_ {
|
|
190
|
+
do {
|
|
191
|
+
try self.__implementation.closeEditor(onComplete: { () -> () -> Void in
|
|
192
|
+
let __wrappedFunction = bridge.wrap_Func_void(onComplete)
|
|
193
|
+
return { () -> Void in
|
|
194
|
+
__wrappedFunction.call()
|
|
195
|
+
}
|
|
196
|
+
}())
|
|
197
|
+
return bridge.create_Result_void_()
|
|
198
|
+
} catch (let __error) {
|
|
199
|
+
let __exceptionPtr = __error.toCpp()
|
|
200
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@inline(__always)
|
|
205
|
+
public final func isValidFile(url: std.string) -> bridge.Result_std__shared_ptr_Promise_FileValidationResult___ {
|
|
206
|
+
do {
|
|
207
|
+
let __result = try self.__implementation.isValidFile(url: String(url))
|
|
208
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_FileValidationResult__ in
|
|
209
|
+
let __promise = bridge.create_std__shared_ptr_Promise_FileValidationResult__()
|
|
210
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_FileValidationResult__(__promise)
|
|
211
|
+
__result
|
|
212
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
213
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
214
|
+
return __promise
|
|
215
|
+
}()
|
|
216
|
+
return bridge.create_Result_std__shared_ptr_Promise_FileValidationResult___(__resultCpp)
|
|
217
|
+
} catch (let __error) {
|
|
218
|
+
let __exceptionPtr = __error.toCpp()
|
|
219
|
+
return bridge.create_Result_std__shared_ptr_Promise_FileValidationResult___(__exceptionPtr)
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|