fix: Fix priority being ignored in some Format filters (#2456)

* fix: Expose auto-focus system for Android

* Add `autoFocusSystem` to filter

* Update CameraDeviceDetails.kt

* Update getCameraFormat.ts

* fix: Fix `priority` being ignored in some Format filters

* Update getCameraFormat.ts
This commit is contained in:
Marc Rousavy 2024-01-30 10:52:34 +01:00 committed by GitHub
parent b5eb01bac8
commit d9a301100f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -218,32 +218,34 @@ export function getCameraFormat(device: CameraDevice, filters: FormatFilter[]):
// Find video stabilization mode // Find video stabilization mode
if (filter.videoStabilizationMode != null) { if (filter.videoStabilizationMode != null) {
if (bestFormat.videoStabilizationModes.includes(filter.videoStabilizationMode.target)) leftPoints++ if (bestFormat.videoStabilizationModes.includes(filter.videoStabilizationMode.target))
if (format.videoStabilizationModes.includes(filter.videoStabilizationMode.target)) rightPoints++ leftPoints += filter.videoStabilizationMode.priority
if (format.videoStabilizationModes.includes(filter.videoStabilizationMode.target))
rightPoints += filter.videoStabilizationMode.priority
} }
// Find pixel format // Find pixel format
if (filter.pixelFormat != null) { if (filter.pixelFormat != null) {
if (bestFormat.pixelFormats.includes(filter.pixelFormat.target)) leftPoints++ if (bestFormat.pixelFormats.includes(filter.pixelFormat.target)) leftPoints += filter.pixelFormat.priority
if (format.pixelFormats.includes(filter.pixelFormat.target)) rightPoints++ if (format.pixelFormats.includes(filter.pixelFormat.target)) rightPoints += filter.pixelFormat.priority
} }
// Find Photo HDR formats // Find Photo HDR formats
if (filter.photoHdr != null) { if (filter.photoHdr != null) {
if (bestFormat.supportsPhotoHdr === filter.photoHdr.target) leftPoints++ if (bestFormat.supportsPhotoHdr === filter.photoHdr.target) leftPoints += filter.photoHdr.priority
if (format.supportsPhotoHdr === filter.photoHdr.target) rightPoints++ if (format.supportsPhotoHdr === filter.photoHdr.target) rightPoints += filter.photoHdr.priority
} }
// Find Video HDR formats // Find Video HDR formats
if (filter.videoHdr != null) { if (filter.videoHdr != null) {
if (bestFormat.supportsVideoHdr === filter.videoHdr.target) leftPoints++ if (bestFormat.supportsVideoHdr === filter.videoHdr.target) leftPoints += filter.videoHdr.priority
if (format.supportsVideoHdr === filter.videoHdr.target) rightPoints++ if (format.supportsVideoHdr === filter.videoHdr.target) rightPoints += filter.videoHdr.priority
} }
// phase-detection is generally the best AF system // Find matching AF system
if (filter.autoFocusSystem != null) { if (filter.autoFocusSystem != null) {
if (bestFormat.autoFocusSystem === filter.autoFocusSystem.target) leftPoints++ if (bestFormat.autoFocusSystem === filter.autoFocusSystem.target) leftPoints += filter.autoFocusSystem.priority
if (format.autoFocusSystem === filter.autoFocusSystem.target) rightPoints++ if (format.autoFocusSystem === filter.autoFocusSystem.target) rightPoints += filter.autoFocusSystem.priority
} }
if (rightPoints > leftPoints) bestFormat = format if (rightPoints > leftPoints) bestFormat = format