Marc Rousavy 99fff446e5
fix: Fix calling multiple Plugins in a single Frame Processor ()
* fix: Fix JNI <-> JSI conversion for Integers

* Create another plugin and call them both serially

* Use inline formatter for `__android_log_write`

* Update FrameProcessorRuntimeManager.cpp

* Log plugin class type

* Use `pluginGlobal->cthis()`

* Log class name

* fix dumb error

* C++: Dynamically get JNI `javaPart_` class & method

* clean up PR
2021-09-24 10:19:30 +02:00

39 lines
1.0 KiB
C++

//
// Created by Marc Rousavy on 22.06.21.
//
#include "FrameProcessorPlugin.h"
#include <string>
namespace vision {
using namespace facebook;
using namespace jni;
using TSelf = local_ref<HybridClass<FrameProcessorPlugin>::jhybriddata>;
using TFrameProcessorPlugin = jobject(alias_ref<JImageProxy::javaobject>, alias_ref<JArrayClass<jobject>>);
TSelf vision::FrameProcessorPlugin::initHybrid(alias_ref<HybridClass::jhybridobject> jThis, const std::string& name) {
return makeCxxInstance(jThis, name);
}
void FrameProcessorPlugin::registerNatives() {
registerHybrid({
makeNativeMethod("initHybrid",
FrameProcessorPlugin::initHybrid),
});
}
local_ref<jobject> FrameProcessorPlugin::callback(alias_ref<JImageProxy::javaobject> image, alias_ref<JArrayClass<jobject>> params) {
auto func = javaPart_->getClass()->getMethod<TFrameProcessorPlugin>("callback");
auto result = func(javaPart_.get(), image, params);
return make_local(result);
}
std::string FrameProcessorPlugin::getName() {
return name;
}
} // namespace vision