@react-native-video/drm 7.0.0-alpha.9
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 +20 -0
- package/README.md +95 -0
- package/ReactNativeVideoDrm.podspec +31 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +135 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/twg/videodrm/DRMManager/DRMManager.kt +107 -0
- package/android/src/main/java/com/twg/videodrm/DRMPlugin.kt +12 -0
- package/android/src/main/java/com/twg/videodrm/PluginManager.kt +53 -0
- package/android/src/main/java/com/twg/videodrm/VideoDrmPackage.kt +22 -0
- package/ios/DRMManager/DRMManager+AVContentKeySessionDelegate.swift +63 -0
- package/ios/DRMManager/DRMManager.swift +229 -0
- package/ios/DRMPlugin.swift +21 -0
- package/ios/PluginManager.swift +72 -0
- package/lib/module/PluginManager.nitro.js +4 -0
- package/lib/module/PluginManager.nitro.js.map +1 -0
- package/lib/module/index.js +12 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/PluginManager.nitro.d.ts +10 -0
- package/lib/typescript/src/PluginManager.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/ReactNativeVideoDrm+autolinking.cmake +81 -0
- package/nitrogen/generated/android/ReactNativeVideoDrm+autolinking.gradle +27 -0
- package/nitrogen/generated/android/ReactNativeVideoDrmOnLoad.cpp +44 -0
- package/nitrogen/generated/android/ReactNativeVideoDrmOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JHybridPluginManagerSpec.cpp +53 -0
- package/nitrogen/generated/android/c++/JHybridPluginManagerSpec.hpp +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videodrm/HybridPluginManagerSpec.kt +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/videodrm/ReactNativeVideoDrmOnLoad.kt +35 -0
- package/nitrogen/generated/ios/ReactNativeVideoDrm+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ReactNativeVideoDrm-Swift-Cxx-Bridge.cpp +32 -0
- package/nitrogen/generated/ios/ReactNativeVideoDrm-Swift-Cxx-Bridge.hpp +51 -0
- package/nitrogen/generated/ios/ReactNativeVideoDrm-Swift-Cxx-Umbrella.hpp +43 -0
- package/nitrogen/generated/ios/ReactNativeVideoDrmAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeVideoDrmAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridPluginManagerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridPluginManagerSpecSwift.hpp +79 -0
- package/nitrogen/generated/ios/swift/HybridPluginManagerSpec.swift +50 -0
- package/nitrogen/generated/ios/swift/HybridPluginManagerSpec_cxx.swift +138 -0
- package/nitrogen/generated/shared/c++/HybridPluginManagerSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridPluginManagerSpec.hpp +63 -0
- package/package.json +135 -0
- package/src/PluginManager.nitro.ts +8 -0
- package/src/index.tsx +15 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPluginManagerSpec.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridPluginManagerSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::videodrm {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridPluginManagerSpec: public jni::HybridClass<JHybridPluginManagerSpec, JHybridObject>,
|
|
22
|
+
public virtual HybridPluginManagerSpec {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/videodrm/HybridPluginManagerSpec;";
|
|
25
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
+
static void registerNatives();
|
|
27
|
+
|
|
28
|
+
protected:
|
|
29
|
+
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
+
explicit JHybridPluginManagerSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
+
HybridObject(HybridPluginManagerSpec::TAG),
|
|
32
|
+
HybridBase(jThis),
|
|
33
|
+
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
~JHybridPluginManagerSpec() override {
|
|
37
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
size_t getExternalMemorySize() noexcept override;
|
|
43
|
+
void dispose() noexcept override;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
inline const jni::global_ref<JHybridPluginManagerSpec::javaobject>& getJavaPart() const noexcept {
|
|
47
|
+
return _javaPart;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
// Properties
|
|
52
|
+
bool getIsEnabled() override;
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
// Methods
|
|
56
|
+
void enable() override;
|
|
57
|
+
void disable() override;
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
friend HybridBase;
|
|
61
|
+
using HybridBase::HybridBase;
|
|
62
|
+
jni::global_ref<JHybridPluginManagerSpec::javaobject> _javaPart;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
} // namespace margelo::nitro::videodrm
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/videodrm/HybridPluginManagerSpec.kt
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPluginManagerSpec.kt
|
|
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
|
+
package com.margelo.nitro.videodrm
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.*
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A Kotlin class representing the PluginManager HybridObject.
|
|
17
|
+
* Implement this abstract class to create Kotlin-based instances of PluginManager.
|
|
18
|
+
*/
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
@Keep
|
|
21
|
+
@Suppress(
|
|
22
|
+
"KotlinJniMissingFunction", "unused",
|
|
23
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
24
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
|
+
)
|
|
26
|
+
abstract class HybridPluginManagerSpec: HybridObject() {
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
private var mHybridData: HybridData = initHybrid()
|
|
29
|
+
|
|
30
|
+
init {
|
|
31
|
+
super.updateNative(mHybridData)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun updateNative(hybridData: HybridData) {
|
|
35
|
+
mHybridData = hybridData
|
|
36
|
+
super.updateNative(hybridData)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Properties
|
|
40
|
+
@get:DoNotStrip
|
|
41
|
+
@get:Keep
|
|
42
|
+
abstract val isEnabled: Boolean
|
|
43
|
+
|
|
44
|
+
// Methods
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
@Keep
|
|
47
|
+
abstract fun enable(): Unit
|
|
48
|
+
|
|
49
|
+
@DoNotStrip
|
|
50
|
+
@Keep
|
|
51
|
+
abstract fun disable(): Unit
|
|
52
|
+
|
|
53
|
+
private external fun initHybrid(): HybridData
|
|
54
|
+
|
|
55
|
+
companion object {
|
|
56
|
+
private const val TAG = "HybridPluginManagerSpec"
|
|
57
|
+
}
|
|
58
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/videodrm/ReactNativeVideoDrmOnLoad.kt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeVideoDrmOnLoad.kt
|
|
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
|
+
package com.margelo.nitro.videodrm
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class ReactNativeVideoDrmOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "ReactNativeVideoDrmOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "ReactNativeVideoDrm".
|
|
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 ReactNativeVideoDrm C++ library...")
|
|
25
|
+
System.loadLibrary("ReactNativeVideoDrm")
|
|
26
|
+
Log.i(TAG, "Successfully loaded ReactNativeVideoDrm C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load ReactNativeVideoDrm 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,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# ReactNativeVideoDrm+autolinking.rb
|
|
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
|
+
# 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/ReactNativeVideoDrm+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 ReactNativeVideoDrm 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/ReactNativeVideoDrm-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 C)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
})
|
|
60
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeVideoDrm-Swift-Cxx-Bridge.cpp
|
|
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
|
+
#include "ReactNativeVideoDrm-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridPluginManagerSpecSwift.hpp"
|
|
12
|
+
#include "ReactNativeVideoDrm-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
|
|
14
|
+
namespace margelo::nitro::videodrm::bridge::swift {
|
|
15
|
+
|
|
16
|
+
// pragma MARK: std::shared_ptr<HybridPluginManagerSpec>
|
|
17
|
+
std::shared_ptr<HybridPluginManagerSpec> create_std__shared_ptr_HybridPluginManagerSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
18
|
+
ReactNativeVideoDrm::HybridPluginManagerSpec_cxx swiftPart = ReactNativeVideoDrm::HybridPluginManagerSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
19
|
+
return std::make_shared<margelo::nitro::videodrm::HybridPluginManagerSpecSwift>(swiftPart);
|
|
20
|
+
}
|
|
21
|
+
void* NON_NULL get_std__shared_ptr_HybridPluginManagerSpec_(std__shared_ptr_HybridPluginManagerSpec_ cppType) noexcept {
|
|
22
|
+
std::shared_ptr<margelo::nitro::videodrm::HybridPluginManagerSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::videodrm::HybridPluginManagerSpecSwift>(cppType);
|
|
23
|
+
#ifdef NITRO_DEBUG
|
|
24
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
25
|
+
throw std::runtime_error("Class \"HybridPluginManagerSpec\" is not implemented in Swift!");
|
|
26
|
+
}
|
|
27
|
+
#endif
|
|
28
|
+
ReactNativeVideoDrm::HybridPluginManagerSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
29
|
+
return swiftPart.toUnsafe();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
} // namespace margelo::nitro::videodrm::bridge::swift
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeVideoDrm-Swift-Cxx-Bridge.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridPluginManagerSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::videodrm { class HybridPluginManagerSpec; }
|
|
13
|
+
|
|
14
|
+
// Forward declarations of Swift defined types
|
|
15
|
+
// Forward declaration of `HybridPluginManagerSpec_cxx` to properly resolve imports.
|
|
16
|
+
namespace ReactNativeVideoDrm { class HybridPluginManagerSpec_cxx; }
|
|
17
|
+
|
|
18
|
+
// Include C++ defined types
|
|
19
|
+
#include "HybridPluginManagerSpec.hpp"
|
|
20
|
+
#include <NitroModules/Result.hpp>
|
|
21
|
+
#include <exception>
|
|
22
|
+
#include <memory>
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
26
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
27
|
+
*/
|
|
28
|
+
namespace margelo::nitro::videodrm::bridge::swift {
|
|
29
|
+
|
|
30
|
+
// pragma MARK: std::shared_ptr<HybridPluginManagerSpec>
|
|
31
|
+
/**
|
|
32
|
+
* Specialized version of `std::shared_ptr<HybridPluginManagerSpec>`.
|
|
33
|
+
*/
|
|
34
|
+
using std__shared_ptr_HybridPluginManagerSpec_ = std::shared_ptr<HybridPluginManagerSpec>;
|
|
35
|
+
std::shared_ptr<HybridPluginManagerSpec> create_std__shared_ptr_HybridPluginManagerSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
36
|
+
void* NON_NULL get_std__shared_ptr_HybridPluginManagerSpec_(std__shared_ptr_HybridPluginManagerSpec_ cppType) noexcept;
|
|
37
|
+
|
|
38
|
+
// pragma MARK: std::weak_ptr<HybridPluginManagerSpec>
|
|
39
|
+
using std__weak_ptr_HybridPluginManagerSpec_ = std::weak_ptr<HybridPluginManagerSpec>;
|
|
40
|
+
inline std__weak_ptr_HybridPluginManagerSpec_ weakify_std__shared_ptr_HybridPluginManagerSpec_(const std::shared_ptr<HybridPluginManagerSpec>& strong) noexcept { return strong; }
|
|
41
|
+
|
|
42
|
+
// pragma MARK: Result<void>
|
|
43
|
+
using Result_void_ = Result<void>;
|
|
44
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
45
|
+
return Result<void>::withValue();
|
|
46
|
+
}
|
|
47
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
48
|
+
return Result<void>::withError(error);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
} // namespace margelo::nitro::videodrm::bridge::swift
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeVideoDrm-Swift-Cxx-Umbrella.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridPluginManagerSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::videodrm { class HybridPluginManagerSpec; }
|
|
13
|
+
|
|
14
|
+
// Include C++ defined types
|
|
15
|
+
#include "HybridPluginManagerSpec.hpp"
|
|
16
|
+
#include <NitroModules/Result.hpp>
|
|
17
|
+
#include <exception>
|
|
18
|
+
#include <memory>
|
|
19
|
+
|
|
20
|
+
// C++ helpers for Swift
|
|
21
|
+
#include "ReactNativeVideoDrm-Swift-Cxx-Bridge.hpp"
|
|
22
|
+
|
|
23
|
+
// Common C++ types used in Swift
|
|
24
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
25
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
26
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
27
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
28
|
+
|
|
29
|
+
// Forward declarations of Swift defined types
|
|
30
|
+
// Forward declaration of `HybridPluginManagerSpec_cxx` to properly resolve imports.
|
|
31
|
+
namespace ReactNativeVideoDrm { class HybridPluginManagerSpec_cxx; }
|
|
32
|
+
|
|
33
|
+
// Include Swift defined types
|
|
34
|
+
#if __has_include("ReactNativeVideoDrm-Swift.h")
|
|
35
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
36
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ReactNativeVideoDrm".
|
|
37
|
+
#include "ReactNativeVideoDrm-Swift.h"
|
|
38
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
39
|
+
#elif __has_include(<ReactNativeVideoDrm/ReactNativeVideoDrm-Swift.h>)
|
|
40
|
+
#include <ReactNativeVideoDrm/ReactNativeVideoDrm-Swift.h>
|
|
41
|
+
#else
|
|
42
|
+
#error ReactNativeVideoDrm's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ReactNativeVideoDrm", and try building the app first.
|
|
43
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeVideoDrmAutolinking.mm
|
|
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/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "ReactNativeVideoDrm-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridPluginManagerSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface ReactNativeVideoDrmAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation ReactNativeVideoDrmAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::videodrm;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"PluginManager",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridPluginManagerSpec> hybridObject = ReactNativeVideoDrm::ReactNativeVideoDrmAutolinking::createPluginManager();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeVideoDrmAutolinking.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
|
+
public final class ReactNativeVideoDrmAutolinking {
|
|
9
|
+
public typealias bridge = margelo.nitro.videodrm.bridge.swift
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of a Swift class that implements `HybridPluginManagerSpec`,
|
|
13
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridPluginManagerSpec_cxx`)
|
|
14
|
+
*
|
|
15
|
+
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
+
* in the `"autolinking"` property of `nitro.json` (in this case, `PluginManager`).
|
|
17
|
+
*/
|
|
18
|
+
public static func createPluginManager() -> bridge.std__shared_ptr_HybridPluginManagerSpec_ {
|
|
19
|
+
let hybridObject = PluginManager()
|
|
20
|
+
return { () -> bridge.std__shared_ptr_HybridPluginManagerSpec_ in
|
|
21
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
|
+
return __cxxWrapped.getCxxPart()
|
|
23
|
+
}()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPluginManagerSpecSwift.cpp
|
|
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
|
+
#include "HybridPluginManagerSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::videodrm {
|
|
11
|
+
} // namespace margelo::nitro::videodrm
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPluginManagerSpecSwift.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridPluginManagerSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridPluginManagerSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace ReactNativeVideoDrm { class HybridPluginManagerSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
#include "ReactNativeVideoDrm-Swift-Cxx-Umbrella.hpp"
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::videodrm {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The C++ part of HybridPluginManagerSpec_cxx.swift.
|
|
25
|
+
*
|
|
26
|
+
* HybridPluginManagerSpecSwift (C++) accesses HybridPluginManagerSpec_cxx (Swift), and might
|
|
27
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
28
|
+
*
|
|
29
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
30
|
+
* the future, HybridPluginManagerSpec_cxx can directly inherit from the C++ class HybridPluginManagerSpec
|
|
31
|
+
* to simplify the whole structure and memory management.
|
|
32
|
+
*/
|
|
33
|
+
class HybridPluginManagerSpecSwift: public virtual HybridPluginManagerSpec {
|
|
34
|
+
public:
|
|
35
|
+
// Constructor from a Swift instance
|
|
36
|
+
explicit HybridPluginManagerSpecSwift(const ReactNativeVideoDrm::HybridPluginManagerSpec_cxx& swiftPart):
|
|
37
|
+
HybridObject(HybridPluginManagerSpec::TAG),
|
|
38
|
+
_swiftPart(swiftPart) { }
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
// Get the Swift part
|
|
42
|
+
inline ReactNativeVideoDrm::HybridPluginManagerSpec_cxx& getSwiftPart() noexcept {
|
|
43
|
+
return _swiftPart;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
48
|
+
return _swiftPart.getMemorySize();
|
|
49
|
+
}
|
|
50
|
+
void dispose() noexcept override {
|
|
51
|
+
_swiftPart.dispose();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
// Properties
|
|
56
|
+
inline bool getIsEnabled() noexcept override {
|
|
57
|
+
return _swiftPart.isEnabled();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public:
|
|
61
|
+
// Methods
|
|
62
|
+
inline void enable() override {
|
|
63
|
+
auto __result = _swiftPart.enable();
|
|
64
|
+
if (__result.hasError()) [[unlikely]] {
|
|
65
|
+
std::rethrow_exception(__result.error());
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
inline void disable() override {
|
|
69
|
+
auto __result = _swiftPart.disable();
|
|
70
|
+
if (__result.hasError()) [[unlikely]] {
|
|
71
|
+
std::rethrow_exception(__result.error());
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private:
|
|
76
|
+
ReactNativeVideoDrm::HybridPluginManagerSpec_cxx _swiftPart;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
} // namespace margelo::nitro::videodrm
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPluginManagerSpec.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 ``HybridPluginManagerSpec``
|
|
12
|
+
public protocol HybridPluginManagerSpec_protocol: HybridObject {
|
|
13
|
+
// Properties
|
|
14
|
+
var isEnabled: Bool { get }
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
func enable() throws -> Void
|
|
18
|
+
func disable() throws -> Void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/// See ``HybridPluginManagerSpec``
|
|
22
|
+
open class HybridPluginManagerSpec_base {
|
|
23
|
+
private weak var cxxWrapper: HybridPluginManagerSpec_cxx? = nil
|
|
24
|
+
public init() { }
|
|
25
|
+
public func getCxxWrapper() -> HybridPluginManagerSpec_cxx {
|
|
26
|
+
#if DEBUG
|
|
27
|
+
guard self is HybridPluginManagerSpec else {
|
|
28
|
+
fatalError("`self` is not a `HybridPluginManagerSpec`! Did you accidentally inherit from `HybridPluginManagerSpec_base` instead of `HybridPluginManagerSpec`?")
|
|
29
|
+
}
|
|
30
|
+
#endif
|
|
31
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
32
|
+
return cxxWrapper
|
|
33
|
+
} else {
|
|
34
|
+
let cxxWrapper = HybridPluginManagerSpec_cxx(self as! HybridPluginManagerSpec)
|
|
35
|
+
self.cxxWrapper = cxxWrapper
|
|
36
|
+
return cxxWrapper
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A Swift base-protocol representing the PluginManager HybridObject.
|
|
43
|
+
* Implement this protocol to create Swift-based instances of PluginManager.
|
|
44
|
+
* ```swift
|
|
45
|
+
* class HybridPluginManager : HybridPluginManagerSpec {
|
|
46
|
+
* // ...
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
public typealias HybridPluginManagerSpec = HybridPluginManagerSpec_protocol & HybridPluginManagerSpec_base
|