feat(android): allow both exoplayer and vlc

This commit is contained in:
2026-07-26 13:26:56 +02:00
parent 7f733d8ef2
commit 6423ed0bc5
17 changed files with 418 additions and 21 deletions
+59
View File
@@ -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