feat: Use correct photo and video format dimensions on iOS (#1929)
* feat: Use new photo dimensions API * Update AVCaptureDevice.Format+matchesFilter.swift * fix: Use Pixels instead of Points for video size * feat: Set `PhotoOutput`'s maximum photo resolution * fix: Compare dictionaries instead * chore: Format code * fix: Try to use hash.... failing atm * fix: Use rough comparison again * fix: Also take video HDR into consideration * chore: Format * Use contains * Update AVCaptureDevice.Format+toDictionary.swift * docs: Add better docs to Camera props * Update CameraView+AVCaptureSession.swift * Update CameraView+AVCaptureSession.swift
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// AVCaptureDevice.Format+dimensions.swift
|
||||
// VisionCamera
|
||||
//
|
||||
// Created by Marc Rousavy on 03.08.21.
|
||||
// Copyright © 2021 mrousavy. All rights reserved.
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
import Foundation
|
||||
|
||||
extension AVCaptureDevice.Format {
|
||||
/**
|
||||
* Returns the dimensions the video pipeline is streaming at.
|
||||
*/
|
||||
var videoDimensions: CMVideoDimensions {
|
||||
return CMVideoFormatDescriptionGetDimensions(formatDescription)
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the maximum available photo resolution this format can use.
|
||||
*/
|
||||
var photoDimensions: CMVideoDimensions {
|
||||
if #available(iOS 16.0, *) {
|
||||
if let max = supportedMaxPhotoDimensions.max(by: { left, right in
|
||||
return left.width * left.height < right.width * right.height
|
||||
}) {
|
||||
return max
|
||||
}
|
||||
}
|
||||
return highResolutionStillImageDimensions
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user