react-native-vision-camera/ios/Frame Processor/FrameHostObject.h
Marc Rousavy 90f2a1ef7d
fix: Fix close being called on a collected reference (enforce alias_ref) (#379)
* fix: Fix `close` being called on a collected reference (enforce `alias_ref`)

* Remove `~FrameHostObject` on iOS too
2021-08-20 16:05:02 +02:00

32 lines
685 B
Objective-C

//
// FrameHostObject.h
// VisionCamera
//
// Created by Marc Rousavy on 22.03.21.
// Copyright © 2021 mrousavy. All rights reserved.
//
#pragma once
#import <jsi/jsi.h>
#import <CoreMedia/CMSampleBuffer.h>
#import "Frame.h"
using namespace facebook;
class JSI_EXPORT FrameHostObject: public jsi::HostObject {
public:
explicit FrameHostObject(Frame* frame): frame(frame) {}
public:
jsi::Value get(jsi::Runtime&, const jsi::PropNameID& name) override;
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& rt) override;
void close();
public:
Frame* frame;
private:
void assertIsFrameStrong(jsi::Runtime& runtime, const std::string& accessedPropName);
};