react-native-nitro-player 1.4.4-alpha.0 → 1.5.0-alpha.1
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/NitroPlayer.podspec +6 -0
- package/README.md +115 -0
- package/android/build.gradle +8 -0
- package/android/src/main/AndroidManifest.xml +11 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/HybridCast.kt +79 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/ExoPlayerCore.kt +10 -7
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerCast.kt +122 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerCore.kt +13 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerSetup.kt +7 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/CastSessionController.kt +160 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/NitroCastConfig.kt +23 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/NitroCastOptionsProvider.kt +30 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/NitroMediaItemConverter.kt +53 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/PlaybackService.kt +33 -0
- package/ios/HybridCast.swift +63 -0
- package/ios/core/CastSessionManager.swift +373 -0
- package/ios/core/TrackPlayerCast.swift +109 -0
- package/ios/core/TrackPlayerCore.swift +23 -2
- package/ios/core/TrackPlayerPlayback.swift +32 -0
- package/ios/core/TrackPlayerQueue.swift +8 -1
- package/ios/core/TrackPlayerQueueBuild.swift +21 -0
- package/lib/components/CastButton.d.ts +44 -0
- package/lib/components/CastButton.js +125 -0
- package/lib/hooks/castCallbackManager.d.ts +19 -0
- package/lib/hooks/castCallbackManager.js +43 -0
- package/lib/hooks/index.d.ts +3 -0
- package/lib/hooks/index.js +3 -0
- package/lib/hooks/useCastState.d.ts +27 -0
- package/lib/hooks/useCastState.js +49 -0
- package/lib/hooks/useIsCasting.d.ts +17 -0
- package/lib/hooks/useIsCasting.js +43 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +4 -1
- package/lib/specs/Cast.nitro.d.ts +58 -0
- package/lib/specs/Cast.nitro.js +1 -0
- package/nitro.json +10 -0
- package/nitrogen/generated/android/NitroPlayer+autolinking.cmake +3 -1
- package/nitrogen/generated/android/NitroPlayerOnLoad.cpp +18 -0
- package/nitrogen/generated/android/c++/JCastState.hpp +64 -0
- package/nitrogen/generated/android/c++/JFunc_void_CastState_std__optional_std__variant_nitro__NullType__std__string__.hpp +83 -0
- package/nitrogen/generated/android/c++/JHybridCastSpec.cpp +115 -0
- package/nitrogen/generated/android/c++/JHybridCastSpec.hpp +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/CastState.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string__.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/HybridCastSpec.kt +85 -0
- package/nitrogen/generated/ios/NitroPlayer-Swift-Cxx-Bridge.cpp +38 -13
- package/nitrogen/generated/ios/NitroPlayer-Swift-Cxx-Bridge.hpp +176 -125
- package/nitrogen/generated/ios/NitroPlayer-Swift-Cxx-Umbrella.hpp +8 -0
- package/nitrogen/generated/ios/NitroPlayerAutolinking.mm +8 -0
- package/nitrogen/generated/ios/NitroPlayerAutolinking.swift +12 -0
- package/nitrogen/generated/ios/c++/HybridCastSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCastSpecSwift.hpp +133 -0
- package/nitrogen/generated/ios/swift/CastState.swift +48 -0
- package/nitrogen/generated/ios/swift/Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string__.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridCastSpec.swift +61 -0
- package/nitrogen/generated/ios/swift/HybridCastSpec_cxx.swift +254 -0
- package/nitrogen/generated/shared/c++/CastState.hpp +84 -0
- package/nitrogen/generated/shared/c++/HybridCastSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridCastSpec.hpp +75 -0
- package/package.json +3 -3
- package/src/components/CastButton.tsx +233 -0
- package/src/hooks/castCallbackManager.ts +55 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/useCastState.ts +67 -0
- package/src/hooks/useIsCasting.ts +47 -0
- package/src/index.ts +9 -0
- package/src/specs/Cast.nitro.ts +72 -0
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
11
|
#include "HybridAudioRoutePickerSpecSwift.hpp"
|
|
12
|
+
#include "HybridCastSpecSwift.hpp"
|
|
12
13
|
#include "HybridDownloadManagerSpecSwift.hpp"
|
|
13
14
|
#include "HybridEqualizerSpecSwift.hpp"
|
|
14
15
|
#include "HybridPlayerQueueSpecSwift.hpp"
|
|
@@ -34,11 +35,11 @@ namespace margelo::nitro::nitroplayer::bridge::swift {
|
|
|
34
35
|
return swiftPart.toUnsafe();
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
// pragma MARK: std::function<void(
|
|
38
|
-
|
|
39
|
-
auto swiftClosure = NitroPlayer::
|
|
40
|
-
return [swiftClosure = std::move(swiftClosure)](
|
|
41
|
-
swiftClosure.call(
|
|
38
|
+
// pragma MARK: std::function<void()>
|
|
39
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
40
|
+
auto swiftClosure = NitroPlayer::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
41
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
42
|
+
swiftClosure.call();
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -50,6 +51,38 @@ namespace margelo::nitro::nitroplayer::bridge::swift {
|
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
// pragma MARK: std::function<void(CastState /* state */, const std::optional<std::variant<nitro::NullType, std::string>>& /* deviceName */)>
|
|
55
|
+
Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string__ create_Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string__(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
56
|
+
auto swiftClosure = NitroPlayer::Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string__::fromUnsafe(swiftClosureWrapper);
|
|
57
|
+
return [swiftClosure = std::move(swiftClosure)](CastState state, const std::optional<std::variant<nitro::NullType, std::string>>& deviceName) mutable -> void {
|
|
58
|
+
swiftClosure.call(static_cast<int>(state), deviceName);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// pragma MARK: std::shared_ptr<HybridCastSpec>
|
|
63
|
+
std::shared_ptr<HybridCastSpec> create_std__shared_ptr_HybridCastSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
64
|
+
NitroPlayer::HybridCastSpec_cxx swiftPart = NitroPlayer::HybridCastSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
65
|
+
return std::make_shared<margelo::nitro::nitroplayer::HybridCastSpecSwift>(swiftPart);
|
|
66
|
+
}
|
|
67
|
+
void* NON_NULL get_std__shared_ptr_HybridCastSpec_(std__shared_ptr_HybridCastSpec_ cppType) {
|
|
68
|
+
std::shared_ptr<margelo::nitro::nitroplayer::HybridCastSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::nitroplayer::HybridCastSpecSwift>(cppType);
|
|
69
|
+
#ifdef NITRO_DEBUG
|
|
70
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
71
|
+
throw std::runtime_error("Class \"HybridCastSpec\" is not implemented in Swift!");
|
|
72
|
+
}
|
|
73
|
+
#endif
|
|
74
|
+
NitroPlayer::HybridCastSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
75
|
+
return swiftPart.toUnsafe();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// pragma MARK: std::function<void(const std::string& /* result */)>
|
|
79
|
+
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
80
|
+
auto swiftClosure = NitroPlayer::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
|
|
81
|
+
return [swiftClosure = std::move(swiftClosure)](const std::string& result) mutable -> void {
|
|
82
|
+
swiftClosure.call(result);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
53
86
|
// pragma MARK: std::function<void(const std::vector<std::string>& /* result */)>
|
|
54
87
|
Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
55
88
|
auto swiftClosure = NitroPlayer::Func_void_std__vector_std__string_::fromUnsafe(swiftClosureWrapper);
|
|
@@ -58,14 +91,6 @@ namespace margelo::nitro::nitroplayer::bridge::swift {
|
|
|
58
91
|
};
|
|
59
92
|
}
|
|
60
93
|
|
|
61
|
-
// pragma MARK: std::function<void()>
|
|
62
|
-
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
63
|
-
auto swiftClosure = NitroPlayer::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
64
|
-
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
65
|
-
swiftClosure.call();
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
94
|
// pragma MARK: std::function<void(bool /* result */)>
|
|
70
95
|
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
71
96
|
auto swiftClosure = NitroPlayer::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `CastState` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitroplayer { enum class CastState; }
|
|
11
13
|
// Forward declaration of `CurrentPlayingType` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::nitroplayer { enum class CurrentPlayingType; }
|
|
13
15
|
// Forward declaration of `DownloadConfig` to properly resolve imports.
|
|
@@ -40,6 +42,8 @@ namespace margelo::nitro::nitroplayer { struct EqualizerState; }
|
|
|
40
42
|
namespace margelo::nitro::nitroplayer { struct GainRange; }
|
|
41
43
|
// Forward declaration of `HybridAudioRoutePickerSpec` to properly resolve imports.
|
|
42
44
|
namespace margelo::nitro::nitroplayer { class HybridAudioRoutePickerSpec; }
|
|
45
|
+
// Forward declaration of `HybridCastSpec` to properly resolve imports.
|
|
46
|
+
namespace margelo::nitro::nitroplayer { class HybridCastSpec; }
|
|
43
47
|
// Forward declaration of `HybridDownloadManagerSpec` to properly resolve imports.
|
|
44
48
|
namespace margelo::nitro::nitroplayer { class HybridDownloadManagerSpec; }
|
|
45
49
|
// Forward declaration of `HybridEqualizerSpec` to properly resolve imports.
|
|
@@ -72,6 +76,8 @@ namespace margelo::nitro::nitroplayer { enum class TrackPlayerState; }
|
|
|
72
76
|
// Forward declarations of Swift defined types
|
|
73
77
|
// Forward declaration of `HybridAudioRoutePickerSpec_cxx` to properly resolve imports.
|
|
74
78
|
namespace NitroPlayer { class HybridAudioRoutePickerSpec_cxx; }
|
|
79
|
+
// Forward declaration of `HybridCastSpec_cxx` to properly resolve imports.
|
|
80
|
+
namespace NitroPlayer { class HybridCastSpec_cxx; }
|
|
75
81
|
// Forward declaration of `HybridDownloadManagerSpec_cxx` to properly resolve imports.
|
|
76
82
|
namespace NitroPlayer { class HybridDownloadManagerSpec_cxx; }
|
|
77
83
|
// Forward declaration of `HybridEqualizerSpec_cxx` to properly resolve imports.
|
|
@@ -82,6 +88,7 @@ namespace NitroPlayer { class HybridPlayerQueueSpec_cxx; }
|
|
|
82
88
|
namespace NitroPlayer { class HybridTrackPlayerSpec_cxx; }
|
|
83
89
|
|
|
84
90
|
// Include C++ defined types
|
|
91
|
+
#include "CastState.hpp"
|
|
85
92
|
#include "CurrentPlayingType.hpp"
|
|
86
93
|
#include "DownloadConfig.hpp"
|
|
87
94
|
#include "DownloadError.hpp"
|
|
@@ -98,6 +105,7 @@ namespace NitroPlayer { class HybridTrackPlayerSpec_cxx; }
|
|
|
98
105
|
#include "EqualizerState.hpp"
|
|
99
106
|
#include "GainRange.hpp"
|
|
100
107
|
#include "HybridAudioRoutePickerSpec.hpp"
|
|
108
|
+
#include "HybridCastSpec.hpp"
|
|
101
109
|
#include "HybridDownloadManagerSpec.hpp"
|
|
102
110
|
#include "HybridEqualizerSpec.hpp"
|
|
103
111
|
#include "HybridPlayerQueueSpec.hpp"
|
|
@@ -152,48 +160,74 @@ namespace margelo::nitro::nitroplayer::bridge::swift {
|
|
|
152
160
|
return Result<void>::withError(error);
|
|
153
161
|
}
|
|
154
162
|
|
|
155
|
-
// pragma MARK: std::
|
|
163
|
+
// pragma MARK: std::shared_ptr<Promise<void>>
|
|
156
164
|
/**
|
|
157
|
-
* Specialized version of `std::
|
|
165
|
+
* Specialized version of `std::shared_ptr<Promise<void>>`.
|
|
158
166
|
*/
|
|
159
|
-
using
|
|
160
|
-
inline std::
|
|
161
|
-
return
|
|
162
|
-
}
|
|
163
|
-
inline bool has_value_std__optional_StorageLocation_(const std::optional<StorageLocation>& optional) noexcept {
|
|
164
|
-
return optional.has_value();
|
|
167
|
+
using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
|
|
168
|
+
inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
|
|
169
|
+
return Promise<void>::create();
|
|
165
170
|
}
|
|
166
|
-
inline
|
|
167
|
-
return
|
|
171
|
+
inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
|
|
172
|
+
return PromiseHolder<void>(std::move(promise));
|
|
168
173
|
}
|
|
169
174
|
|
|
170
|
-
// pragma MARK: std::
|
|
175
|
+
// pragma MARK: std::function<void()>
|
|
171
176
|
/**
|
|
172
|
-
* Specialized version of `std::
|
|
177
|
+
* Specialized version of `std::function<void()>`.
|
|
173
178
|
*/
|
|
174
|
-
using
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
179
|
+
using Func_void = std::function<void()>;
|
|
180
|
+
/**
|
|
181
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
182
|
+
*/
|
|
183
|
+
class Func_void_Wrapper final {
|
|
184
|
+
public:
|
|
185
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
186
|
+
inline void call() const noexcept {
|
|
187
|
+
_function->operator()();
|
|
188
|
+
}
|
|
189
|
+
private:
|
|
190
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
191
|
+
} SWIFT_NONCOPYABLE;
|
|
192
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
193
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
194
|
+
return Func_void_Wrapper(std::move(value));
|
|
180
195
|
}
|
|
181
|
-
|
|
182
|
-
|
|
196
|
+
|
|
197
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
198
|
+
/**
|
|
199
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
200
|
+
*/
|
|
201
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
202
|
+
/**
|
|
203
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
204
|
+
*/
|
|
205
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
206
|
+
public:
|
|
207
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
208
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
209
|
+
_function->operator()(error);
|
|
210
|
+
}
|
|
211
|
+
private:
|
|
212
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
213
|
+
} SWIFT_NONCOPYABLE;
|
|
214
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
215
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
216
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
183
217
|
}
|
|
184
218
|
|
|
185
|
-
// pragma MARK: std::optional<
|
|
219
|
+
// pragma MARK: std::optional<std::string>
|
|
186
220
|
/**
|
|
187
|
-
* Specialized version of `std::optional<
|
|
221
|
+
* Specialized version of `std::optional<std::string>`.
|
|
188
222
|
*/
|
|
189
|
-
using
|
|
190
|
-
inline std::optional<
|
|
191
|
-
return std::optional<
|
|
223
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
224
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
225
|
+
return std::optional<std::string>(value);
|
|
192
226
|
}
|
|
193
|
-
inline bool
|
|
227
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
194
228
|
return optional.has_value();
|
|
195
229
|
}
|
|
196
|
-
inline
|
|
230
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
197
231
|
return optional.value();
|
|
198
232
|
}
|
|
199
233
|
|
|
@@ -241,6 +275,121 @@ namespace margelo::nitro::nitroplayer::bridge::swift {
|
|
|
241
275
|
return optional.value();
|
|
242
276
|
}
|
|
243
277
|
|
|
278
|
+
// pragma MARK: std::function<void(CastState /* state */, const std::optional<std::variant<nitro::NullType, std::string>>& /* deviceName */)>
|
|
279
|
+
/**
|
|
280
|
+
* Specialized version of `std::function<void(CastState, const std::optional<std::variant<nitro::NullType, std::string>>&)>`.
|
|
281
|
+
*/
|
|
282
|
+
using Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string__ = std::function<void(CastState /* state */, const std::optional<std::variant<nitro::NullType, std::string>>& /* deviceName */)>;
|
|
283
|
+
/**
|
|
284
|
+
* Wrapper class for a `std::function<void(CastState / * state * /, const std::optional<std::variant<nitro::NullType, std::string>>& / * deviceName * /)>`, this can be used from Swift.
|
|
285
|
+
*/
|
|
286
|
+
class Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string___Wrapper final {
|
|
287
|
+
public:
|
|
288
|
+
explicit Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string___Wrapper(std::function<void(CastState /* state */, const std::optional<std::variant<nitro::NullType, std::string>>& /* deviceName */)>&& func): _function(std::make_unique<std::function<void(CastState /* state */, const std::optional<std::variant<nitro::NullType, std::string>>& /* deviceName */)>>(std::move(func))) {}
|
|
289
|
+
inline void call(int state, std::optional<std::variant<nitro::NullType, std::string>> deviceName) const noexcept {
|
|
290
|
+
_function->operator()(static_cast<CastState>(state), deviceName);
|
|
291
|
+
}
|
|
292
|
+
private:
|
|
293
|
+
std::unique_ptr<std::function<void(CastState /* state */, const std::optional<std::variant<nitro::NullType, std::string>>& /* deviceName */)>> _function;
|
|
294
|
+
} SWIFT_NONCOPYABLE;
|
|
295
|
+
Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string__ create_Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string__(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
296
|
+
inline Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string___Wrapper wrap_Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string__(Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string__ value) noexcept {
|
|
297
|
+
return Func_void_CastState_std__optional_std__variant_nitro__NullType__std__string___Wrapper(std::move(value));
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// pragma MARK: std::shared_ptr<HybridCastSpec>
|
|
301
|
+
/**
|
|
302
|
+
* Specialized version of `std::shared_ptr<HybridCastSpec>`.
|
|
303
|
+
*/
|
|
304
|
+
using std__shared_ptr_HybridCastSpec_ = std::shared_ptr<HybridCastSpec>;
|
|
305
|
+
std::shared_ptr<HybridCastSpec> create_std__shared_ptr_HybridCastSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
306
|
+
void* NON_NULL get_std__shared_ptr_HybridCastSpec_(std__shared_ptr_HybridCastSpec_ cppType);
|
|
307
|
+
|
|
308
|
+
// pragma MARK: std::weak_ptr<HybridCastSpec>
|
|
309
|
+
using std__weak_ptr_HybridCastSpec_ = std::weak_ptr<HybridCastSpec>;
|
|
310
|
+
inline std__weak_ptr_HybridCastSpec_ weakify_std__shared_ptr_HybridCastSpec_(const std::shared_ptr<HybridCastSpec>& strong) noexcept { return strong; }
|
|
311
|
+
|
|
312
|
+
// pragma MARK: Result<std::shared_ptr<Promise<void>>>
|
|
313
|
+
using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
|
|
314
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
|
|
315
|
+
return Result<std::shared_ptr<Promise<void>>>::withValue(value);
|
|
316
|
+
}
|
|
317
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
|
|
318
|
+
return Result<std::shared_ptr<Promise<void>>>::withError(error);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// pragma MARK: Result<bool>
|
|
322
|
+
using Result_bool_ = Result<bool>;
|
|
323
|
+
inline Result_bool_ create_Result_bool_(bool value) noexcept {
|
|
324
|
+
return Result<bool>::withValue(std::move(value));
|
|
325
|
+
}
|
|
326
|
+
inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept {
|
|
327
|
+
return Result<bool>::withError(error);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// pragma MARK: Result<CastState>
|
|
331
|
+
using Result_CastState_ = Result<CastState>;
|
|
332
|
+
inline Result_CastState_ create_Result_CastState_(CastState value) noexcept {
|
|
333
|
+
return Result<CastState>::withValue(std::move(value));
|
|
334
|
+
}
|
|
335
|
+
inline Result_CastState_ create_Result_CastState_(const std::exception_ptr& error) noexcept {
|
|
336
|
+
return Result<CastState>::withError(error);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// pragma MARK: Result<std::variant<nitro::NullType, std::string>>
|
|
340
|
+
using Result_std__variant_nitro__NullType__std__string__ = Result<std::variant<nitro::NullType, std::string>>;
|
|
341
|
+
inline Result_std__variant_nitro__NullType__std__string__ create_Result_std__variant_nitro__NullType__std__string__(const std::variant<nitro::NullType, std::string>& value) noexcept {
|
|
342
|
+
return Result<std::variant<nitro::NullType, std::string>>::withValue(value);
|
|
343
|
+
}
|
|
344
|
+
inline Result_std__variant_nitro__NullType__std__string__ create_Result_std__variant_nitro__NullType__std__string__(const std::exception_ptr& error) noexcept {
|
|
345
|
+
return Result<std::variant<nitro::NullType, std::string>>::withError(error);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// pragma MARK: std::optional<StorageLocation>
|
|
349
|
+
/**
|
|
350
|
+
* Specialized version of `std::optional<StorageLocation>`.
|
|
351
|
+
*/
|
|
352
|
+
using std__optional_StorageLocation_ = std::optional<StorageLocation>;
|
|
353
|
+
inline std::optional<StorageLocation> create_std__optional_StorageLocation_(const StorageLocation& value) noexcept {
|
|
354
|
+
return std::optional<StorageLocation>(value);
|
|
355
|
+
}
|
|
356
|
+
inline bool has_value_std__optional_StorageLocation_(const std::optional<StorageLocation>& optional) noexcept {
|
|
357
|
+
return optional.has_value();
|
|
358
|
+
}
|
|
359
|
+
inline StorageLocation get_std__optional_StorageLocation_(const std::optional<StorageLocation>& optional) noexcept {
|
|
360
|
+
return optional.value();
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// pragma MARK: std::optional<double>
|
|
364
|
+
/**
|
|
365
|
+
* Specialized version of `std::optional<double>`.
|
|
366
|
+
*/
|
|
367
|
+
using std__optional_double_ = std::optional<double>;
|
|
368
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
369
|
+
return std::optional<double>(value);
|
|
370
|
+
}
|
|
371
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
372
|
+
return optional.has_value();
|
|
373
|
+
}
|
|
374
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
375
|
+
return optional.value();
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// pragma MARK: std::optional<bool>
|
|
379
|
+
/**
|
|
380
|
+
* Specialized version of `std::optional<bool>`.
|
|
381
|
+
*/
|
|
382
|
+
using std__optional_bool_ = std::optional<bool>;
|
|
383
|
+
inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
|
|
384
|
+
return std::optional<bool>(value);
|
|
385
|
+
}
|
|
386
|
+
inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
387
|
+
return optional.has_value();
|
|
388
|
+
}
|
|
389
|
+
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
390
|
+
return optional.value();
|
|
391
|
+
}
|
|
392
|
+
|
|
244
393
|
// pragma MARK: std::shared_ptr<Promise<std::string>>
|
|
245
394
|
/**
|
|
246
395
|
* Specialized version of `std::shared_ptr<Promise<std::string>>`.
|
|
@@ -275,28 +424,6 @@ namespace margelo::nitro::nitroplayer::bridge::swift {
|
|
|
275
424
|
return Func_void_std__string_Wrapper(std::move(value));
|
|
276
425
|
}
|
|
277
426
|
|
|
278
|
-
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
279
|
-
/**
|
|
280
|
-
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
281
|
-
*/
|
|
282
|
-
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
283
|
-
/**
|
|
284
|
-
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
285
|
-
*/
|
|
286
|
-
class Func_void_std__exception_ptr_Wrapper final {
|
|
287
|
-
public:
|
|
288
|
-
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
289
|
-
inline void call(std::exception_ptr error) const noexcept {
|
|
290
|
-
_function->operator()(error);
|
|
291
|
-
}
|
|
292
|
-
private:
|
|
293
|
-
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
294
|
-
} SWIFT_NONCOPYABLE;
|
|
295
|
-
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
296
|
-
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
297
|
-
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
298
|
-
}
|
|
299
|
-
|
|
300
427
|
// pragma MARK: std::optional<std::shared_ptr<AnyMap>>
|
|
301
428
|
/**
|
|
302
429
|
* Specialized version of `std::optional<std::shared_ptr<AnyMap>>`.
|
|
@@ -312,21 +439,6 @@ namespace margelo::nitro::nitroplayer::bridge::swift {
|
|
|
312
439
|
return optional.value();
|
|
313
440
|
}
|
|
314
441
|
|
|
315
|
-
// pragma MARK: std::optional<std::string>
|
|
316
|
-
/**
|
|
317
|
-
* Specialized version of `std::optional<std::string>`.
|
|
318
|
-
*/
|
|
319
|
-
using std__optional_std__string_ = std::optional<std::string>;
|
|
320
|
-
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
321
|
-
return std::optional<std::string>(value);
|
|
322
|
-
}
|
|
323
|
-
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
324
|
-
return optional.has_value();
|
|
325
|
-
}
|
|
326
|
-
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
327
|
-
return optional.value();
|
|
328
|
-
}
|
|
329
|
-
|
|
330
442
|
// pragma MARK: std::vector<std::string>
|
|
331
443
|
/**
|
|
332
444
|
* Specialized version of `std::vector<std::string>`.
|
|
@@ -383,40 +495,6 @@ namespace margelo::nitro::nitroplayer::bridge::swift {
|
|
|
383
495
|
return vector;
|
|
384
496
|
}
|
|
385
497
|
|
|
386
|
-
// pragma MARK: std::shared_ptr<Promise<void>>
|
|
387
|
-
/**
|
|
388
|
-
* Specialized version of `std::shared_ptr<Promise<void>>`.
|
|
389
|
-
*/
|
|
390
|
-
using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
|
|
391
|
-
inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
|
|
392
|
-
return Promise<void>::create();
|
|
393
|
-
}
|
|
394
|
-
inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
|
|
395
|
-
return PromiseHolder<void>(std::move(promise));
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
// pragma MARK: std::function<void()>
|
|
399
|
-
/**
|
|
400
|
-
* Specialized version of `std::function<void()>`.
|
|
401
|
-
*/
|
|
402
|
-
using Func_void = std::function<void()>;
|
|
403
|
-
/**
|
|
404
|
-
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
405
|
-
*/
|
|
406
|
-
class Func_void_Wrapper final {
|
|
407
|
-
public:
|
|
408
|
-
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
409
|
-
inline void call() const noexcept {
|
|
410
|
-
_function->operator()();
|
|
411
|
-
}
|
|
412
|
-
private:
|
|
413
|
-
std::unique_ptr<std::function<void()>> _function;
|
|
414
|
-
} SWIFT_NONCOPYABLE;
|
|
415
|
-
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
416
|
-
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
417
|
-
return Func_void_Wrapper(std::move(value));
|
|
418
|
-
}
|
|
419
|
-
|
|
420
498
|
// pragma MARK: std::variant<nitro::NullType, double>
|
|
421
499
|
/**
|
|
422
500
|
* Wrapper struct for `std::variant<nitro::NullType, double>`.
|
|
@@ -1017,15 +1095,6 @@ namespace margelo::nitro::nitroplayer::bridge::swift {
|
|
|
1017
1095
|
return Result<std::shared_ptr<Promise<std::vector<std::string>>>>::withError(error);
|
|
1018
1096
|
}
|
|
1019
1097
|
|
|
1020
|
-
// pragma MARK: Result<std::shared_ptr<Promise<void>>>
|
|
1021
|
-
using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
|
|
1022
|
-
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
|
|
1023
|
-
return Result<std::shared_ptr<Promise<void>>>::withValue(value);
|
|
1024
|
-
}
|
|
1025
|
-
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
|
|
1026
|
-
return Result<std::shared_ptr<Promise<void>>>::withError(error);
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
1098
|
// pragma MARK: Result<std::variant<nitro::NullType, DownloadTask>>
|
|
1030
1099
|
using Result_std__variant_nitro__NullType__DownloadTask__ = Result<std::variant<nitro::NullType, DownloadTask>>;
|
|
1031
1100
|
inline Result_std__variant_nitro__NullType__DownloadTask__ create_Result_std__variant_nitro__NullType__DownloadTask__(const std::variant<nitro::NullType, DownloadTask>& value) noexcept {
|
|
@@ -1053,15 +1122,6 @@ namespace margelo::nitro::nitroplayer::bridge::swift {
|
|
|
1053
1122
|
return Result<DownloadQueueStatus>::withError(error);
|
|
1054
1123
|
}
|
|
1055
1124
|
|
|
1056
|
-
// pragma MARK: Result<bool>
|
|
1057
|
-
using Result_bool_ = Result<bool>;
|
|
1058
|
-
inline Result_bool_ create_Result_bool_(bool value) noexcept {
|
|
1059
|
-
return Result<bool>::withValue(std::move(value));
|
|
1060
|
-
}
|
|
1061
|
-
inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept {
|
|
1062
|
-
return Result<bool>::withError(error);
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
1125
|
// pragma MARK: Result<DownloadState>
|
|
1066
1126
|
using Result_DownloadState_ = Result<DownloadState>;
|
|
1067
1127
|
inline Result_DownloadState_ create_Result_DownloadState_(DownloadState value) noexcept {
|
|
@@ -1314,15 +1374,6 @@ namespace margelo::nitro::nitroplayer::bridge::swift {
|
|
|
1314
1374
|
return Result<std::vector<EqualizerPreset>>::withError(error);
|
|
1315
1375
|
}
|
|
1316
1376
|
|
|
1317
|
-
// pragma MARK: Result<std::variant<nitro::NullType, std::string>>
|
|
1318
|
-
using Result_std__variant_nitro__NullType__std__string__ = Result<std::variant<nitro::NullType, std::string>>;
|
|
1319
|
-
inline Result_std__variant_nitro__NullType__std__string__ create_Result_std__variant_nitro__NullType__std__string__(const std::variant<nitro::NullType, std::string>& value) noexcept {
|
|
1320
|
-
return Result<std::variant<nitro::NullType, std::string>>::withValue(value);
|
|
1321
|
-
}
|
|
1322
|
-
inline Result_std__variant_nitro__NullType__std__string__ create_Result_std__variant_nitro__NullType__std__string__(const std::exception_ptr& error) noexcept {
|
|
1323
|
-
return Result<std::variant<nitro::NullType, std::string>>::withError(error);
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
1377
|
// pragma MARK: Result<std::shared_ptr<Promise<EqualizerState>>>
|
|
1327
1378
|
using Result_std__shared_ptr_Promise_EqualizerState___ = Result<std::shared_ptr<Promise<EqualizerState>>>;
|
|
1328
1379
|
inline Result_std__shared_ptr_Promise_EqualizerState___ create_Result_std__shared_ptr_Promise_EqualizerState___(const std::shared_ptr<Promise<EqualizerState>>& value) noexcept {
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `CastState` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitroplayer { enum class CastState; }
|
|
11
13
|
// Forward declaration of `CurrentPlayingType` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::nitroplayer { enum class CurrentPlayingType; }
|
|
13
15
|
// Forward declaration of `DownloadConfig` to properly resolve imports.
|
|
@@ -40,6 +42,8 @@ namespace margelo::nitro::nitroplayer { struct EqualizerState; }
|
|
|
40
42
|
namespace margelo::nitro::nitroplayer { struct GainRange; }
|
|
41
43
|
// Forward declaration of `HybridAudioRoutePickerSpec` to properly resolve imports.
|
|
42
44
|
namespace margelo::nitro::nitroplayer { class HybridAudioRoutePickerSpec; }
|
|
45
|
+
// Forward declaration of `HybridCastSpec` to properly resolve imports.
|
|
46
|
+
namespace margelo::nitro::nitroplayer { class HybridCastSpec; }
|
|
43
47
|
// Forward declaration of `HybridDownloadManagerSpec` to properly resolve imports.
|
|
44
48
|
namespace margelo::nitro::nitroplayer { class HybridDownloadManagerSpec; }
|
|
45
49
|
// Forward declaration of `HybridEqualizerSpec` to properly resolve imports.
|
|
@@ -72,6 +76,7 @@ namespace margelo::nitro::nitroplayer { struct TrackItem; }
|
|
|
72
76
|
namespace margelo::nitro::nitroplayer { enum class TrackPlayerState; }
|
|
73
77
|
|
|
74
78
|
// Include C++ defined types
|
|
79
|
+
#include "CastState.hpp"
|
|
75
80
|
#include "CurrentPlayingType.hpp"
|
|
76
81
|
#include "DownloadConfig.hpp"
|
|
77
82
|
#include "DownloadError.hpp"
|
|
@@ -88,6 +93,7 @@ namespace margelo::nitro::nitroplayer { enum class TrackPlayerState; }
|
|
|
88
93
|
#include "EqualizerState.hpp"
|
|
89
94
|
#include "GainRange.hpp"
|
|
90
95
|
#include "HybridAudioRoutePickerSpec.hpp"
|
|
96
|
+
#include "HybridCastSpec.hpp"
|
|
91
97
|
#include "HybridDownloadManagerSpec.hpp"
|
|
92
98
|
#include "HybridEqualizerSpec.hpp"
|
|
93
99
|
#include "HybridPlayerQueueSpec.hpp"
|
|
@@ -127,6 +133,8 @@ namespace margelo::nitro::nitroplayer { enum class TrackPlayerState; }
|
|
|
127
133
|
// Forward declarations of Swift defined types
|
|
128
134
|
// Forward declaration of `HybridAudioRoutePickerSpec_cxx` to properly resolve imports.
|
|
129
135
|
namespace NitroPlayer { class HybridAudioRoutePickerSpec_cxx; }
|
|
136
|
+
// Forward declaration of `HybridCastSpec_cxx` to properly resolve imports.
|
|
137
|
+
namespace NitroPlayer { class HybridCastSpec_cxx; }
|
|
130
138
|
// Forward declaration of `HybridDownloadManagerSpec_cxx` to properly resolve imports.
|
|
131
139
|
namespace NitroPlayer { class HybridDownloadManagerSpec_cxx; }
|
|
132
140
|
// Forward declaration of `HybridEqualizerSpec_cxx` to properly resolve imports.
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#include "HybridPlayerQueueSpecSwift.hpp"
|
|
14
14
|
#include "HybridTrackPlayerSpecSwift.hpp"
|
|
15
15
|
#include "HybridAudioRoutePickerSpecSwift.hpp"
|
|
16
|
+
#include "HybridCastSpecSwift.hpp"
|
|
16
17
|
#include "HybridDownloadManagerSpecSwift.hpp"
|
|
17
18
|
#include "HybridEqualizerSpecSwift.hpp"
|
|
18
19
|
|
|
@@ -46,6 +47,13 @@
|
|
|
46
47
|
return hybridObject;
|
|
47
48
|
}
|
|
48
49
|
);
|
|
50
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
51
|
+
"Cast",
|
|
52
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
53
|
+
std::shared_ptr<HybridCastSpec> hybridObject = NitroPlayer::NitroPlayerAutolinking::createCast();
|
|
54
|
+
return hybridObject;
|
|
55
|
+
}
|
|
56
|
+
);
|
|
49
57
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
50
58
|
"DownloadManager",
|
|
51
59
|
[]() -> std::shared_ptr<HybridObject> {
|
|
@@ -48,6 +48,18 @@ public final class NitroPlayerAutolinking {
|
|
|
48
48
|
return HybridAudioRoutePicker.self is any RecyclableView.Type
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
public static func createCast() -> bridge.std__shared_ptr_HybridCastSpec_ {
|
|
52
|
+
let hybridObject = HybridCast()
|
|
53
|
+
return { () -> bridge.std__shared_ptr_HybridCastSpec_ in
|
|
54
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
55
|
+
return __cxxWrapped.getCxxPart()
|
|
56
|
+
}()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public static func isCastRecyclable() -> Bool {
|
|
60
|
+
return HybridCast.self is any RecyclableView.Type
|
|
61
|
+
}
|
|
62
|
+
|
|
51
63
|
public static func createDownloadManager() -> bridge.std__shared_ptr_HybridDownloadManagerSpec_ {
|
|
52
64
|
let hybridObject = HybridDownloadManager()
|
|
53
65
|
return { () -> bridge.std__shared_ptr_HybridDownloadManagerSpec_ in
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridCastSpecSwift.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 "HybridCastSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitroplayer {
|
|
11
|
+
} // namespace margelo::nitro::nitroplayer
|