2023-07-21 09:52:30 -06:00
|
|
|
//
|
|
|
|
// VisionCameraProxy.h
|
|
|
|
// VisionCamera
|
|
|
|
//
|
|
|
|
// Created by Marc Rousavy on 20.07.23.
|
|
|
|
// Copyright © 2023 mrousavy. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import <React/RCTBridge.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#import "WKTJsiWorkletContext.h"
|
|
|
|
#import <ReactCommon/CallInvoker.h>
|
2023-09-01 04:58:32 -06:00
|
|
|
#import <jsi/jsi.h>
|
2023-07-21 09:52:30 -06:00
|
|
|
|
|
|
|
using namespace facebook;
|
|
|
|
|
2023-09-01 04:58:32 -06:00
|
|
|
class VisionCameraProxy : public jsi::HostObject {
|
2023-07-21 09:52:30 -06:00
|
|
|
public:
|
2023-09-01 11:39:25 -06:00
|
|
|
explicit VisionCameraProxy(jsi::Runtime& runtime, std::shared_ptr<react::CallInvoker> callInvoker);
|
2023-07-21 09:52:30 -06:00
|
|
|
~VisionCameraProxy();
|
|
|
|
|
|
|
|
public:
|
|
|
|
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override;
|
|
|
|
jsi::Value get(jsi::Runtime& runtime, const jsi::PropNameID& name) override;
|
|
|
|
|
2024-01-12 08:00:36 -07:00
|
|
|
jsi::Runtime& getWorkletRuntime() {
|
|
|
|
return _workletContext->getWorkletRuntime();
|
|
|
|
}
|
|
|
|
|
2023-07-21 09:52:30 -06:00
|
|
|
private:
|
|
|
|
void setFrameProcessor(jsi::Runtime& runtime, int viewTag, const jsi::Object& frameProcessor);
|
|
|
|
void removeFrameProcessor(jsi::Runtime& runtime, int viewTag);
|
2023-10-19 03:19:47 -06:00
|
|
|
jsi::Value initFrameProcessorPlugin(jsi::Runtime& runtime, std::string name, const jsi::Object& options);
|
2023-07-21 09:52:30 -06:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::shared_ptr<RNWorklet::JsiWorkletContext> _workletContext;
|
|
|
|
std::shared_ptr<react::CallInvoker> _callInvoker;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2024-01-16 12:02:03 -07:00
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
2024-01-12 08:00:36 -07:00
|
|
|
@interface VisionCameraProxyHolder : NSObject
|
|
|
|
|
2024-01-16 12:02:03 -07:00
|
|
|
- (_Nonnull instancetype)initWithProxy:(void*)proxy;
|
2024-01-12 08:00:36 -07:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2024-01-16 12:02:03 -07:00
|
|
|
- (VisionCameraProxy*)proxy;
|
2024-01-12 08:00:36 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2023-07-21 09:52:30 -06:00
|
|
|
@interface VisionCameraInstaller : NSObject
|
2024-01-12 08:00:36 -07:00
|
|
|
|
2024-01-16 12:02:03 -07:00
|
|
|
+ (BOOL)installToBridge:(RCTBridge*)bridge;
|
2024-01-12 08:00:36 -07:00
|
|
|
|
2023-07-21 09:52:30 -06:00
|
|
|
@end
|
2024-01-16 12:02:03 -07:00
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|