6e72781500
* 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
34 lines
827 B
Swift
34 lines
827 B
Swift
//
|
|
// 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
|
|
}
|
|
}
|