9c579c65aa
* perf: Automatically determine Pixel Format depending on active format. (More efficient video recording 🚀)
* perf: Skip `AVAssetWriter` transform by directly correctly orienting the Video Output connection
* feat: Support camera flipping while recording
* feat: Run frame processor on separate queue, avoids stutters in video recordigns
* feat: Automatically drop late frame processor frames
25 lines
665 B
Swift
25 lines
665 B
Swift
//
|
|
// AVCaptureVideoDataOutput+setOrientation.swift
|
|
// Cuvent
|
|
//
|
|
// Created by Marc Rousavy on 18.01.21.
|
|
// Copyright © 2021 mrousavy. All rights reserved.
|
|
//
|
|
|
|
import AVFoundation
|
|
|
|
extension AVCaptureVideoDataOutput {
|
|
func setOrientation(forCameraPosition position: AVCaptureDevice.Position) {
|
|
let isMirrored = position == .front
|
|
connections.forEach { connection in
|
|
if connection.isVideoMirroringSupported {
|
|
connection.automaticallyAdjustsVideoMirroring = false
|
|
connection.isVideoMirrored = isMirrored
|
|
}
|
|
if connection.isVideoOrientationSupported {
|
|
connection.videoOrientation = .portrait
|
|
}
|
|
}
|
|
}
|
|
}
|