mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-06-10 13:50:51 +00:00
135 lines
6.3 KiB
C++
Generated
135 lines
6.3 KiB
C++
Generated
///
|
|
/// JNativeVideoConfig.hpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#pragma once
|
|
|
|
#include <fbjni/fbjni.h>
|
|
#include "NativeVideoConfig.hpp"
|
|
|
|
#include "BufferConfig.hpp"
|
|
#include "CustomVideoMetadata.hpp"
|
|
#include "JBufferConfig.hpp"
|
|
#include "JCustomVideoMetadata.hpp"
|
|
#include "JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.hpp"
|
|
#include "JLivePlaybackParams.hpp"
|
|
#include "JNativeDrmParams.hpp"
|
|
#include "JNativeExternalSubtitle.hpp"
|
|
#include "JOnGetLicensePayload.hpp"
|
|
#include "JResolution.hpp"
|
|
#include "JSubtitleType.hpp"
|
|
#include "LivePlaybackParams.hpp"
|
|
#include "NativeDrmParams.hpp"
|
|
#include "NativeExternalSubtitle.hpp"
|
|
#include "OnGetLicensePayload.hpp"
|
|
#include "Resolution.hpp"
|
|
#include "SubtitleType.hpp"
|
|
#include <NitroModules/JPromise.hpp>
|
|
#include <NitroModules/Promise.hpp>
|
|
#include <functional>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
namespace margelo::nitro::video {
|
|
|
|
using namespace facebook;
|
|
|
|
/**
|
|
* The C++ JNI bridge between the C++ struct "NativeVideoConfig" and the the Kotlin data class "NativeVideoConfig".
|
|
*/
|
|
struct JNativeVideoConfig final: public jni::JavaClass<JNativeVideoConfig> {
|
|
public:
|
|
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/video/NativeVideoConfig;";
|
|
|
|
public:
|
|
/**
|
|
* Convert this Java/Kotlin-based struct to the C++ struct NativeVideoConfig by copying all values to C++.
|
|
*/
|
|
[[maybe_unused]]
|
|
[[nodiscard]]
|
|
NativeVideoConfig toCpp() const {
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto fieldUri = clazz->getField<jni::JString>("uri");
|
|
jni::local_ref<jni::JString> uri = this->getFieldValue(fieldUri);
|
|
static const auto fieldExternalSubtitles = clazz->getField<jni::JArrayClass<JNativeExternalSubtitle>>("externalSubtitles");
|
|
jni::local_ref<jni::JArrayClass<JNativeExternalSubtitle>> externalSubtitles = this->getFieldValue(fieldExternalSubtitles);
|
|
static const auto fieldDrm = clazz->getField<JNativeDrmParams>("drm");
|
|
jni::local_ref<JNativeDrmParams> drm = this->getFieldValue(fieldDrm);
|
|
static const auto fieldHeaders = clazz->getField<jni::JMap<jni::JString, jni::JString>>("headers");
|
|
jni::local_ref<jni::JMap<jni::JString, jni::JString>> headers = this->getFieldValue(fieldHeaders);
|
|
static const auto fieldBufferConfig = clazz->getField<JBufferConfig>("bufferConfig");
|
|
jni::local_ref<JBufferConfig> bufferConfig = this->getFieldValue(fieldBufferConfig);
|
|
static const auto fieldMetadata = clazz->getField<JCustomVideoMetadata>("metadata");
|
|
jni::local_ref<JCustomVideoMetadata> metadata = this->getFieldValue(fieldMetadata);
|
|
static const auto fieldInitializeOnCreation = clazz->getField<jni::JBoolean>("initializeOnCreation");
|
|
jni::local_ref<jni::JBoolean> initializeOnCreation = this->getFieldValue(fieldInitializeOnCreation);
|
|
return NativeVideoConfig(
|
|
uri->toStdString(),
|
|
externalSubtitles != nullptr ? std::make_optional([&]() {
|
|
size_t __size = externalSubtitles->size();
|
|
std::vector<NativeExternalSubtitle> __vector;
|
|
__vector.reserve(__size);
|
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
auto __element = externalSubtitles->getElement(__i);
|
|
__vector.push_back(__element->toCpp());
|
|
}
|
|
return __vector;
|
|
}()) : std::nullopt,
|
|
drm != nullptr ? std::make_optional(drm->toCpp()) : std::nullopt,
|
|
headers != nullptr ? std::make_optional([&]() {
|
|
std::unordered_map<std::string, std::string> __map;
|
|
__map.reserve(headers->size());
|
|
for (const auto& __entry : *headers) {
|
|
__map.emplace(__entry.first->toStdString(), __entry.second->toStdString());
|
|
}
|
|
return __map;
|
|
}()) : std::nullopt,
|
|
bufferConfig != nullptr ? std::make_optional(bufferConfig->toCpp()) : std::nullopt,
|
|
metadata != nullptr ? std::make_optional(metadata->toCpp()) : std::nullopt,
|
|
initializeOnCreation != nullptr ? std::make_optional(static_cast<bool>(initializeOnCreation->value())) : 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<JNativeVideoConfig::javaobject> fromCpp(const NativeVideoConfig& value) {
|
|
using JSignature = JNativeVideoConfig(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<JNativeExternalSubtitle>>, jni::alias_ref<JNativeDrmParams>, jni::alias_ref<jni::JMap<jni::JString, jni::JString>>, jni::alias_ref<JBufferConfig>, jni::alias_ref<JCustomVideoMetadata>, jni::alias_ref<jni::JBoolean>);
|
|
static const auto clazz = javaClassStatic();
|
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
return create(
|
|
clazz,
|
|
jni::make_jstring(value.uri),
|
|
value.externalSubtitles.has_value() ? [&]() {
|
|
size_t __size = value.externalSubtitles.value().size();
|
|
jni::local_ref<jni::JArrayClass<JNativeExternalSubtitle>> __array = jni::JArrayClass<JNativeExternalSubtitle>::newArray(__size);
|
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
const auto& __element = value.externalSubtitles.value()[__i];
|
|
__array->setElement(__i, *JNativeExternalSubtitle::fromCpp(__element));
|
|
}
|
|
return __array;
|
|
}() : nullptr,
|
|
value.drm.has_value() ? JNativeDrmParams::fromCpp(value.drm.value()) : nullptr,
|
|
value.headers.has_value() ? [&]() -> jni::local_ref<jni::JMap<jni::JString, jni::JString>> {
|
|
auto __map = jni::JHashMap<jni::JString, jni::JString>::create(value.headers.value().size());
|
|
for (const auto& __entry : value.headers.value()) {
|
|
__map->put(jni::make_jstring(__entry.first), jni::make_jstring(__entry.second));
|
|
}
|
|
return __map;
|
|
}() : nullptr,
|
|
value.bufferConfig.has_value() ? JBufferConfig::fromCpp(value.bufferConfig.value()) : nullptr,
|
|
value.metadata.has_value() ? JCustomVideoMetadata::fromCpp(value.metadata.value()) : nullptr,
|
|
value.initializeOnCreation.has_value() ? jni::JBoolean::valueOf(value.initializeOnCreation.value()) : nullptr
|
|
);
|
|
}
|
|
};
|
|
|
|
} // namespace margelo::nitro::video
|