Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Capturer/Basic/CaptureBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public final class CaptureBodyWrapper: @unchecked Sendable {

public var sessionPreset: AVCaptureSession.Preset = .photo

public var enableMultitaskingCameraAccessIfSupported: Bool = false

public init() {

}
Expand Down Expand Up @@ -63,6 +65,10 @@ public final class CaptureBodyWrapper: @unchecked Sendable {
self.session.performConfiguration {
$0.sessionPreset = configuration.sessionPreset
$0.automaticallyConfiguresCaptureDeviceForWideColor = true
if configuration.enableMultitaskingCameraAccessIfSupported,
$0.isMultitaskingCameraAccessSupported {
$0.isMultitaskingCameraAccessEnabled = true
}
}

}
Expand Down
1 change: 1 addition & 0 deletions Capturer/Basic/Outputs/PhotoOutput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public final class PhotoOutput: _StatefulObjectBase, OutputNodeType, @unchecked
}

private let _output = AVCapturePhotoOutput()
public var avCapturePhotoOutput: AVCapturePhotoOutput { _output }

public init(quality: AVCapturePhotoOutput.QualityPrioritization = .balanced) {
super.init()
Expand Down
2 changes: 1 addition & 1 deletion Capturer/Basic/PhotoTools.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import UIKit
enum PhotoTools {

@MainActor
public static func save(image: UIImage, completion: @escaping (Result<Void, Error>) -> Void) {
public static func save(image: UIImage, completion: @escaping @Sendable (Result<Void, Error>) -> Void) {

PHPhotoLibrary.shared().performChanges {

Expand Down
11 changes: 6 additions & 5 deletions Capturer/Basic/Views/PixelBufferView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ public final class PixelBufferView: UIView, PixelBufferDisplaying {

subscription?.cancel()

Task {
subscription = await output
Task { [weak self] in
let subscription = await output
.pixelBufferBus
.addHandler { [unowned self] pixelBuffer in
Task {
await self.input(pixelBuffer: pixelBuffer)
.addHandler { [weak self] pixelBuffer in
Task { @MainActor in
self?.input(pixelBuffer: pixelBuffer)
}
}
self?.subscription = subscription
}
}

Expand Down
2 changes: 1 addition & 1 deletion Capturer/Extended/Filters/CoreImageFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Foundation
import CoreImage

open class CoreImageFilter: CVPixelBufferModifying {
open class CoreImageFilter: CVPixelBufferModifying, @unchecked Sendable {

private lazy var ciContext = MTLCreateSystemDefaultDevice()
.map {
Expand Down