perf: Remove FrameProcessorPlugin HybridClass (#467)
* Rename `JImageProxyHostObject` -> `FrameHostObject` * `FrameProcessorPlugin` -> `JFrameProcessorPlugin` 1/2 * `FrameProcessorPlugin` -> `JFrameProcessorPlugin` 2/2 * Make `const` * Make `getName()` instance based * Update JFrameProcessorPlugin.h * Update JImageProxy.h * `T` * T * Remove default ctor * Use `TSelf` again * Return `local_ref<CameraView*>` instead of `CameraView*` * Make `findCameraViewById` return a raw pointer again... * Extract `setFrameProcessor` and `unsetFrameProcessor` * Use `global_ref` * Use `static_cast` for `FrameHostObject` * Update FrameProcessorRuntimeManager.cpp * Fix reference lint error * linelength * Fix `unsetFrameProcessor` call
This commit is contained in:
30
android/src/main/cpp/java-bindings/JFrameProcessorPlugin.cpp
Normal file
30
android/src/main/cpp/java-bindings/JFrameProcessorPlugin.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// Created by Marc Rousavy on 29.09.21.
|
||||
//
|
||||
|
||||
#include "JFrameProcessorPlugin.h"
|
||||
|
||||
#include <jni.h>
|
||||
#include <fbjni/fbjni.h>
|
||||
|
||||
namespace vision {
|
||||
|
||||
using namespace facebook;
|
||||
using namespace jni;
|
||||
|
||||
using TCallback = jobject(alias_ref<JImageProxy::javaobject>, alias_ref<JArrayClass<jobject>>);
|
||||
|
||||
local_ref<jobject> JFrameProcessorPlugin::callback(alias_ref<JImageProxy::javaobject> image,
|
||||
alias_ref<JArrayClass<jobject>> params) const {
|
||||
auto callbackMethod = getClass()->getMethod<TCallback>("callback");
|
||||
|
||||
auto result = callbackMethod(self(), image, params);
|
||||
return make_local(result);
|
||||
}
|
||||
|
||||
std::string JFrameProcessorPlugin::getName() const {
|
||||
auto getNameMethod = getClass()->getMethod<jstring()>("getName");
|
||||
return getNameMethod(self())->toStdString();
|
||||
}
|
||||
|
||||
} // namespace vision
|
||||
Reference in New Issue
Block a user