Marc Rousavy
8bafd96c24
feat: Allow returning of ImageProxy in a Frame Processor ( #1149 )
...
* feat: Allow returning of ImageProxy in a Frame Processor
* chore: Clean up
* fix: Missing space
* Update useFrameProcessor.ts
* Revert "Update useFrameProcessor.ts"
This reverts commit 9c645489cdfdf2079972669756a2cd20cc81e25e.
2022-07-18 10:40:56 +02:00
davidlcorbitt
096b1cca4e
fix: (Android) Give real video resolutions, unbind/rebind preview in onHostResume, add missing Android capture errors ( #1079 )
...
* Calculate a format's video dimensions based on supported resolutions and photo dimensions
* Add Android fallback strategy for recording quality
* Ensure that session props are not ignored when app is resumed
* Simplify setting Android video dimensions in format
* Modify Android imageAnalysisBuilder to use photoSize
* Update onHostResume function to reference android preview issue
* Add missing Android capture errors
2022-06-14 10:54:33 +02:00
Menardi
3850491b9f
fix: Fix takeSnapshot not working on Android ( #961 )
...
Accessing previewView.bitmap was throwing an error because it wasn't being done on the main thread.
Any access to previewView needs to be done on the main (UI) thread. This commit fixes the issue by
ensuring this access is now run on the main thread.
Fixes #547
2022-04-04 11:03:08 +02:00
Menardi
fe01295226
fix: Fix Android focus not using correct focus point ( #958 )
...
This commit fixes #758 . I was having the same issue and looked into it a bit. I found
[this StackOverflow answer](https://stackoverflow.com/a/60585382 ) which described a
solution to the same problem. Rather than manually calculate the focus point, we can
get the PreviewView to do it for us. This fixes the issue because the PreviewView
factors in any scaling or resizing of the view on the screen, which we weren't doing
before. The only potential issue is that this needs to run on the UI thread
(which is what the `withContext` is doing), but I've tested it with frame processors
enabled and disabled, and have found no issues in either case.
2022-03-31 18:01:21 +02:00
Christopher Janietz
bea4aa8bb6
fix: Fix issue with resolving camera view in Modal ( #928 )
...
* Fix issue with resolving camera view from frame processor for react-native Modal
* Add missing import of UIManagerHelper
2022-03-28 13:22:27 +02:00
Marc Rousavy
8957d5fcb2
fix: Fix Reanimated build (AnimatedSensor.h
) ( #923 )
2022-03-22 10:49:57 +01:00
Marc Rousavy
4b9bcb37e0
feat: Add pauseRecording
and resumeRecording
🔥 ( #911 )
...
* feat: Add `pauseRecording` and `resumeRecording` (iOS)
* feat: Add `pauseRecording` and `resumeRecording` (Android)
* feat: Add `pauseRecording` and `resumeRecording` (JS)
* fix: Simplify Swift code for Recording
2022-03-22 10:44:58 +01:00
Marc Rousavy
a7d620cf22
chore(deps): Upgrade CameraX to beta02 ( #850 )
2022-02-28 11:51:50 +01:00
Joshua Smith
00fc39891a
fix: Fix duplicate libhermes.so package ( #741 )
...
Co-authored-by: Joshua Smith <joshua.smith4@aggiemail.usu.edu>
2022-01-14 09:54:33 +01:00
NilsKrause
202508b500
fix: Use ViewGroupManager instead of SimpleViewManager ( #735 )
2022-01-13 10:33:07 +01:00
Muhammad Aditya Hilmy
0ce01b9543
fix: Fix image rotated when flipped in Android ( #719 )
2022-01-11 11:52:50 +01:00
Marc Rousavy
0904767cf2
fix: Log Stacktrace on Frame Processor Error ( #731 )
...
* fix: Log JS Stack on Error
* Android
* Format Stacktrace better
* Update FrameProcessorUtils.mm
* Allow unapproved C++11 headers
* Use `.c_str()`
2022-01-10 16:37:47 +01:00
Marc Rousavy
48da1819fc
feat: Custom Orientation ( #715 )
...
* feat: Custom Orientation
* Update CameraView.swift
* Update CameraView.swift
* Try outputRotation approach
* whoops
* fix: Refactor `VideoCapture` instance
* Update orientation in didSetProps
* Update Orientation in iOS
* expose to objc
* Fix Orientation values
* format
2022-01-04 16:57:40 +01:00
Marc Rousavy
adb2115d3b
Update build.gradle
2022-01-04 08:49:46 +01:00
Marc Rousavy
675dec5ab3
fix: Resolve node_modules/
better ( #706 )
...
* fix: Use `rootDir` instead of `projectDir`
* Revert "fix: Use `rootDir` instead of `projectDir`"
This reverts commit 058e0a110bcf9b688e12a1cccbac2f23a29fa55c.
* fix: Find node_modules path where react-native/ lives
* fix: Figure out VisionCameraExample project
* Revert "fix: Figure out VisionCameraExample project"
This reverts commit 7ca455098244dd62280d40586062803d1ccc2c5f.
2022-01-03 13:18:38 +01:00
Marc Rousavy
1c09ded57e
chore: Log target JSI Runtime
2022-01-03 13:06:21 +01:00
Marc Rousavy
d2dbcdd09d
feat: Monorepo support ( #704 )
...
* fix: Find node_modules dynamically
* Update build.gradle
* Update build.gradle
* fix: Remove `findNodeModulePath` function
2022-01-03 12:23:19 +01:00
Marc Rousavy
fc4ed60f7c
fix: Fix REA detection to build Frame Processors ( #703 )
...
* fix: Fix REA detection
* fix: Detect REA v2 only
* cleanup logic
* Log whether Frame Processors are enabled or disabled
* Log warn instead of info
* use plugin.js to check
* log more precisely
* try ctor
* Revert "try ctor"
This reverts commit bb6110a119428451389d75896234a9935c48d75b.
* fix: Fix log order
* fix: Fix dumb boolean conversion. ffs.
* Update build.gradle
* fix: Remove `VisionCamera_disableFrameProcessors=false` flag
2022-01-03 11:54:32 +01:00
Marc Rousavy
1d27f6a06b
fix: Fix crash after Activity is destroyed
...
Fixes #664
2022-01-03 09:30:40 +01:00
Marc Rousavy
be5ec69b02
feat: Make Reanimated optional (disable Frame Processors if REA v2 is not installed) ( #412 )
...
* Fix building iOS without Reanimated
* Conditionally compile Frame Processors (gradle)
* Conditionally use externalNativeBuild
* Remove Reanimated import
* fix: Conditionally load REA/VisionCamera libraries
* fix: Add disable FP to docs
* fix: Fix dummy placeholder for Scheduler.mm
* fix: Fix dummy `Scheduler` declaration
* fix: Only init `CameraView` C++ side if frame processors are enabled
* fix: Install JSI Bindings on Frame Processor Manager ctor
* fix: Wrong conditional
* whoops
2022-01-02 17:35:26 +01:00
Marc Rousavy
77e065d961
fix: Fix Android build on React Native 0.65 and older ( #694 )
...
* fix: Fix Android build on React Native 0.65 and older
* fix: Add excludes
* fix: Ignore META-INF from package
* fix: Wrong var name
2022-01-02 16:25:43 +01:00
Janic Duplessis
dcbbae5fc7
fix: Re-install Frame Processor JSI Bindings after Reload ( #691 )
2022-01-02 16:02:17 +01:00
Janic Duplessis
4584d33921
fix: Fix JNI crash in FrameHostObject dtor ( #689 )
2022-01-02 15:57:15 +01:00
Marc Rousavy
68707322fe
feat: Use new CameraX Recorder API (Upgrade CameraX to alpha12/32) ( #543 )
...
* chore(deps): Upgrade CameraX to alpha10/30
* chore(deps): Add first stable CameraX Video library
* feat: Use new CameraX Video API
* chore(deps): Upgrade CameraX from 10 -> 12
* fix: Replace deprecated APIs
* Update CameraViewModule.kt
* fix: Fix file creation
2021-12-30 11:39:17 +01:00
Janic Duplessis
04576db975
fix: Fix extract tasks being added to clean tasks ( #644 )
2021-12-13 09:32:10 +01:00
Marc Rousavy
1249cde337
fix: Fix gradle build with wrong task-name and order
2021-12-10 09:53:12 +01:00
Thomas Coldwell
c3039c94c6
feat: Add pixelFormat
field ( #559 )
...
* Add `mediaSubType` field to device formats
* Create FourCharCode `toString` extension
* Move pixelFormat -> `AVCaptureDevice.Format+toDictionary`
* `mediaSubType` -> `pixelFormat` + non-optional
* ts pixelFormat `string` -> specific formats
* Add default pixelFormat value of `420v` on Android
Co-authored-by: tcoldwell72 <31568400+tcoldwell72@users.noreply.github.com>
2021-12-10 09:44:30 +01:00
Marc Rousavy
6025367c72
fix: Fix duplicate JHashMap
definition by moving to custom namespace ( #610 )
...
Technically `JHashMap` is duplicated now, but in separate namespaces. If I were to remove my `JHashMap` (and `JArrayList`) definitions, the user is forced to use fbjni v3.
2021-11-23 15:48:07 +01:00
Marc Rousavy
c007a08040
fix: Fix ProGuard stripping away FrameProcessorPlugin
2021-10-14 12:47:28 +02:00
Marc Rousavy
c47639d86a
fix: Fix possible null-pointer error in convertJNIObjectToJSIValue
2021-10-14 12:46:42 +02:00
Marc Rousavy
4a73cb96c1
fix: Fix view-not-found
race condition in C++ code ( #511 )
...
* Add custom `onViewReady` event to get layout
`componentDidMount` is async, so the native view _might_ not exist yet causing a race condition in the `setFrameProcessor` code.
This PR fixes this by calling `setFrameProcessor` only after the native view has actually mounted, and to ensure that I created a custom event that fires at that point.
* Update CameraView.swift
2021-10-11 18:27:23 +02:00
Marc Rousavy
8d24e344c9
chore: Upgrade CameraX to alpha09 ( #472 )
...
* chore: Upgrade CameraX to alpha09
* Remove custom ProGuard file
It's no longer needed, CameraX now ships one.
* Set `targetSdkVersion` to `31`
* set `compileSdkVersion` to 31
* Add `android:exported=false`
2021-10-07 12:20:21 +02:00
Marc Rousavy
fc43b1bb7c
fix: Avoid duplicate C++ symbols by using libjsi.so
shared library ( #494 )
...
* fix: Avoid duplicate C++ symbols by using `libjsi.so` shared library
* exclude `libfbjni` and `libjsi` from packaging options
2021-10-07 11:16:19 +02:00
Marc Rousavy
f029e731b2
fix: Exclude libfbjni.so
2021-10-07 10:28:50 +02:00
Marc Rousavy
916278d3ea
feat: Add React Native 0.66 support ( #490 )
...
* feat: Add React Native 0.66 support
* Generate lockfiles
* Update Podfile.lock
* chore: Migrate from react-native-navigation to react-navigation (#491 )
* Migrate RNN -> RN
* Migrate all screens
* Fix get permission status
* fix app name
* Update AppDelegate.m
* Fix Info.plist
* Set `UIViewControllerBasedStatusBarAppearance` to `YES`
* Only enable `audio` if user granted microphone permission
* Update App.tsx
* Fix RNGH for Android
* Use `navigate` instead of `push`
* Fix animation
* Upgrade @types/react-native
* "Splash" -> "PermissionsPage"
2021-10-05 12:22:14 +02:00
Marc Rousavy
42e791b4bd
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
2021-09-29 12:30:50 +02:00
Marc Rousavy
8f65427391
fix: Fix ExtensionsManager abstract method crash by adding ProGuard rule ( #466 )
2021-09-29 10:38:49 +02:00
Marc Rousavy
60ea779ffe
fix: De-allocate frame
HybridClass with JNI class loader if using Hermes ( #455 )
...
* De-allocate `frame` HybridClass with JNI class loader if using Hermes
See 1b3a0c2612
* Don't wrap in `#if FOR_HERMES`, other `jsi::Runtime`s might also run GC on another Thread.
* Use `jni::local_ref` for `FrameHostObject`
* Update JImageProxyHostObject.cpp
* Only run with JNI `ClassLoader` if ctor Thread ID != dtor Thread ID
* Upgrade reanimated to 2.3.0-beta.1 to fix JNI crash
* Remove `this_thread::get_id()`
* Update Podfile.lock
2021-09-24 16:57:12 +02:00
Andrés Guerrero
98f58367d3
fix: Correctly set video size/aspect ratio for Image Analysis (Frame Processor) ( #453 )
2021-09-24 12:01:45 +02:00
Marc Rousavy
99fff446e5
fix: Fix calling multiple Plugins in a single Frame Processor ( #435 )
...
* fix: Fix JNI <-> JSI conversion for Integers
* Create another plugin and call them both serially
* Use inline formatter for `__android_log_write`
* Update FrameProcessorRuntimeManager.cpp
* Log plugin class type
* Use `pluginGlobal->cthis()`
* Log class name
* fix dumb error
* C++: Dynamically get JNI `javaPart_` class & method
* clean up PR
2021-09-24 10:19:30 +02:00
Marc Rousavy
be3312e47d
chore: Upgrade kotlinx-coroutines 1.5.0 -> 1.5.2 ( #450 )
...
* chore: Upgrade kotlinx-coroutines 1.5.0 -> 1.5.2
* Upgrade `kotlinVersion` to 1.5.30
2021-09-23 14:22:11 +02:00
Marc Rousavy
83524c0541
fix: Fix Android Stabilization Modes ( #449 )
2021-09-23 14:02:46 +02:00
Marc Rousavy
c3cf75eb5f
fix: Fix JNI <-> JSI conversion for Integers
2021-09-15 10:14:52 +02:00
Marc Rousavy
3d51cca02c
chore: Also run validate-cpp for Android C++ files
2021-09-07 14:17:35 +02:00
Marc Rousavy
ad5e131f6a
feat: frameProcessorFps="auto"
and automatic performance suggestions (throttle or increase FPS) ( #393 )
...
* Add `onFrameProcessorPerformanceSuggestionAvailable` and make `frameProcessorFps` support `auto`
* Implement performance suggestion and auto-adjusting
* Fix FPS setting, evaluate correctly
* Floor suggested FPS
* Remove `console.log` for frame drop warnings.
* Swift format
* Use `30` magic number
* only call if FPS is different
* Update CameraView.swift
* Implement Android 1/2
* Cleanup
* Update `frameProcessorFps` if available
* Optimize `FrameProcessorPerformanceDataCollector` initialization
* Cache call
* Set frameProcessorFps directly (Kotlin setter)
* Don't suggest if same value
* Call suggestion every second
* reset time on set
* Always store 15 last samples
* reset counter too
* Update FrameProcessorPerformanceDataCollector.swift
* Update CameraView+RecordVideo.swift
* Update CameraView.kt
* iOS: Redesign evaluation
* Update CameraView+RecordVideo.swift
* Android: Redesign evaluation
* Update CameraView.kt
* Update REA to latest alpha and install RNScreens
* Fix frameProcessorFps updating
2021-09-06 16:27:16 +02:00
Natalia
3b7560ac4d
fix: Fix Android tasks execution ( #407 )
2021-09-06 10:32:06 +02:00
Marc Rousavy
98128471cc
fix: Fix Proguard annotation for mHybridData
( #406 )
...
* fix: Fix Proguard annotation for `mHybridData`
* rebuild lockfiles
2021-09-05 11:24:33 +02:00
Marc Rousavy
ff5a8b8900
fix: Improve Android resource efficiency/cleanup (use class members for CoroutineScope
and FrameProcessorThread
) ( #335 )
...
* fix: Use custom CoroutineScope
* fix: Use custom `CoroutineScope`
* Make `frameProcessorThread` and `coroutineScope` instance variables
* Update VisionCameraScheduler.java
* Remove `HybridData::resetNative()` calls
they're called by a Java GC destructor anyways.
* Update CameraViewManager.kt
* Update CameraView.kt
2021-08-25 11:33:57 +02:00
Marc Rousavy
c7fb89170e
fix: Apply correct initial rotation on Android ( #368 )
...
* fix: Apply correct initial rotation
* Make `rotation` a property getter
* Update CameraView.kt
2021-08-25 11:16:07 +02:00
Marc Rousavy
c657bf8718
Revert "fix: Fix Frame Processor null-dereference error (use ref-counted JNI local_ref
) ( #351 )"
...
This reverts commit d06bcf648c
.
2021-08-20 16:05:09 +02:00
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
Marc Rousavy
0d3f2cbd9d
fix: Fix crash when accessing planesCount
or bytesPerRow
( #380 )
...
* fix: Fix `bytesPerRow` and `planeCount` crashing
* use direct call
* Call `getPlanesCount` and `getBytesPerRow` through java
* revert camerapage changes
* remove removed header import
* Update CameraPage.tsx
2021-08-20 16:02:34 +02:00
Marc Rousavy
d06bcf648c
fix: Fix Frame Processor null-dereference error (use ref-counted JNI local_ref
) ( #351 )
2021-08-20 15:57:31 +02:00
Marc Rousavy
cae08a1402
feat: Add react-native 0.65 support ( #378 )
...
* fix `;`
* upgrade react-native to 0.65.1
* upgrade example to react-native 0.65.1
* Update Podfile.lock
* Update Podfile.lock
* add `jcenter()` temporarily
* upgrade gradle tools (kotlin, build-tools, swipe-to-refresh)
* Upgrade `react-native-navigation` to `7.18.1-snapshot.1611`
* chore(deps): Upgrade a few more deps
2021-08-20 11:53:40 +02:00
Marc Rousavy
8e02b49c16
chore(deps): Upgrade CameraX to alpha08 ( #377 )
2021-08-20 11:07:20 +02:00
Marc Rousavy
494925c96e
fix: Always return authorized
for requestPermission on SDK 22 and below ( #344 )
2021-08-09 11:43:56 +02:00
dependabot[bot]
80f87bfc77
chore(deps): bump exifinterface from 1.3.2 to 1.3.3 in /android ( #327 )
...
Bumps exifinterface from 1.3.2 to 1.3.3.
---
updated-dependencies:
- dependency-name: androidx.exifinterface:exifinterface
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-06 10:44:57 +02:00
Marc Rousavy
37db643f71
fix: Fix format
Preview and Video Capture resolution setting ( #325 )
...
* fix: Actually use a format's `videoSize` for Preview/Video Capture
* `setDefaultResolution` -> `setTargetResolution`
2021-08-05 15:54:01 +02:00
Marc Rousavy
1c32726ef6
fix: Throw JS errors if JSI <-> JNI conversion failed ( #324 )
2021-08-05 10:10:49 +02:00
Marc Rousavy
b493576373
fix: Fix java.lang.NoSuchMethodError
error for .toArrayList()
( #322 )
...
* fix: Fix `java.lang.NoSuchMethodError` error for `.toArrayList()`
* Fix `HashMap<K, V>` conversion to `jsi::Object`
* Update FRAME_PROCESSORS_CREATE_OVERVIEW.mdx
2021-08-04 16:07:08 +02:00
Marc Rousavy
aaecb90937
fix: Fix dead link in parallel-video-processing-not-supported
error
2021-08-02 11:21:23 +02:00
Marc Rousavy
0f7ee51333
feat: Add console
logging support for Frame Processors ( #297 )
...
* Try to log to console via runOnJS
* Call `console.log`
* Create custom `VisionCameraScheduler`
* Fix scheduler call
* Call with this
* Fix console setting
* Move J---- to `java-bindings`
* c++ style
* Android: 1/2 Create custom Scheduler
* Android: 2/2 Use custom Scheduler
* Don't use `runOnJS`, use `__callAsync` directly
2021-07-30 10:27:45 +02:00
Marc Rousavy
123d0d9e9c
chore(deps): Upgrade react-native-reanimated to alpha.2 ( #309 )
...
* Upgrade react-native-reanimated to alpha.2
* fix Android header search path
* Make `const`
2021-07-30 09:50:09 +02:00
Marc Rousavy
445af943c3
feat: BREAKING CHANGE: Express zoom
factor always in actual factor value (1, 2, 128, ...) instead of 0.0-1.0 scale ( #306 )
...
* Make `zoom` go on "factor" scale
* Clean up `zoom` code
* fix float conversion
* fix zoom interpretation
* Update docs for new zoom scale
* fix float conversion
2021-07-29 11:44:22 +02:00
Marc Rousavy
ef455df865
feat: Support rotation ( #301 )
...
* feat: Android: Listen to rotation changes
* Only change rotation on configuration change
* feat: iOS: Support Rotation
* Swift lint
2021-07-26 11:32:58 +02:00
Marc Rousavy
159ff44de3
chore(deps): Upgrade CameraX to 7 ( #300 )
2021-07-26 10:23:18 +02:00
Marc Rousavy
5eaed05f47
fix: Fix "REACT_NATIVE_UTILS_LIB
not found" build error ( #295 )
...
* Remove `REACT_NATIVE_UTILS_LIB`
* Clean up CMakeLists.txt
2021-07-23 14:28:38 +02:00
Marc Rousavy
4b4ea0ff33
fix: Fix UI Thread race condition in setFrameProcessor(...)
( #265 )
...
* fix: Fix UI Thread race condition in `setFrameProcessor(...)`
* Revert "fix: Fix UI Thread race condition in `setFrameProcessor(...)`"
This reverts commit 9c524e123cff6843d7d11db602a5027d1bb06b4b.
* Use `setImmediate` to call `setFrameProcessor(...)`
* Fix frame processor order of applying
* Add `enableFrameProcessor` prop that defines if a FP is added
* rename constant
* Implement `enableFrameProcessor` prop for Android and make `frameProcessorFps` faster
* link to troubleshooting guide
* Update TROUBLESHOOTING.mdx
* Add logs for use-cases
* fix log
* set initial frame processor in `onLayout` instead of `componentDidMount`
2021-07-12 15:16:03 +02:00
Marc Rousavy
66f22d7b21
fix: Only extract either JSC or Hermes REA .aar
2021-07-08 11:12:26 +02:00
Marc Rousavy
b2f3c08a07
fix: Distribute Android code as source ( #234 )
...
* Build Android as source
* more reliably find `enableHermes`
2021-07-08 10:52:14 +02:00
dependabot[bot]
63053f8650
chore(deps): bump gradle-download-task from 4.1.1 to 4.1.2 in /android ( #262 )
...
Bumps [gradle-download-task](https://github.com/michel-kraemer/gradle-download-task ) from 4.1.1 to 4.1.2.
- [Release notes](https://github.com/michel-kraemer/gradle-download-task/releases )
- [Commits](https://github.com/michel-kraemer/gradle-download-task/compare/4.1.1...4.1.2 )
---
updated-dependencies:
- dependency-name: de.undercouch:gradle-download-task
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-08 10:50:38 +02:00
Marc Rousavy
2f889f5855
fix: Fix hot-reload crash caused by Frame Processor Runtime being initialized twice ( #258 )
...
* Fix Frame Processor Runtime being initialized twice causing a hot-reload to crash
* Remove unnecessary `HasRegisteredPlugins` singleton
* make non-optional
* `REACT_CLASS` -> `TAG`
* fix nullable
2021-07-07 15:00:32 +02:00
Marc Rousavy
3007cd9430
fix: Add @Keep
annotation to prevent minifier from deleting java funcs
2021-07-07 13:18:38 +02:00
Marc Rousavy
7a5e879b92
fix: Fix lint error for missing JNI func (3)
2021-07-07 13:17:41 +02:00
Marc Rousavy
91e81d7594
fix: Fix lint error for missing JNI func (2)
2021-07-07 13:16:19 +02:00
Marc Rousavy
1730ce8980
fix: Fix lint error for missing JNI func
2021-07-07 13:15:32 +02:00
Marc Rousavy
339b470ca5
fix: Fix wrong HDR error being thrown on LowLight mode
2021-07-07 13:14:36 +02:00
Marc Rousavy
1e64215d37
chore(deps): upgrade camerax ( #257 )
...
* Upgrade CameraX to alpha6
* Upgrade CameraX extensions to alpha26
* `init` -> `getInstance`
* Use new Extensions API
* Update CameraView.kt
* use new ExtensionsManager API in `getAvailableCameraDevices()`
* fix cpplint errors
2021-07-07 12:57:28 +02:00
Marc Rousavy
2fa0f8fd46
chore: Clean up root directory ( #236 )
...
* Clean up root
* remove unused REA patches
* Remove `cpp/` and create headers per platform
* fix `#import`
* fix `VISION_CAMERA_DISABLE_FRAME_PROCESSORS`
2021-07-06 16:42:58 +02:00
Marc Rousavy
fa5f5c0cab
feat: Implement Frame.close()
( #229 )
...
* Implement `Frame.close()`
* close frame in dtor
* Update JImageProxyHostObject.cpp
* fix close
* Check if closed
* remove a few logs
* r
* fix `isValid` and `isReady`
* Add JImage
* Release JNI frame ref on destroy
* fix pod setup
* Fix isValid call
* Fix `close` not returning a function
* throw error if closed twice
* iOS: Schedule `console.error` call on JS thread
* Android: Log Frame Processor Error to JS
* fix syntax
* Check if valid `toString()`
* Update Frame.ts
* Remove `isReady`
* Fix JImage accessors
* remove `JImage` C++ sources
* Throw error if accessing props on closed Frame
* Delete `JImage.h`
2021-07-06 10:08:44 +02:00
Marc Rousavy
bfb1b67c2f
Update FrameProcessorRuntimeManager.cpp
2021-06-29 10:38:35 +02:00
Marc Rousavy
5ab1a72e01
chore: Fix C++ indents
2021-06-29 10:38:13 +02:00
Marc Rousavy
45fad5ab19
fix: Add more logs
2021-06-29 10:36:39 +02:00
Marc Rousavy
359fd00c73
fix: print stacktrace on error
2021-06-29 10:34:48 +02:00
Marc Rousavy
f1a5ee7ee1
fix: Log errors in update
and configureSession
2021-06-29 10:18:39 +02:00
Marc Rousavy
f07f4a8770
fix: Correctly propagate Errors in configureSession()
2021-06-29 10:16:38 +02:00
Marc Rousavy
f80e606c6d
fix: Report all errors to JS in configureSession
2021-06-29 10:14:33 +02:00
Marc Rousavy
da84a0fd42
perf: Avoid error message copying
2021-06-28 20:45:08 +02:00
Marc Rousavy
4bacee796a
feat: Print Frame Processor errors to Metro console
2021-06-28 20:44:50 +02:00
Marc Rousavy
26d19d5152
perf: Remove a few unnecessary log statements
2021-06-28 18:30:42 +02:00
Marc Rousavy
e13bef7d17
fix: Host Object error
2021-06-28 10:19:19 +02:00
Marc Rousavy
87e6bb710e
feat: Frame Processors for Android ( #196 )
...
* Create android gradle build setup
* Fix `prefab` config
* Add `pickFirst **/*.so` to example build.gradle
* fix REA path
* cache gradle builds
* Update validate-android.yml
* Create Native Proxy
* Copy REA header
* implement ctor
* Rename CameraViewModule -> FrameProcessorRuntimeManager
* init FrameProcessorRuntimeManager
* fix name
* Update FrameProcessorRuntimeManager.h
* format
* Create AndroidErrorHandler.h
* Initialize runtime and install JSI funcs
* Update FrameProcessorRuntimeManager.cpp
* Update CameraViewModule.kt
* Make CameraView hybrid C++ class to find view & set frame processor
* Update FrameProcessorRuntimeManager.cpp
* pass function by rvalue
* pass by const &&
* extract hermes and JSC REA
* pass `FOR_HERMES`
* correctly prepare JSC and Hermes
* Update CMakeLists.txt
* add missing hermes include
* clean up imports
* Create JImageProxy.h
* pass ImageProxy to JNI as `jobject`
* try use `JImageProxy` C++ wrapper type
* Use `local_ref<JImageProxy>`
* Create `JImageProxyHostObject` for JSI interop
* debug call to frame processor
* Unset frame processor
* Fix CameraView native part not being registered
* close image
* use `jobject` instead of `JImageProxy` for now :(
* fix hermes build error
* Set enable FP callback
* fix JNI call
* Update CameraView.cpp
* Get Format
* Create plugin abstract
* Make `FrameProcessorPlugin` a hybrid object
* Register plugin CXX
* Call `registerPlugin`
* Catch
* remove JSI
* Create sample QR code plugin
* register plugins
* Fix missing JNI binding
* Add `mHybridData`
* prefix name with two underscores (`__`)
* Update CameraPage.tsx
* wrap `ImageProxy` in host object
* Use `jobject` for HO box
* Update JImageProxy.h
* reinterpret jobject
* Try using `JImageProxy` instead of `jobject`
* Update JImageProxy.h
* get bytes per row and plane count
* Update CameraView.cpp
* Return base
* add some docs and JNI JSI conversion
* indent
* Convert JSI value to JNI jobject
* using namespace facebook
* Try using class
* Use plain old Object[]
* Try convert JNI -> JSI
* fix decl
* fix bool init
* Correctly link folly
* Update CMakeLists.txt
* Convert Map to Object
* Use folly for Map and Array
* Return `alias_ref<jobject>` instead of raw `jobject`
* fix JNI <-> JSI conversion
* Update JSIJNIConversion.cpp
* Log parameters
* fix params index offset
* add more test cases
* Update FRAME_PROCESSORS_CREATE_OVERVIEW.mdx
* fix types
* Rename to example plugin
* remove support for hashmap
* Try use HashMap iterable fbjni binding
* try using JReadableArray/JReadableMap
* Fix list return values
* Update JSIJNIConversion.cpp
* Update JSIJNIConversion.cpp
* (iOS) Rename ObjC QR Code Plugin to Example Plugin
* Rename Swift plugin QR -> Example
* Update ExamplePluginSwift.swift
* Fix Map/Dictionary logging format
* Update ExampleFrameProcessorPlugin.m
* Reconfigure session if frame processor changed
* Handle use-cases via `maxUseCasesCount`
* Don't crash app on `configureSession` error
* Document "use-cases"
* Update DEVICES.mdx
* fix merge
* Make `const &`
* iOS: Automatically enable `video` if a `frameProcessor` is set
* Update CameraView.cpp
* fix docs
* Automatically fallback to snapshot capture if `supportsParallelVideoProcessing` is false.
* Fix lookup
* Update CameraView.kt
* Implement `frameProcessorFps`
* Finalize Frame Processor Plugin Hybrid
* Update CameraViewModule.kt
* Support `flash` on `takeSnapshot()`
* Update docs
* Add docs
* Update CameraPage.tsx
* Attribute NonNull
* remove unused imports
* Add Android docs for Frame Processors
* Make JNI HashMap <-> JSI Object conversion faster
directly access `toHashMap` instead of going through java
* add todo
* Always run `prepareJSC` and `prepareHermes`
* switch jsc and hermes
* Specify ndkVersion `21.4.7075529`
* Update gradle.properties
* Update gradle.properties
* Create .aar
* Correctly prepare android package
* Update package.json
* Update package.json
* remove `prefab` build feature
* split
* Add docs for registering the FP plugin
* Add step for dep
* Update CaptureButton.tsx
* Move to `reanimated-headers/`
* Exclude reanimated-headers from cpplint
* disable `build/include_order` rule
* cpplint fixes
* perf: Make `JSIJNIConversion` a `namespace` instead of `class`
* Ignore runtime/references for `convert` funcs
* Build Android .aar in CI
* Run android build script only on `prepack`
* Update package.json
* Update package.json
* Update build-android-npm-package.sh
* Move to `yarn build`
* Also install node_modules in example step
* Update validate-android.yml
* sort imports
* fix torch
* Run ImageAnalysis on `FrameProcessorThread`
* Update Errors.kt
* Add clean android script
* Upgrade reanimated to 2.3.0-alpha.1
* Revert "Upgrade reanimated to 2.3.0-alpha.1"
This reverts commit c1d3bed5e03728d0b5e335a359524ff4f56f5035.
* ⚠️ TEMP FIX: hotfix reanimated build.gradle
* Update CameraView+TakeSnapshot.kt
* ⚠️ TEMP FIX: Disable ktlint action for now
* Update clean.sh
* Set max heap size to 4g
* rebuild lockfiles
* Update Podfile.lock
* rename
* Build lib .aar before example/
2021-06-27 12:37:54 +02:00
Marc Rousavy
9ea158ad8f
chore: Move to /mrousavy/ ( #224 )
...
* rename 1/n
* 2
* 3
* fix indent
2021-06-21 22:42:46 +02:00
Marc Rousavy
0e606affce
feat: High quality mode (enableHighQualityPhotos
) ( #194 )
...
* feat: High Quality photo capture
* prepare photo output for re-used settings
* use high quality captures
* Remove `enableVirtualDeviceFusion` as that is enabled by default
* Clean up configuration, remove default
* format
* Update CameraViewManager.kt
* rename
* Update CameraProps.ts
* Fix overriding `photoSettings`
* Update CameraView+TakePhoto.swift
* Update CameraView+TakePhoto.swift
2021-06-10 13:49:34 +02:00
Marc Rousavy
232801439b
chore(deps): Upgrade CameraX to alpha05 ( #180 )
2021-06-07 13:15:49 +02:00
Marc Rousavy
72a1fad78e
feat: Separate usecases (decouple microphone, video, photo) ( #168 )
...
* Add props
* add props (iOS)
* Add use-cases conditionally
* Update CameraView+RecordVideo.swift
* Update RecordingSession.swift
* reconfigure on change
* Throw correct errors
* Check for audio permission
* Move `#if` outward
* Throw appropriate errors
* Update CameraView+RecordVideo.swift
* fix Splashscreen
* Dynamic filePath
* Fix video extension
* add `avci` and `m4v` file types
* Fix RecordVideo errors
* Fix audio setup
* Enable `photo`, `video` and `audio`
* Check for `video={true}` in frameProcessor
* format
* Remove unused DispatchQueue
* Update docs
* Add `supportsPhotoAndVideoCapture`
* Fix view manager
* Fix error not being propagated
* Catch normal errors too
* Update DEVICES.mdx
* Update CAPTURING.mdx
* Update classdocs
2021-06-07 13:08:40 +02:00
Marc Rousavy
555474be7d
fix: Represent neutralZoom in factor instead of percentage ( #179 )
...
* Use factor instead of percent for `neutralZoom`
* fix zoom calculation
* Update CameraPage.tsx
2021-06-07 10:46:53 +02:00
Sergei Mitrofanov
0f94c2a996
fix: Fix wrong permission errors thrown ( #163 )
2021-06-03 19:07:52 +02:00
Marc Rousavy
a0e063414a
chore(deps): Bump Android native dependencies ( #150 )
...
* Bump gradle build-tools to 4.2.1
* Bump kotlinx coroutines to 1.5.0
* Bump Kotlin to 1.5.0
* Replace `jcenter` with `mavenCentral`
* Upgrade Kotlin to 1.5.10
* Upgrade gradle plugin to 4.2.1
* Revert "Upgrade gradle plugin to 4.2.1"
This reverts commit 0946110ff442ddd24f2f3f31e7587851d7626c9e.
* Revert "Upgrade Kotlin to 1.5.10"
This reverts commit 2b11c5c911397d1db1ea7a24fb8c8634a25b5c76.
* Revert "Replace `jcenter` with `mavenCentral`"
This reverts commit 3e40b516619067c0d9da1abf3cfeb9acb6102c71.
2021-05-27 11:29:52 +02:00
Marc Rousavy
b6a67d5ced
feature: Frame Processors (iOS) ( #2 )
...
* Clean up Frame Processor
* Create FrameProcessorHolder
* Create FrameProcessorDelegate in ObjC++
* Move frame processor to FrameProcessorDelegate
* Decorate runtime, check for null
* Update FrameProcessorDelegate.mm
* Cleanup FrameProcessorBindings.mm
* Fix RuntimeDecorator.h import
* Update FrameProcessorDelegate.mm
* "React" -> "React Helper" to avoid confusion
* Rename folders again
* Fix podspec flattening a lot of headers, causing REA nameclash
* Fix header imports to avoid REA naming collision
* Lazily initialize jsi::Runtime on DispatchQueue
* Install frame processor bindings from Swift
* First try to call jsi::Function (frame processor) 👀
* Call viewForReactTag on RCT main thread
* Fix bridge accessing
* Add more logs
* Update CameraViewManager.swift
* Add more TODOs
* Re-indent .cpp files
* Fix RCTTurboModule import podspec
* Remove unnecessary include check for swift umbrella header
* Merge branch 'main' into frame-processors
* Docs: use static width for images (283)
* Create validate-cpp.yml
* Update a lot of packages to latest
* Set SWIFT_VERSION to 5.2 in podspec
* Create clean.sh
* Delete unused C++ files
* podspec: Remove CLANG_CXX_LANGUAGE_STANDARD and OTHER_CFLAGS
* Update pod lockfiles
* Regenerate lockfiles
* Remove IOSLogger
* Use NSLog
* Create FrameProcessorManager (inherits from REA RuntimeManager)
* Create reanimated::RuntimeManager shared_ptr
* Re-integrate pods
* Add react-native-reanimated >=2 peerDependency
* Add metro-config
* blacklist -> exclusionList
* Try to call worklet
* Fix jsi::Value* initializer
* Call ShareableValue::adapt (makeShareable) with React/JS Runtime
* Add null-checks
* Lift runtime manager creation out of delegate, into bindings
* Remove debug statement
* Make RuntimeManager unique_ptr
* Set _FRAME_PROCESSOR
* Extract convertJSIFunctionToFrameProcessorCallback
* Print frame
* Merge branch 'main' into frame-processors
* Reformat Swift code
* Install reanimated from npm again
* Re-integrate Pods
* Dependabot: Also scan example/ and docs/
* Update validate-cpp.yml
* Create FrameProcessorUtils
* Create Frame.h
* Abstract HostObject creation away
* Fix types
* Fix frame processor call
* Add todo
* Update lockfiles
* Add C++ contributing instructions
* Update CONTRIBUTING.md
* Add android/src/main/cpp to cpplint
* Update cpplint.sh
* Fix a few cpplint errors
* Fix globals
* Fix a few more cpplint errors
* Update App.tsx
* Update AndroidLogger.cpp
* Format
* Fix cpplint script (check-cpp)
* Try to simplify frame processor
* y
* Update FrameProcessorUtils.mm
* Update FrameProcessorBindings.mm
* Update CameraView.swift
* Update CameraViewManager.m
* Restructure everything
* fix
* Fix `@objc` export (make public)
* Refactor installFrameProcessorBindings into FrameProcessorRuntimeManager
* Add swift RCTBridge.runOnJS helper
* Fix run(onJS)
* Add pragma once
* Add `&self` to lambda
* Update FrameProcessorRuntimeManager.mm
* reorder imports
* Fix imports
* forward declare
* Rename extension
* Destroy buffer after execution
* Add FrameProcessorPluginRegistry base
* Merge branch 'main' into frame-processors
* Add frameProcessor to types
* Update Camera.tsx
* Fix rebase merge
* Remove movieOutput
* Use `useFrameProcessor`
* Fix bad merge
* Add additional ESLint rules
* Update lockfiles
* Update CameraViewManager.m
* Add support for V8 runtime
* Add frame processor plugins API
* Print plugin invoke
* Fix React Utils in podspec
* Fix runOnJS swift name
* Remove invalid redecl of `captureSession`
* Use REA 2.1.0 which includes all my big PRs 🎉
* Update validate-cpp.yml
* Update Podfile.lock
* Remove Flipper
* Fix dereferencing
* Capture `self` by value. Fucking hell, what a dumb mistake.
* Override a few HostObject functions
* Expose isReady, width, height, bytesPerRow and planesCount
* use hook again
* Expose property names
* FrameProcessor -> Frame
* Update CameraView+RecordVideo.swift
* Add Swift support for Frame Processors Plugins
* Add macros for plugin installation
* Add ObjC frame processor plugin
* Correctly install frame processor plugins
* Don't require custom name for macro
* Check if plugin already exists
* Implement QR Code Frame Processor Plugin in Swift
* Adjust ObjC style frame processor macro
* optimize
* Add `frameProcessorFrameDropRate`
* Fix types
* Only log once
* Log if it executes slowly
* Implement `frameProcessorFps`
* Implement manual encoded video recordings
* Use recommended video settings
* Add fileType types
* Ignore if input is not ready for media data
* Add completion handler
* Add audio buffer sampling
* Init only for video frame
* use AVAssetWriterInputPixelBufferAdaptor
* Remove AVAssetWriterInputPixelBufferAdaptor
* Rotate VideoWriter
* Always assume portrait orientation
* Update RecordingSession.swift
* Use a separate Queue for Audio
* Format Swift
* Update CameraView+RecordVideo.swift
* Use `videoQueue` instead of `cameraQueue`
* Move example plugins to example app
* Fix hardcoded name in plugin macro
* QRFrame... -> QRCodeFrame...
* Update FrameProcessorPlugin.h
* Add example frame processors to JS base
* Update QRCodeFrameProcessorPluginSwift.m
* Add docs to create FP Plugins
* Update FRAME_PROCESSORS_CREATE.mdx
* Update FRAME_PROCESSORS_CREATE.mdx
* Use `AVAssetWriterInputPixelBufferAdaptor` for efficient pixel buffer recycling
* Add customizable `pixelFormat`
* Use native format if available
* Update project.pbxproj
* Set video width and height as source-pixel-buffer attributes
* Catch
* Update App.tsx
* Don't explicitly set video dimensions, let CVPixelBufferPool handle it
* Add a few logs
* Cleanup
* Update CameraView+RecordVideo.swift
* Eagerly initialize asset writer to fix stutter at first frame
* Use `cameraQueue` DispatchQueue to not block CaptureDataOutputDelegate
* Fix duration calculation
* cleanup
* Cleanup
* Swiftformat
* Return available video codecs
* Only show frame drop notification for video output
* Remove photo and video codec functionality
It was too much complexity and probably never used anyways.
* Revert all android related changes for now
* Cleanup
* Remove unused header
* Update AVAssetWriter.Status+descriptor.swift
* Only call Frame Processor for Video Frames
* Fix `if`
* Add support for Frame Processor plugin parameters/arguments
* Fix arg support
* Move to JSIUtils.mm
* Update JSIUtils.h
* Update FRAME_PROCESSORS_CREATE.mdx
* Update FRAME_PROCESSORS_CREATE.mdx
* Upgrade packages for docs/
* fix docs
* Rename
* highlight lines
* docs
* community plugins
* Update FRAME_PROCESSOR_CREATE_FINAL.mdx
* Update FRAME_PROCESSOR_PLUGIN_LIST.mdx
* Update FRAME_PROCESSOR_PLUGIN_LIST.mdx
* Update dependencies (1/2)
* Update dependencies (2/2)
* Update Gemfile.lock
* add FP docs
* Update README.md
* Make `lastFrameProcessor` private
* add `frameProcessor` docs
* fix docs
* adjust docs
* Update DEVICES.mdx
* fix
* s
* Add logs demo
* add metro restart note
* Update FRAME_PROCESSOR_CREATE_PLUGIN_IOS.mdx
* Mirror video device
* Update AVCaptureVideoDataOutput+mirror.swift
* Create .swift-version
* Enable whole module optimization
* Fix recording mirrored video
* Swift format
* Clean dictionary on `markInvalid`
* Fix cleanup
* Add docs for disabling frame processors
* Update project.pbxproj
* Revert "Update project.pbxproj"
This reverts commit e67861e51b88b4888a6940e2d20388f3044211d0.
* Log frame drop reason
* Format
* add more samples
* Add clang-format
* also check .mm
* Revert "also check .mm"
This reverts commit 8b9d5e2c29866b05909530d104f6633d6c49eadd.
* Revert "Add clang-format"
This reverts commit 7643ac808e0fc34567ea1f814e73d84955381636.
* Use `kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange` as default
* Read matching video attributes from videoSettings
* Add TODO
* Swiftformat
* Conditionally disable frame processors
* Assert if trying to use frame processors when disabled
* Add frame-processors demo gif
* Allow disabling frame processors via `VISION_CAMERA_DISABLE_FRAME_PROCESSORS`
* Update FrameProcessorRuntimeManager.mm
* Update FRAME_PROCESSORS.mdx
* Update project.pbxproj
* Update FRAME_PROCESSORS_CREATE_OVERVIEW.mdx
2021-05-06 14:11:55 +02:00