mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-16 02:44:51 +00:00
feat(android): allow both exoplayer and vlc
This commit is contained in:
+59
@@ -0,0 +1,59 @@
|
||||
///
|
||||
/// JPlayerBackend.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 "PlayerBackend.hpp"
|
||||
|
||||
#include "AndroidBackend.hpp"
|
||||
#include "JAndroidBackend.hpp"
|
||||
#include <optional>
|
||||
|
||||
namespace margelo::nitro::omni {
|
||||
|
||||
using namespace facebook;
|
||||
|
||||
/**
|
||||
* The C++ JNI bridge between the C++ struct "PlayerBackend" and the Kotlin data class "PlayerBackend".
|
||||
*/
|
||||
struct JPlayerBackend final: public jni::JavaClass<JPlayerBackend> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/omni/PlayerBackend;";
|
||||
|
||||
public:
|
||||
/**
|
||||
* Convert this Java/Kotlin-based struct to the C++ struct PlayerBackend by copying all values to C++.
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
[[nodiscard]]
|
||||
PlayerBackend toCpp() const {
|
||||
static const auto clazz = javaClassStatic();
|
||||
static const auto fieldAndroid = clazz->getField<JAndroidBackend>("android");
|
||||
jni::local_ref<JAndroidBackend> android = this->getFieldValue(fieldAndroid);
|
||||
return PlayerBackend(
|
||||
android != nullptr ? std::make_optional(android->toCpp()) : std::nullopt
|
||||
);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
static jni::local_ref<JPlayerBackend::javaobject> fromCpp(const PlayerBackend& value) {
|
||||
using JSignature = JPlayerBackend(jni::alias_ref<JAndroidBackend>);
|
||||
static const auto clazz = javaClassStatic();
|
||||
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
||||
return create(
|
||||
clazz,
|
||||
value.android.has_value() ? JAndroidBackend::fromCpp(value.android.value()) : nullptr
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::omni
|
||||
Reference in New Issue
Block a user