/// /// NativeVideoConfig.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © Marc Rousavy @ Margelo /// #pragma once #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif // Forward declaration of `NativeExternalSubtitle` to properly resolve imports. namespace margelo::nitro::video { struct NativeExternalSubtitle; } // Forward declaration of `NativeDrmParams` to properly resolve imports. namespace margelo::nitro::video { struct NativeDrmParams; } // Forward declaration of `BufferConfig` to properly resolve imports. namespace margelo::nitro::video { struct BufferConfig; } // Forward declaration of `CustomVideoMetadata` to properly resolve imports. namespace margelo::nitro::video { struct CustomVideoMetadata; } #include #include "NativeExternalSubtitle.hpp" #include #include #include "NativeDrmParams.hpp" #include #include "BufferConfig.hpp" #include "CustomVideoMetadata.hpp" namespace margelo::nitro::video { /** * A struct which can be represented as a JavaScript object (NativeVideoConfig). */ struct NativeVideoConfig final { public: std::string uri SWIFT_PRIVATE; std::optional> externalSubtitles SWIFT_PRIVATE; std::optional drm SWIFT_PRIVATE; std::optional> headers SWIFT_PRIVATE; std::optional bufferConfig SWIFT_PRIVATE; std::optional metadata SWIFT_PRIVATE; std::optional initializeOnCreation SWIFT_PRIVATE; public: NativeVideoConfig() = default; explicit NativeVideoConfig(std::string uri, std::optional> externalSubtitles, std::optional drm, std::optional> headers, std::optional bufferConfig, std::optional metadata, std::optional initializeOnCreation): uri(uri), externalSubtitles(externalSubtitles), drm(drm), headers(headers), bufferConfig(bufferConfig), metadata(metadata), initializeOnCreation(initializeOnCreation) {} public: // NativeVideoConfig is not equatable because these properties are not equatable: drm }; } // namespace margelo::nitro::video namespace margelo::nitro { // C++ NativeVideoConfig <> JS NativeVideoConfig (object) template <> struct JSIConverter final { static inline margelo::nitro::video::NativeVideoConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { jsi::Object obj = arg.asObject(runtime); return margelo::nitro::video::NativeVideoConfig( JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri"))), JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "externalSubtitles"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "drm"))), JSIConverter>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "headers"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bufferConfig"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "initializeOnCreation"))) ); } static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::video::NativeVideoConfig& arg) { jsi::Object obj(runtime); obj.setProperty(runtime, PropNameIDCache::get(runtime, "uri"), JSIConverter::toJSI(runtime, arg.uri)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "externalSubtitles"), JSIConverter>>::toJSI(runtime, arg.externalSubtitles)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "drm"), JSIConverter>::toJSI(runtime, arg.drm)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "headers"), JSIConverter>>::toJSI(runtime, arg.headers)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "bufferConfig"), JSIConverter>::toJSI(runtime, arg.bufferConfig)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter>::toJSI(runtime, arg.metadata)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "initializeOnCreation"), JSIConverter>::toJSI(runtime, arg.initializeOnCreation)); return obj; } static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { if (!value.isObject()) { return false; } jsi::Object obj = value.getObject(runtime); if (!nitro::isPlainObject(runtime, obj)) { return false; } if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri")))) return false; if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "externalSubtitles")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "drm")))) return false; if (!JSIConverter>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "headers")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bufferConfig")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "initializeOnCreation")))) return false; return true; } }; } // namespace margelo::nitro