-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Android Camera2 rewrite #1674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+3,987
−2,247
Merged
Changes from 144 commits
Commits
Show all changes
180 commits
Select commit
Hold shift + click to select a range
ecb6fd5
Nuke CameraX
mrousavy 1485910
fix: Run View Finder on UI Thread
mrousavy bdb61a0
Open Camera, set up Threads
mrousavy be20f8b
fix init
mrousavy 9099967
Mirror if needed
mrousavy 96a7cfd
Try PreviewView
mrousavy bd518db
Use max resolution
mrousavy 0c5e04c
Add `hardwareLevel` property
mrousavy b43ba63
Check if output type is supported
mrousavy a2a294c
Replace `frameRateRanges` with `minFps` and `maxFps`
mrousavy 1ef1a50
Remove `isHighestPhotoQualitySupported`
mrousavy 159c3b2
Remove `colorSpace`
mrousavy c52b81b
HDR
mrousavy 1766ea3
Check from format
mrousavy 87ef655
fix
mrousavy b37c1e8
Remove `supportsParallelVideoProcessing`
mrousavy 015f220
Correctly return video/photo sizes on Android now. Finally
mrousavy 3eb7a48
Log all Device props
mrousavy 1ff083d
Log if optimized usecase is used
mrousavy 3fc8177
Cleanup
mrousavy 0fd6c03
Configure Camera Input only once
mrousavy 8b93cfa
Revert "Configure Camera Input only once"
mrousavy fe89045
Extract Camera configuration
mrousavy ee25982
Try to reconfigure all
mrousavy 882972d
Hook based
mrousavy ea2ef78
Properly set up `CameraSession`
mrousavy 30681a4
Delete unused
mrousavy 71bc242
fix: Fix recreate when outputs change
mrousavy df1bf40
Update NativePreviewView.kt
mrousavy 7317d6c
Use callback for closing
mrousavy 8b8ba14
Catch CameraAccessException
mrousavy 1e212d0
Finally got it stable
mrousavy 22d07dd
Remove isMirrored
mrousavy db7f778
Implement `takePhoto()`
mrousavy 645bc1a
Add ExifInterface library
mrousavy a83c596
Run findViewById on UI Thread
mrousavy dbe34ce
Add Photo Output Surface to takePhoto
mrousavy 5c93aa8
Fix Video Stabilization Modes
mrousavy 16c3fd1
Optimize Imports
mrousavy 496e36d
More logs
mrousavy cb80f73
Update CameraSession.kt
mrousavy fb6cb44
Close Image
mrousavy cdeaf01
Use separate Executor in CameraQueue
mrousavy aa694c1
Delete hooks
mrousavy 4c5c724
Use same Thread again
mrousavy fe8ef66
If opened, call error
mrousavy c3a391c
Update CameraSession.kt
mrousavy 626438e
Log HW level
mrousavy 224b44f
fix: Don't enable Stream Use Case if it's not 100% supported
mrousavy 8221fd2
Move some stuff
mrousavy bf059d3
Cleanup PhotoOutputSynchronizer
mrousavy 1065ae9
Try just open in suspend fun
mrousavy 7a10c7c
Some synchronization fixes
mrousavy 1666375
fix logs
mrousavy 92115b6
Update CameraDevice+createCaptureSession.kt
mrousavy a4cecfd
Update CameraDevice+createCaptureSession.kt
mrousavy e4a7466
fixes
mrousavy 17e1bc7
fix: Use Snapshot Template for speed capture prio
mrousavy 3417d92
Use PREVIEW template for repeating request
mrousavy 4427935
Use `TEMPLATE_RECORD` if video use-case is attached
mrousavy a1c1c47
Use `isRunning` flag
mrousavy a2f7024
Recreate session everytime on active/inactive
mrousavy 9001002
Lazily get values in capture session
mrousavy 1e9db32
Stability
mrousavy 9f79e6a
Rebuild session if outputs change
mrousavy ec606e8
Set `didOutputsChange` back to false
mrousavy 50c6f16
Capture first in lock
mrousavy 2107f2c
Try
mrousavy a7e1e9a
kinda fix it? idk
mrousavy 9829dc4
fix: Keep Outputs
mrousavy 21bb04c
Refactor into single method
mrousavy c89d21f
Update CameraView.kt
mrousavy 42ec0ad
Use Enums for type safety
mrousavy 1d2241f
Implement Orientation (I think)
mrousavy 5355f0f
Move RefCount management to Java (Frame)
mrousavy 49c3079
Don't crash when dropping a Frame
mrousavy 290ae45
Prefer Devices with higher max resolution
mrousavy fb0e02c
Prefer multi-cams
mrousavy a7b5d45
Use FastImage for Media Page
mrousavy 4c40aec
Return orientation in takePhoto()
mrousavy 86dd4c1
Load orientation from EXIF Data
mrousavy 3df3cc5
Add `isMirrored` props and documentation for PhotoFile
mrousavy debe751
fix: Return `not-determined` on Android
mrousavy 8af3baf
Update CameraViewModule.kt
mrousavy 60feb21
chore: Upgrade packages
mrousavy 46c6f28
fix: Fix Metro Config
mrousavy 16c87da
Cleanup config
mrousavy ff10df5
Properly mirror Images on save
mrousavy 2e30c42
Prepare MediaRecorder
mrousavy 1404923
Start/Stop MediaRecorder
mrousavy 32142ea
Remove `takeSnapshot()`
mrousavy 8f77bf1
Use `MediaCodec`
mrousavy 0464ef1
Move to `VideoRecording` class
mrousavy 73ced94
Cleanup Snapshot
mrousavy cb84a0b
Create `SkiaPreviewView` hybrid class
mrousavy 2b68fb0
Create OpenGL context
mrousavy c4fd87e
Create `SkiaPreviewView`
mrousavy fb3f922
Fix texture creation missing context
mrousavy 495ad99
Draw red frame
mrousavy 3114faa
Somehow get it working
mrousavy cb2e92e
Add Skia CMake setup
mrousavy 08b3134
Start looping
mrousavy 87aca51
Init OpenGL
mrousavy 5958dfb
Refactor into `SkiaRenderer`
mrousavy 532ea75
Cleanup PreviewSize
mrousavy 0e71a75
Set up
mrousavy 53c78bd
Only re-render UI if there is a new Frame
mrousavy 74da19a
Preview
mrousavy d3ac954
Fix init
mrousavy 0979087
Try rendering Preview
mrousavy ac2ac9a
Update SkiaPreviewView.kt
mrousavy 58cc816
Log version
mrousavy 458734f
Try using Skia (fail)
mrousavy f493df9
Drawwwww!!!!!!!!!! :tada:
mrousavy 3cc6550
Use Preview Size
mrousavy e120fc3
Clear first
mrousavy 0a52b46
Refactor into SkiaRenderer
mrousavy 8ab4093
Add `previewType: "none"` on iOS
mrousavy ff2a312
Simplify a lot
mrousavy 8047cc1
Draw Camera? For some reason? I have no idea anymore
mrousavy 94216a6
Fix OpenGL errors
mrousavy f1085d7
Got it kinda working again?
mrousavy 03cf86b
Actually draw Frame woah
mrousavy 4dcbb03
Clean up code
mrousavy f2b6fab
Cleanup
mrousavy 30025ee
Update on main
mrousavy 3e2ed79
Synchronize render calls
mrousavy 04f7d43
holy shit
mrousavy cb0ab1f
Update SkiaRenderer.cpp
mrousavy 90a2ce3
Update SkiaRenderer.cpp
mrousavy 4c51acd
Refactor
mrousavy 1391b47
Update SkiaRenderer.cpp
mrousavy 2f7e200
Check for `NO_INPUT_TEXTURE`^
mrousavy e86a9d2
Post & Wait
mrousavy f5c9a11
Set input size
mrousavy edabc67
Add Video back again
mrousavy 3d6767d
Allow session without preview
mrousavy cb52c50
Convert JPEG to byte[]
mrousavy d38ba59
feat: Use `ImageReader` and use YUV Image Buffers in Skia Context (#1…
mrousavy c4085b7
Set minSdk to 26
mrousavy c4f19e8
Set surface
mrousavy 692906b
Revert "Set minSdk to 26"
mrousavy 78fc66c
Set previewType
mrousavy a81bbbc
feat: Video Recording with Camera2 (#1691)
mrousavy e314724
Fix Torch Mode
mrousavy 8a36f52
Fix comparing outputs with hashCode
mrousavy 7a41080
Update CameraSession.kt
mrousavy 6b5dced
Correctly pass along Frame Processor
mrousavy 18de121
fix: Use AUDIO_BIT_RATE of 16 * 44,1Khz
mrousavy abd6b0c
Use CAMCORDER instead of MIC microphone
mrousavy 7c7e2d3
Use 1 channel
mrousavy c7e4756
fix: Use `Orientation`
mrousavy c5fdc2a
Add `native` PixelFormat
mrousavy 78f796a
Update iOS to latest Skia integration
mrousavy df5718d
feat: Add `pixelFormat` property to Camera
mrousavy b414e05
Catch error in configureSession
mrousavy 9a2abc5
Fix JPEG format
mrousavy 490b6af
Clean up best match finder
mrousavy 063e844
Update CameraDeviceDetails.kt
mrousavy b687a5b
Clamp sizes by maximum CamcorderProfile size
mrousavy 1a53717
Remove `getAvailableVideoCodecs`
mrousavy edb7f2a
chore: release 3.0.0-rc.5
mrousavy 23dc847
Use maximum video size of RECORD as default
mrousavy c63fefa
Update CameraDeviceDetails.kt
mrousavy 33a3c3e
Add a todo
mrousavy 71775b5
Add JSON device to issue report
mrousavy f4656cf
Prefer `full` devices and flash
mrousavy 5f180c7
Lock to 30 FPS on Samsung
mrousavy 885b77b
Implement Zoom
mrousavy 6756270
Refactor
mrousavy 59822db
Format -> PixelFormat
mrousavy 3c24352
fix: Feat `pixelFormat` -> `pixelFormats`
mrousavy 0e12e53
Update TROUBLESHOOTING.mdx
mrousavy e2ab76b
Format
mrousavy d5aa3c4
fix: Implement `zoom` for Photo Capture
mrousavy d095f56
fix: Don't run if `isActive` is `false`
mrousavy dec9ece
fix: Call `examplePlugin(frame)`
mrousavy ab185f4
fix: Fix Flash
mrousavy 61f77a4
fix: Use `react-native-worklets-core`!
mrousavy d8d8638
fix: Fix import
mrousavy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// Created by Marc Rousavy on 09.08.23. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <stdexcept> | ||
#include <GLES2/gl2.h> | ||
|
||
namespace vision { | ||
|
||
inline std::string getEglErrorIfAny() { | ||
EGLint error = glGetError(); | ||
if (error != GL_NO_ERROR) return " Error: " + std::to_string(error); | ||
error = eglGetError(); | ||
if (error != EGL_SUCCESS) return " Error: " + std::to_string(error); | ||
return ""; | ||
} | ||
|
||
class OpenGLError: public std::runtime_error { | ||
public: | ||
OpenGLError(const std::string&& message): std::runtime_error(message + getEglErrorIfAny()) {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [cpplint] reported by reviewdog 🐶 |
||
}; | ||
|
||
} // namespace vision |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cpplint] reported by reviewdog 🐶
Single-parameter constructors should be marked explicit. [runtime/explicit] [5]