feat: Use JSI's ArrayBuffer instead of TypedArray (#2408)
				
					
				
			* feat: Use JSI's `ArrayBuffer` instead of `TypedArray` * fix: Fix move memory * feat: Implement iOS * Format * Update JSIJNIConversion.cpp * fix: Fix Android `toArrayBuffer` and other * Catch FP call errors * Update return type * Use `CPU_READ_OFTEN` flag as well * CPU flag * Run destructors under `jni::ThreadScope` * Update FrameProcessorPluginHostObject.cpp * fix: Fix `toArrayBuffer()` crash * Update Frame.ts
This commit is contained in:
		
							
								
								
									
										36
									
								
								package/cpp/MutableRawBuffer.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								package/cpp/MutableRawBuffer.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| // | ||||
| //  MutableRawBuffer.h | ||||
| //  VisionCamera | ||||
| // | ||||
| //  Created by Marc Rousavy on 17.01.24. | ||||
| //  Copyright © 2024 mrousavy. All rights reserved. | ||||
| // | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #include <functional> | ||||
| #include <jsi/jsi.h> | ||||
| #include <memory> | ||||
|  | ||||
| namespace vision { | ||||
|  | ||||
| using namespace facebook; | ||||
|  | ||||
| class MutableRawBuffer : public jsi::MutableBuffer { | ||||
|  | ||||
| public: | ||||
|   explicit MutableRawBuffer(size_t size); | ||||
|   explicit MutableRawBuffer(uint8_t* data, size_t size, std::function<void()> cleanup); | ||||
|   ~MutableRawBuffer(); | ||||
|  | ||||
| public: | ||||
|   uint8_t* data() override; | ||||
|   size_t size() const override; | ||||
|  | ||||
| private: | ||||
|   uint8_t* _data; | ||||
|   size_t _size; | ||||
|   std::function<void()> _cleanup; | ||||
| }; | ||||
|  | ||||
| } // namespace vision | ||||
		Reference in New Issue
	
	Block a user