fix: Rename getFrameProcessorPlugin
to initFrameProcessorPlugin
(#2038)
* fix: Rename `getFrameProcessorPlugin` to `initFrameProcessorPlugin` * fix: Make nullable, add comments * Format * Update FrameProcessorPlugin.java * Update FrameProcessorPlugin.h * fix: Fix dead links * Call super constructor * Update ExampleFrameProcessorPlugin.java * fix: Init calls
This commit is contained in:
@@ -7,25 +7,35 @@ import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Declares a Frame Processor Plugin.
|
||||
* The base class of a native Frame Processor Plugin.
|
||||
*
|
||||
* Subclass this to create a custom Frame Processor Plugin, which can be called from a JS Frame Processor.
|
||||
* Once subclassed, it needs to be registered in the VisionCamera Frame Processor
|
||||
* runtime via `FrameProcessorPluginRegistry.addFrameProcessorPlugin` - ideally at app startup.
|
||||
|
||||
* See: <a href="https://react-native-vision-camera.com/docs/guides/frame-processors-plugins-android">Creating Frame Processor Plugins (Android)</a>
|
||||
* for more information
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
public abstract class FrameProcessorPlugin {
|
||||
public FrameProcessorPlugin() {}
|
||||
|
||||
/**
|
||||
* The initializer for a Frame Processor Plugin class that takes optional object that consists
|
||||
* options passed from JS layer
|
||||
* The initializer of this Frame Processor Plugin.
|
||||
* This is called everytime this Frame Processor Plugin is loaded from the JS side (`initFrameProcessorPlugin(..)`).
|
||||
* Optionally override this method to implement custom initialization logic.
|
||||
* @param options An options dictionary passed from the JS side, or null if none.
|
||||
*/
|
||||
public FrameProcessorPlugin(@Nullable Map<String, Object> options) {}
|
||||
|
||||
/**
|
||||
* The actual Frame Processor plugin callback. Called for every frame the ImageAnalyzer receives.
|
||||
* The actual Frame Processor Plugin's implementation that runs when `plugin.call(..)` is called in the JS Frame Processor.
|
||||
* Implement your Frame Processing here, and keep in mind that this is a hot-path so optimize as good as possible.
|
||||
* See: <a href="https://react-native-vision-camera.com/docs/guides/frame-processors-tips#fast-frame-processor-plugins">Performance Tips</a>
|
||||
*
|
||||
* @param frame The Frame from the Camera. Don't call .close() on this, as VisionCamera handles that.
|
||||
* @return You can return any primitive, map or array you want. See the
|
||||
* <a href="https://react-native-vision-camera.com/docs/guides/frame-processors-plugins-overview#types">Types</a>
|
||||
* table for a list of supported types.
|
||||
* @return You can return any primitive, map or array you want.
|
||||
* See the <a href="https://react-native-vision-camera.com/docs/guides/frame-processors-plugins-overview#types">Types</a>
|
||||
* table for a list of supported types.
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
|
@@ -70,7 +70,7 @@ class VisionCameraProxy(context: ReactApplicationContext) {
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
fun getFrameProcessorPlugin(name: String, options: Map<String, Any>): FrameProcessorPlugin =
|
||||
fun initFrameProcessorPlugin(name: String, options: Map<String, Any>): FrameProcessorPlugin =
|
||||
FrameProcessorPluginRegistry.getPlugin(name, options)
|
||||
|
||||
// private C++ funcs
|
||||
|
Reference in New Issue
Block a user