Skip to content

Commit

Permalink
Merge pull request #1 from maxvol/master
Browse files Browse the repository at this point in the history
fixed compile issues with SPM
  • Loading branch information
maxvol authored Jul 6, 2019
2 parents 8a5a6c7 + 1886a93 commit 028fc65
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion RxAVFoundation/AVCaptureSession+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import RxSwift
import RxCocoa
#endif

@available(iOS 10.0, *)
extension Reactive where Base: AVCaptureSession {

public func configure(preset: AVCaptureSession.Preset = .photo, captureDevice: AVCaptureDevice) {
Expand Down Expand Up @@ -65,6 +66,7 @@ extension Reactive where Base: AVCaptureSession {
return metadataCaptureOutput
}

@available(iOS 11.0, *)
public func photoCaptureOutput(highResolution: Bool = true, depth: Bool = true) -> Observable<PhotoCaptureOutput> {
let photoOutput = AVCapturePhotoOutput()
let photoCaptureDelegate = RxAVCapturePhotoCaptureDelegate()
Expand All @@ -81,7 +83,6 @@ extension Reactive where Base: AVCaptureSession {
if photoOutput.isDepthDataDeliverySupported {
photoOutput.isDepthDataDeliveryEnabled = depth
}

} else {
os_log("Could not add photo data output to the session", log: Log.photo, type: .error)
observer.onError(RxAVFoundationError.cannotAddOutput(.photo))
Expand Down Expand Up @@ -124,6 +125,7 @@ extension Reactive where Base: AVCaptureSession {
return videoCaptureOutput
}

@available(iOS 11.0, *)
public func depthCaptureOutput(filteringEnabled: Bool = true) -> Observable<DepthCaptureOutput> {
let depthOutput = AVCaptureDepthDataOutput()
let depthCaptureDelegate = RxAVCaptureDepthDataOutputDelegate()
Expand Down Expand Up @@ -159,6 +161,7 @@ extension Reactive where Base: AVCaptureSession {
return depthCaptureOutput
}

@available(iOS 11.0, *)
public func synchronizerOutput(dataOutputs: [AVCaptureOutput]) -> Observable<SynchronizerOutput> {
let outputSynchronizer = AVCaptureDataOutputSynchronizer(dataOutputs: dataOutputs) // TODO [videoDataOutput, depthDataOutput])
let synchronizerDelegate = RxAVCaptureDataOutputSynchronizerDelegate()
Expand Down
3 changes: 3 additions & 0 deletions RxAVFoundation/Global.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import os.log

fileprivate let subsystem: String = Bundle.main.bundleIdentifier ?? ""

@available(iOS 10.0, *)
struct Log {
static let meta = OSLog(subsystem: subsystem, category: "meta")
static let photo = OSLog(subsystem: subsystem, category: "photo")
Expand All @@ -26,12 +27,14 @@ fileprivate struct Label {
fileprivate static let processing = "\(subsystem) photo processing queue"
}

@available(iOS 10.0, *)
struct Queue {
static let session = DispatchQueue(label: Label.session, attributes: [], autoreleaseFrequency: .workItem)
static let dataOutput = DispatchQueue(label: Label.dataOutput, qos: .userInitiated, attributes: [], autoreleaseFrequency: .workItem)
static let processing = DispatchQueue(label: Label.processing, attributes: [], autoreleaseFrequency: .workItem)
}

@available(iOS 10.0, *)
struct Scheduler {
static let session = SerialDispatchQueueScheduler(queue: Queue.session, internalSerialQueueName: Label.session)
static let dataOutput = SerialDispatchQueueScheduler(queue: Queue.dataOutput, internalSerialQueueName: Label.dataOutput)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import RxSwift
import RxCocoa
#endif

@available(iOS 11.0, *)
public typealias SynchronizerOutput = (synchronizer: AVCaptureDataOutputSynchronizer, synchronizedDataCollection: AVCaptureSynchronizedDataCollection)

@available(iOS 11.0, *)
final class RxAVCaptureDataOutputSynchronizerDelegate: NSObject, AVCaptureDataOutputSynchronizerDelegate {

typealias Observer = AnyObserver<SynchronizerOutput>
Expand Down
2 changes: 2 additions & 0 deletions RxAVFoundation/RxAVCaptureDepthDataOutputDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import RxSwift
import RxCocoa
#endif

@available(iOS 11.0, *)
public typealias DepthCaptureOutput = (depthDataOutput: AVCaptureDepthDataOutput, depthData: AVDepthData, timestamp: CMTime, connection: AVCaptureConnection)

@available(iOS 11.0, *)
final class RxAVCaptureDepthDataOutputDelegate: NSObject, AVCaptureDepthDataOutputDelegate {

typealias Observer = AnyObserver<DepthCaptureOutput>
Expand Down
2 changes: 2 additions & 0 deletions RxAVFoundation/RxAVCaptureMetadataOutputObjectsDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import RxSwift
import RxCocoa
#endif

@available(iOS 10.0, *)
public typealias CaptureMetadataOutput = (output: AVCaptureMetadataOutput, metadataObjects: [AVMetadataObject], connection: AVCaptureConnection)

@available(iOS 10.0, *)
final class RxAVCaptureMetadataOutputObjectsDelegate: NSObject, AVCaptureMetadataOutputObjectsDelegate {

typealias Observer = AnyObserver<CaptureMetadataOutput>
Expand Down
2 changes: 2 additions & 0 deletions RxAVFoundation/RxAVCapturePhotoCaptureDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import RxSwift
import RxCocoa
#endif

@available(iOS 11.0, *)
public typealias PhotoCaptureOutput = (output: AVCapturePhotoOutput, photo: AVCapturePhoto, error: Error?)

@available(iOS 11.0, *)
final class RxAVCapturePhotoCaptureDelegate: NSObject, AVCapturePhotoCaptureDelegate {

typealias Observer = AnyObserver<PhotoCaptureOutput>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import RxSwift
import RxCocoa
#endif

@available(iOS 10.0, *)
public typealias VideoCaptureOutput = (output: AVCaptureOutput, sampleBuffer: CMSampleBuffer, connection: AVCaptureConnection)

@available(iOS 10.0, *)
final class RxAVCaptureVideoDataOutputSampleBufferDelegate: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate {

typealias Observer = AnyObserver<VideoCaptureOutput>
Expand Down

0 comments on commit 028fc65

Please sign in to comment.