mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-16 02:44:51 +00:00
feat(state): add state for videos/audios/sub/rend
This commit is contained in:
+4
@@ -21,6 +21,8 @@
|
||||
#include "JFunc_void_PlayerStatus.hpp"
|
||||
#include "JFunc_void_CastStatus.hpp"
|
||||
#include "JFunc_void_std__optional_Source_.hpp"
|
||||
#include "JFunc_void_std__vector_Track_.hpp"
|
||||
#include "JFunc_void_std__vector_Rendition_.hpp"
|
||||
#include "JFunc_void.hpp"
|
||||
#include "JFunc_void_std__string_std__string.hpp"
|
||||
#include "JFunc_void_std__string.hpp"
|
||||
@@ -69,6 +71,8 @@ void registerAllNatives() {
|
||||
margelo::nitro::omni::JFunc_void_PlayerStatus_cxx::registerNatives();
|
||||
margelo::nitro::omni::JFunc_void_CastStatus_cxx::registerNatives();
|
||||
margelo::nitro::omni::JFunc_void_std__optional_Source__cxx::registerNatives();
|
||||
margelo::nitro::omni::JFunc_void_std__vector_Track__cxx::registerNatives();
|
||||
margelo::nitro::omni::JFunc_void_std__vector_Rendition__cxx::registerNatives();
|
||||
margelo::nitro::omni::JFunc_void_cxx::registerNatives();
|
||||
margelo::nitro::omni::JFunc_void_std__string_std__string_cxx::registerNatives();
|
||||
margelo::nitro::omni::JFunc_void_std__string_cxx::registerNatives();
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
///
|
||||
/// JFunc_void_std__vector_Rendition_.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <functional>
|
||||
|
||||
#include "Rendition.hpp"
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <NitroModules/JNICallable.hpp>
|
||||
#include "JRendition.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
/**
|
||||
* Represents the Java/Kotlin callback `(value: Array<Rendition>) -> Unit`.
|
||||
* This can be passed around between C++ and Java/Kotlin.
|
||||
*/
|
||||
struct JFunc_void_std__vector_Rendition_: public jni::JavaClass<JFunc_void_std__vector_Rendition_> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_std__vector_Rendition_;";
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the function this `JFunc_void_std__vector_Rendition_` instance holds through JNI.
|
||||
*/
|
||||
void invoke(const std::vector<Rendition>& value) const {
|
||||
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<JRendition>> /* value */)>("invoke");
|
||||
method(self(), [&](auto&& __input) {
|
||||
size_t __size = __input.size();
|
||||
jni::local_ref<jni::JArrayClass<JRendition>> __array = jni::JArrayClass<JRendition>::newArray(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
const auto& __element = __input[__i];
|
||||
auto __elementJni = JRendition::fromCpp(__element);
|
||||
__array->setElement(__i, *__elementJni);
|
||||
}
|
||||
return __array;
|
||||
}(value));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An implementation of Func_void_std__vector_Rendition_ that is backed by a C++ implementation (using `std::function<...>`)
|
||||
*/
|
||||
class JFunc_void_std__vector_Rendition__cxx final: public jni::HybridClass<JFunc_void_std__vector_Rendition__cxx, JFunc_void_std__vector_Rendition_> {
|
||||
public:
|
||||
static jni::local_ref<JFunc_void_std__vector_Rendition_::javaobject> fromCpp(const std::function<void(const std::vector<Rendition>& /* value */)>& func) {
|
||||
return JFunc_void_std__vector_Rendition__cxx::newObjectCxxArgs(func);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the C++ `std::function<...>` this `JFunc_void_std__vector_Rendition__cxx` instance holds.
|
||||
*/
|
||||
void invoke_cxx(jni::alias_ref<jni::JArrayClass<JRendition>> value) {
|
||||
_func([&](auto&& __input) {
|
||||
size_t __size = __input->size();
|
||||
std::vector<Rendition> __vector;
|
||||
__vector.reserve(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
auto __element = __input->getElement(__i);
|
||||
__vector.push_back(__element->toCpp());
|
||||
}
|
||||
return __vector;
|
||||
}(value));
|
||||
}
|
||||
|
||||
public:
|
||||
[[nodiscard]]
|
||||
inline const std::function<void(const std::vector<Rendition>& /* value */)>& getFunction() const {
|
||||
return _func;
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_std__vector_Rendition__cxx;";
|
||||
static void registerNatives() {
|
||||
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__vector_Rendition__cxx::invoke_cxx)});
|
||||
}
|
||||
|
||||
private:
|
||||
explicit JFunc_void_std__vector_Rendition__cxx(const std::function<void(const std::vector<Rendition>& /* value */)>& func): _func(func) { }
|
||||
|
||||
private:
|
||||
friend HybridBase;
|
||||
std::function<void(const std::vector<Rendition>& /* value */)> _func;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
@@ -0,0 +1,98 @@
|
||||
///
|
||||
/// JFunc_void_std__vector_Track_.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <functional>
|
||||
|
||||
#include "Track.hpp"
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <NitroModules/JNICallable.hpp>
|
||||
#include "JTrack.hpp"
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
/**
|
||||
* Represents the Java/Kotlin callback `(value: Array<Track>) -> Unit`.
|
||||
* This can be passed around between C++ and Java/Kotlin.
|
||||
*/
|
||||
struct JFunc_void_std__vector_Track_: public jni::JavaClass<JFunc_void_std__vector_Track_> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_std__vector_Track_;";
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the function this `JFunc_void_std__vector_Track_` instance holds through JNI.
|
||||
*/
|
||||
void invoke(const std::vector<Track>& value) const {
|
||||
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<JTrack>> /* value */)>("invoke");
|
||||
method(self(), [&](auto&& __input) {
|
||||
size_t __size = __input.size();
|
||||
jni::local_ref<jni::JArrayClass<JTrack>> __array = jni::JArrayClass<JTrack>::newArray(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
const auto& __element = __input[__i];
|
||||
auto __elementJni = JTrack::fromCpp(__element);
|
||||
__array->setElement(__i, *__elementJni);
|
||||
}
|
||||
return __array;
|
||||
}(value));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An implementation of Func_void_std__vector_Track_ that is backed by a C++ implementation (using `std::function<...>`)
|
||||
*/
|
||||
class JFunc_void_std__vector_Track__cxx final: public jni::HybridClass<JFunc_void_std__vector_Track__cxx, JFunc_void_std__vector_Track_> {
|
||||
public:
|
||||
static jni::local_ref<JFunc_void_std__vector_Track_::javaobject> fromCpp(const std::function<void(const std::vector<Track>& /* value */)>& func) {
|
||||
return JFunc_void_std__vector_Track__cxx::newObjectCxxArgs(func);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Invokes the C++ `std::function<...>` this `JFunc_void_std__vector_Track__cxx` instance holds.
|
||||
*/
|
||||
void invoke_cxx(jni::alias_ref<jni::JArrayClass<JTrack>> value) {
|
||||
_func([&](auto&& __input) {
|
||||
size_t __size = __input->size();
|
||||
std::vector<Track> __vector;
|
||||
__vector.reserve(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
auto __element = __input->getElement(__i);
|
||||
__vector.push_back(__element->toCpp());
|
||||
}
|
||||
return __vector;
|
||||
}(value));
|
||||
}
|
||||
|
||||
public:
|
||||
[[nodiscard]]
|
||||
inline const std::function<void(const std::vector<Track>& /* value */)>& getFunction() const {
|
||||
return _func;
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/Func_void_std__vector_Track__cxx;";
|
||||
static void registerNatives() {
|
||||
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__vector_Track__cxx::invoke_cxx)});
|
||||
}
|
||||
|
||||
private:
|
||||
explicit JFunc_void_std__vector_Track__cxx(const std::function<void(const std::vector<Track>& /* value */)>& func): _func(func) { }
|
||||
|
||||
private:
|
||||
friend HybridBase;
|
||||
std::function<void(const std::vector<Track>& /* value */)> _func;
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
+26
-4
@@ -25,6 +25,8 @@ namespace margelo::nitro::omni { struct Subtitle; }
|
||||
namespace margelo::nitro::omni { struct Metadata; }
|
||||
// Forward declaration of `MixAudioMode` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { enum class MixAudioMode; }
|
||||
// Forward declaration of `TrackProperty` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { enum class TrackProperty; }
|
||||
// Forward declaration of `Track` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Track; }
|
||||
// Forward declaration of `Rendition` to properly resolve imports.
|
||||
@@ -59,16 +61,20 @@ namespace margelo::nitro::omni { struct Rendition; }
|
||||
#include "JMetadata.hpp"
|
||||
#include "MixAudioMode.hpp"
|
||||
#include "JMixAudioMode.hpp"
|
||||
#include "TrackProperty.hpp"
|
||||
#include "JTrackProperty.hpp"
|
||||
#include "Track.hpp"
|
||||
#include "JFunc_void_std__vector_Track_.hpp"
|
||||
#include "JTrack.hpp"
|
||||
#include "Rendition.hpp"
|
||||
#include "JFunc_void_std__vector_Rendition_.hpp"
|
||||
#include "JRendition.hpp"
|
||||
#include "JFunc_void.hpp"
|
||||
#include "JFunc_void_std__string_std__string.hpp"
|
||||
#include "JFunc_void_std__string.hpp"
|
||||
#include "Track.hpp"
|
||||
#include "JFunc_void_Track.hpp"
|
||||
#include "JTrack.hpp"
|
||||
#include "JFunc_void_std__optional_Track_.hpp"
|
||||
#include "Rendition.hpp"
|
||||
#include "JFunc_void_Rendition.hpp"
|
||||
#include "JRendition.hpp"
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
@@ -143,6 +149,22 @@ namespace margelo::nitro::omni {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__optional_Source_::javaobject> /* cb */)>("removeSourceListener_cxx");
|
||||
method(_javaPart, JFunc_void_std__optional_Source__cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::addTracksListener(TrackProperty key, const std::function<void(const std::vector<Track>& /* value */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JTrackProperty> /* key */, jni::alias_ref<JFunc_void_std__vector_Track_::javaobject> /* cb */)>("addTracksListener_cxx");
|
||||
method(_javaPart, JTrackProperty::fromCpp(key), JFunc_void_std__vector_Track__cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::removeTracksListener(TrackProperty key, const std::function<void(const std::vector<Track>& /* value */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JTrackProperty> /* key */, jni::alias_ref<JFunc_void_std__vector_Track_::javaobject> /* cb */)>("removeTracksListener_cxx");
|
||||
method(_javaPart, JTrackProperty::fromCpp(key), JFunc_void_std__vector_Track__cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::addRenditionsListener(const std::function<void(const std::vector<Rendition>& /* value */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__vector_Rendition_::javaobject> /* cb */)>("addRenditionsListener_cxx");
|
||||
method(_javaPart, JFunc_void_std__vector_Rendition__cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::removeRenditionsListener(const std::function<void(const std::vector<Rendition>& /* value */)>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__vector_Rendition_::javaobject> /* cb */)>("removeRenditionsListener_cxx");
|
||||
method(_javaPart, JFunc_void_std__vector_Rendition__cxx::fromCpp(cb));
|
||||
}
|
||||
void JHybridOmniEventMapSpec::addOnEndListener(const std::function<void()>& cb) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* cb */)>("addOnEndListener_cxx");
|
||||
method(_javaPart, JFunc_void_cxx::fromCpp(cb));
|
||||
|
||||
@@ -64,6 +64,10 @@ namespace margelo::nitro::omni {
|
||||
void removeCastStatusListener(const std::function<void(CastStatus /* value */)>& cb) override;
|
||||
void addSourceListener(const std::function<void(const std::optional<Source>& /* value */)>& cb) override;
|
||||
void removeSourceListener(const std::function<void(const std::optional<Source>& /* value */)>& cb) override;
|
||||
void addTracksListener(TrackProperty key, const std::function<void(const std::vector<Track>& /* value */)>& cb) override;
|
||||
void removeTracksListener(TrackProperty key, const std::function<void(const std::vector<Track>& /* value */)>& cb) override;
|
||||
void addRenditionsListener(const std::function<void(const std::vector<Rendition>& /* value */)>& cb) override;
|
||||
void removeRenditionsListener(const std::function<void(const std::vector<Rendition>& /* value */)>& cb) override;
|
||||
void addOnEndListener(const std::function<void()>& cb) override;
|
||||
void removeOnEndListener(const std::function<void()>& cb) override;
|
||||
void addOnPrevListener(const std::function<void()>& cb) override;
|
||||
|
||||
+66
-66
@@ -9,10 +9,6 @@
|
||||
|
||||
// Forward declaration of `HybridOmniEventMapSpec` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { class HybridOmniEventMapSpec; }
|
||||
// Forward declaration of `Track` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Track; }
|
||||
// Forward declaration of `Rendition` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Rendition; }
|
||||
// Forward declaration of `Source` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Source; }
|
||||
// Forward declaration of `VideoSrc` to properly resolve imports.
|
||||
@@ -27,23 +23,23 @@ namespace margelo::nitro::omni { enum class MixAudioMode; }
|
||||
namespace margelo::nitro::omni { enum class PlayerStatus; }
|
||||
// Forward declaration of `CastStatus` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { enum class CastStatus; }
|
||||
// Forward declaration of `Track` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Track; }
|
||||
// Forward declaration of `Rendition` to properly resolve imports.
|
||||
namespace margelo::nitro::omni { struct Rendition; }
|
||||
|
||||
#include <memory>
|
||||
#include "HybridOmniEventMapSpec.hpp"
|
||||
#include "JHybridOmniEventMapSpec.hpp"
|
||||
#include <optional>
|
||||
#include "Track.hpp"
|
||||
#include <vector>
|
||||
#include "JTrack.hpp"
|
||||
#include <string>
|
||||
#include "Rendition.hpp"
|
||||
#include "JRendition.hpp"
|
||||
#include "Source.hpp"
|
||||
#include "JSource.hpp"
|
||||
#include "VideoSrc.hpp"
|
||||
#include "JVideoSrc.hpp"
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include "Subtitle.hpp"
|
||||
#include <vector>
|
||||
#include "JSubtitle.hpp"
|
||||
#include "Metadata.hpp"
|
||||
#include "JMetadata.hpp"
|
||||
@@ -53,6 +49,10 @@ namespace margelo::nitro::omni { enum class CastStatus; }
|
||||
#include "JPlayerStatus.hpp"
|
||||
#include "CastStatus.hpp"
|
||||
#include "JCastStatus.hpp"
|
||||
#include "Track.hpp"
|
||||
#include "JTrack.hpp"
|
||||
#include "Rendition.hpp"
|
||||
#include "JRendition.hpp"
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
@@ -108,62 +108,6 @@ namespace margelo::nitro::omni {
|
||||
auto __result = method(_javaPart);
|
||||
return static_cast<bool>(__result);
|
||||
}
|
||||
std::vector<Track> JHybridOmniPlayerSpec::getVideos() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JTrack>>()>("getVideos");
|
||||
auto __result = method(_javaPart);
|
||||
return [&](auto&& __input) {
|
||||
size_t __size = __input->size();
|
||||
std::vector<Track> __vector;
|
||||
__vector.reserve(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
auto __element = __input->getElement(__i);
|
||||
__vector.push_back(__element->toCpp());
|
||||
}
|
||||
return __vector;
|
||||
}(__result);
|
||||
}
|
||||
std::vector<Track> JHybridOmniPlayerSpec::getAudios() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JTrack>>()>("getAudios");
|
||||
auto __result = method(_javaPart);
|
||||
return [&](auto&& __input) {
|
||||
size_t __size = __input->size();
|
||||
std::vector<Track> __vector;
|
||||
__vector.reserve(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
auto __element = __input->getElement(__i);
|
||||
__vector.push_back(__element->toCpp());
|
||||
}
|
||||
return __vector;
|
||||
}(__result);
|
||||
}
|
||||
std::vector<Track> JHybridOmniPlayerSpec::getSubtitles() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JTrack>>()>("getSubtitles");
|
||||
auto __result = method(_javaPart);
|
||||
return [&](auto&& __input) {
|
||||
size_t __size = __input->size();
|
||||
std::vector<Track> __vector;
|
||||
__vector.reserve(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
auto __element = __input->getElement(__i);
|
||||
__vector.push_back(__element->toCpp());
|
||||
}
|
||||
return __vector;
|
||||
}(__result);
|
||||
}
|
||||
std::vector<Rendition> JHybridOmniPlayerSpec::getRendition() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JRendition>>()>("getRendition");
|
||||
auto __result = method(_javaPart);
|
||||
return [&](auto&& __input) {
|
||||
size_t __size = __input->size();
|
||||
std::vector<Rendition> __vector;
|
||||
__vector.reserve(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
auto __element = __input->getElement(__i);
|
||||
__vector.push_back(__element->toCpp());
|
||||
}
|
||||
return __vector;
|
||||
}(__result);
|
||||
}
|
||||
std::optional<Source> JHybridOmniPlayerSpec::getSource() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JSource>()>("getSource");
|
||||
auto __result = method(_javaPart);
|
||||
@@ -239,6 +183,62 @@ namespace margelo::nitro::omni {
|
||||
auto __result = method(_javaPart);
|
||||
return __result->toCpp();
|
||||
}
|
||||
std::vector<Track> JHybridOmniPlayerSpec::getVideos() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JTrack>>()>("getVideos");
|
||||
auto __result = method(_javaPart);
|
||||
return [&](auto&& __input) {
|
||||
size_t __size = __input->size();
|
||||
std::vector<Track> __vector;
|
||||
__vector.reserve(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
auto __element = __input->getElement(__i);
|
||||
__vector.push_back(__element->toCpp());
|
||||
}
|
||||
return __vector;
|
||||
}(__result);
|
||||
}
|
||||
std::vector<Track> JHybridOmniPlayerSpec::getAudios() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JTrack>>()>("getAudios");
|
||||
auto __result = method(_javaPart);
|
||||
return [&](auto&& __input) {
|
||||
size_t __size = __input->size();
|
||||
std::vector<Track> __vector;
|
||||
__vector.reserve(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
auto __element = __input->getElement(__i);
|
||||
__vector.push_back(__element->toCpp());
|
||||
}
|
||||
return __vector;
|
||||
}(__result);
|
||||
}
|
||||
std::vector<Track> JHybridOmniPlayerSpec::getSubtitles() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JTrack>>()>("getSubtitles");
|
||||
auto __result = method(_javaPart);
|
||||
return [&](auto&& __input) {
|
||||
size_t __size = __input->size();
|
||||
std::vector<Track> __vector;
|
||||
__vector.reserve(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
auto __element = __input->getElement(__i);
|
||||
__vector.push_back(__element->toCpp());
|
||||
}
|
||||
return __vector;
|
||||
}(__result);
|
||||
}
|
||||
std::vector<Rendition> JHybridOmniPlayerSpec::getRenditions() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JRendition>>()>("getRenditions");
|
||||
auto __result = method(_javaPart);
|
||||
return [&](auto&& __input) {
|
||||
size_t __size = __input->size();
|
||||
std::vector<Rendition> __vector;
|
||||
__vector.reserve(__size);
|
||||
for (size_t __i = 0; __i < __size; __i++) {
|
||||
auto __element = __input->getElement(__i);
|
||||
__vector.push_back(__element->toCpp());
|
||||
}
|
||||
return __vector;
|
||||
}(__result);
|
||||
}
|
||||
|
||||
// Methods
|
||||
void JHybridOmniPlayerSpec::play() {
|
||||
|
||||
+4
-4
@@ -55,10 +55,6 @@ namespace margelo::nitro::omni {
|
||||
void setShowNotification(std::optional<bool> showNotification) override;
|
||||
bool getHasPrev() override;
|
||||
bool getHasNext() override;
|
||||
std::vector<Track> getVideos() override;
|
||||
std::vector<Track> getAudios() override;
|
||||
std::vector<Track> getSubtitles() override;
|
||||
std::vector<Rendition> getRendition() override;
|
||||
std::optional<Source> getSource() override;
|
||||
void setSource(const std::optional<Source>& source) override;
|
||||
PlayerStatus getStatus() override;
|
||||
@@ -75,6 +71,10 @@ namespace margelo::nitro::omni {
|
||||
void setMuted(bool muted) override;
|
||||
bool getIsAutoQuality() override;
|
||||
CastStatus getCastStatus() override;
|
||||
std::vector<Track> getVideos() override;
|
||||
std::vector<Track> getAudios() override;
|
||||
std::vector<Track> getSubtitles() override;
|
||||
std::vector<Rendition> getRenditions() override;
|
||||
|
||||
public:
|
||||
// Methods
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
///
|
||||
/// JTrackProperty.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fbjni/fbjni.h>
|
||||
#include "TrackProperty.hpp"
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
/**
|
||||
* The C++ JNI bridge between the C++ enum "TrackProperty" and the Kotlin enum "TrackProperty".
|
||||
*/
|
||||
struct JTrackProperty final: public jni::JavaClass<JTrackProperty> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/TrackProperty;";
|
||||
|
||||
public:
|
||||
/**
|
||||
* Convert this Java/Kotlin-based enum to the C++ enum TrackProperty.
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
[[nodiscard]]
|
||||
TrackProperty toCpp() const {
|
||||
static const auto clazz = javaClassStatic();
|
||||
static const auto fieldOrdinal = clazz->getField<int>("value");
|
||||
int ordinal = this->getFieldValue(fieldOrdinal);
|
||||
return static_cast<TrackProperty>(ordinal);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
static jni::alias_ref<JTrackProperty> fromCpp(TrackProperty value) {
|
||||
static const auto clazz = javaClassStatic();
|
||||
switch (value) {
|
||||
case TrackProperty::VIDEOS:
|
||||
static const auto fieldVIDEOS = clazz->getStaticField<JTrackProperty>("VIDEOS");
|
||||
return clazz->getStaticFieldValue(fieldVIDEOS);
|
||||
case TrackProperty::AUDIOS:
|
||||
static const auto fieldAUDIOS = clazz->getStaticField<JTrackProperty>("AUDIOS");
|
||||
return clazz->getStaticFieldValue(fieldAUDIOS);
|
||||
case TrackProperty::SUBTITLES:
|
||||
static const auto fieldSUBTITLES = clazz->getStaticField<JTrackProperty>("SUBTITLES");
|
||||
return clazz->getStaticFieldValue(fieldSUBTITLES);
|
||||
default:
|
||||
std::string stringValue = std::to_string(static_cast<int>(value));
|
||||
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
Generated
+80
@@ -0,0 +1,80 @@
|
||||
///
|
||||
/// Func_void_std__vector_Rendition_.kt
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
package com.margelo.nitro.omni
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.facebook.jni.HybridData
|
||||
import com.facebook.proguard.annotations.DoNotStrip
|
||||
import dalvik.annotation.optimization.FastNative
|
||||
|
||||
|
||||
/**
|
||||
* Represents the JavaScript callback `(value: array) => void`.
|
||||
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
||||
* or in Kotlin/Java (in which case it is a native callback).
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
@Suppress("ClassName", "RedundantUnitReturnType")
|
||||
fun interface Func_void_std__vector_Rendition_: (Array<Rendition>) -> Unit {
|
||||
/**
|
||||
* Call the given JS callback.
|
||||
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
override fun invoke(value: Array<Rendition>): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the JavaScript callback `(value: array) => void`.
|
||||
* This is implemented in C++, via a `std::function<...>`.
|
||||
* The callback might be coming from JS.
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
@Suppress(
|
||||
"KotlinJniMissingFunction", "unused",
|
||||
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
||||
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
||||
)
|
||||
class Func_void_std__vector_Rendition__cxx: Func_void_std__vector_Rendition_ {
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
private val mHybridData: HybridData
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
private constructor(hybridData: HybridData) {
|
||||
mHybridData = hybridData
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
override fun invoke(value: Array<Rendition>): Unit
|
||||
= invoke_cxx(value)
|
||||
|
||||
@FastNative
|
||||
private external fun invoke_cxx(value: Array<Rendition>): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the JavaScript callback `(value: array) => void`.
|
||||
* This is implemented in Java/Kotlin, via a `(Array<Rendition>) -> Unit`.
|
||||
* The callback is always coming from native.
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
||||
class Func_void_std__vector_Rendition__java(private val function: (Array<Rendition>) -> Unit): Func_void_std__vector_Rendition_ {
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
override fun invoke(value: Array<Rendition>): Unit {
|
||||
return this.function(value)
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
///
|
||||
/// Func_void_std__vector_Track_.kt
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
package com.margelo.nitro.omni
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.facebook.jni.HybridData
|
||||
import com.facebook.proguard.annotations.DoNotStrip
|
||||
import dalvik.annotation.optimization.FastNative
|
||||
|
||||
|
||||
/**
|
||||
* Represents the JavaScript callback `(value: array) => void`.
|
||||
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
||||
* or in Kotlin/Java (in which case it is a native callback).
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
@Suppress("ClassName", "RedundantUnitReturnType")
|
||||
fun interface Func_void_std__vector_Track_: (Array<Track>) -> Unit {
|
||||
/**
|
||||
* Call the given JS callback.
|
||||
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
override fun invoke(value: Array<Track>): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the JavaScript callback `(value: array) => void`.
|
||||
* This is implemented in C++, via a `std::function<...>`.
|
||||
* The callback might be coming from JS.
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
@Suppress(
|
||||
"KotlinJniMissingFunction", "unused",
|
||||
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
||||
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
||||
)
|
||||
class Func_void_std__vector_Track__cxx: Func_void_std__vector_Track_ {
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
private val mHybridData: HybridData
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
private constructor(hybridData: HybridData) {
|
||||
mHybridData = hybridData
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
override fun invoke(value: Array<Track>): Unit
|
||||
= invoke_cxx(value)
|
||||
|
||||
@FastNative
|
||||
private external fun invoke_cxx(value: Array<Track>): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the JavaScript callback `(value: array) => void`.
|
||||
* This is implemented in Java/Kotlin, via a `(Array<Track>) -> Unit`.
|
||||
* The callback is always coming from native.
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
||||
class Func_void_std__vector_Track__java(private val function: (Array<Track>) -> Unit): Func_void_std__vector_Track_ {
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
override fun invoke(value: Array<Track>): Unit {
|
||||
return this.function(value)
|
||||
}
|
||||
}
|
||||
+36
@@ -118,6 +118,42 @@ abstract class HybridOmniEventMapSpec: HybridObject() {
|
||||
return __result
|
||||
}
|
||||
|
||||
abstract fun addTracksListener(key: TrackProperty, cb: (value: Array<Track>) -> Unit): Unit
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
private fun addTracksListener_cxx(key: TrackProperty, cb: Func_void_std__vector_Track_): Unit {
|
||||
val __result = addTracksListener(key, cb)
|
||||
return __result
|
||||
}
|
||||
|
||||
abstract fun removeTracksListener(key: TrackProperty, cb: (value: Array<Track>) -> Unit): Unit
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
private fun removeTracksListener_cxx(key: TrackProperty, cb: Func_void_std__vector_Track_): Unit {
|
||||
val __result = removeTracksListener(key, cb)
|
||||
return __result
|
||||
}
|
||||
|
||||
abstract fun addRenditionsListener(cb: (value: Array<Rendition>) -> Unit): Unit
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
private fun addRenditionsListener_cxx(cb: Func_void_std__vector_Rendition_): Unit {
|
||||
val __result = addRenditionsListener(cb)
|
||||
return __result
|
||||
}
|
||||
|
||||
abstract fun removeRenditionsListener(cb: (value: Array<Rendition>) -> Unit): Unit
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
private fun removeRenditionsListener_cxx(cb: Func_void_std__vector_Rendition_): Unit {
|
||||
val __result = removeRenditionsListener(cb)
|
||||
return __result
|
||||
}
|
||||
|
||||
abstract fun addOnEndListener(cb: () -> Unit): Unit
|
||||
|
||||
@DoNotStrip
|
||||
|
||||
+16
-16
@@ -43,22 +43,6 @@ abstract class HybridOmniPlayerSpec: HybridObject() {
|
||||
@get:Keep
|
||||
abstract val hasNext: Boolean
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
abstract val videos: Array<Track>
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
abstract val audios: Array<Track>
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
abstract val subtitles: Array<Track>
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
abstract val rendition: Array<Rendition>
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
@set:DoNotStrip
|
||||
@@ -112,6 +96,22 @@ abstract class HybridOmniPlayerSpec: HybridObject() {
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
abstract val castStatus: CastStatus
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
abstract val videos: Array<Track>
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
abstract val audios: Array<Track>
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
abstract val subtitles: Array<Track>
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
abstract val renditions: Array<Rendition>
|
||||
|
||||
// Methods
|
||||
@DoNotStrip
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
///
|
||||
/// TrackProperty.kt
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
package com.margelo.nitro.omni
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.facebook.proguard.annotations.DoNotStrip
|
||||
|
||||
/**
|
||||
* Represents the JavaScript enum/union "TrackProperty".
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
enum class TrackProperty(@DoNotStrip @Keep val value: Int) {
|
||||
VIDEOS(0),
|
||||
AUDIOS(1),
|
||||
SUBTITLES(2);
|
||||
|
||||
companion object
|
||||
}
|
||||
Reference in New Issue
Block a user