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:
parent
b5eb01bac8
commit
d9a301100f
@ -218,32 +218,34 @@ export function getCameraFormat(device: CameraDevice, filters: FormatFilter[]):
|
||||
|
||||
// Find video stabilization mode
|
||||
if (filter.videoStabilizationMode != null) {
|
||||
if (bestFormat.videoStabilizationModes.includes(filter.videoStabilizationMode.target)) leftPoints++
|
||||
if (format.videoStabilizationModes.includes(filter.videoStabilizationMode.target)) rightPoints++
|
||||
if (bestFormat.videoStabilizationModes.includes(filter.videoStabilizationMode.target))
|
||||
leftPoints += filter.videoStabilizationMode.priority
|
||||
if (format.videoStabilizationModes.includes(filter.videoStabilizationMode.target))
|
||||
rightPoints += filter.videoStabilizationMode.priority
|
||||
}
|
||||
|
||||
// Find pixel format
|
||||
if (filter.pixelFormat != null) {
|
||||
if (bestFormat.pixelFormats.includes(filter.pixelFormat.target)) leftPoints++
|
||||
if (format.pixelFormats.includes(filter.pixelFormat.target)) rightPoints++
|
||||
if (bestFormat.pixelFormats.includes(filter.pixelFormat.target)) leftPoints += filter.pixelFormat.priority
|
||||
if (format.pixelFormats.includes(filter.pixelFormat.target)) rightPoints += filter.pixelFormat.priority
|
||||
}
|
||||
|
||||
// Find Photo HDR formats
|
||||
if (filter.photoHdr != null) {
|
||||
if (bestFormat.supportsPhotoHdr === filter.photoHdr.target) leftPoints++
|
||||
if (format.supportsPhotoHdr === filter.photoHdr.target) rightPoints++
|
||||
if (bestFormat.supportsPhotoHdr === filter.photoHdr.target) leftPoints += filter.photoHdr.priority
|
||||
if (format.supportsPhotoHdr === filter.photoHdr.target) rightPoints += filter.photoHdr.priority
|
||||
}
|
||||
|
||||
// Find Video HDR formats
|
||||
if (filter.videoHdr != null) {
|
||||
if (bestFormat.supportsVideoHdr === filter.videoHdr.target) leftPoints++
|
||||
if (format.supportsVideoHdr === filter.videoHdr.target) rightPoints++
|
||||
if (bestFormat.supportsVideoHdr === filter.videoHdr.target) leftPoints += filter.videoHdr.priority
|
||||
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 (bestFormat.autoFocusSystem === filter.autoFocusSystem.target) leftPoints++
|
||||
if (format.autoFocusSystem === filter.autoFocusSystem.target) rightPoints++
|
||||
if (bestFormat.autoFocusSystem === filter.autoFocusSystem.target) leftPoints += filter.autoFocusSystem.priority
|
||||
if (format.autoFocusSystem === filter.autoFocusSystem.target) rightPoints += filter.autoFocusSystem.priority
|
||||
}
|
||||
|
||||
if (rightPoints > leftPoints) bestFormat = format
|
||||
|
Loading…
Reference in New Issue
Block a user