mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Camera improvements
This commit is contained in:
@@ -55,7 +55,11 @@ private final class CameraContext {
|
||||
if let rotation = CameraPreviewView.Rotation(with: .portrait, videoOrientation: videoOrientation, cameraPosition: self.device.position) {
|
||||
previewView.rotation = rotation
|
||||
}
|
||||
|
||||
if #available(iOS 13.0, *), connection.inputPorts.first?.sourceDevicePosition == .front {
|
||||
let width = CVPixelBufferGetWidth(pixelBuffer)
|
||||
let height = CVPixelBufferGetHeight(pixelBuffer)
|
||||
previewView.captureDeviceResolution = CGSize(width: width, height: height)
|
||||
}
|
||||
previewView.pixelBuffer = pixelBuffer
|
||||
Queue.mainQueue().async {
|
||||
self.videoOrientation = videoOrientation
|
||||
@@ -63,6 +67,15 @@ private final class CameraContext {
|
||||
}
|
||||
}
|
||||
|
||||
self.output.processFaceLandmarks = { [weak self] observations in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if let previewView = self.previewView {
|
||||
previewView.drawFaceObservations(observations)
|
||||
}
|
||||
}
|
||||
|
||||
self.output.processCodes = { [weak self] codes in
|
||||
self?.detectedCodesPipe.putNext(codes)
|
||||
}
|
||||
@@ -158,11 +171,13 @@ private final class CameraContext {
|
||||
func setFlashMode(_ mode: Camera.FlashMode) {
|
||||
self._flashMode = mode
|
||||
|
||||
if mode == .on {
|
||||
self.output.activeFilter = self.filter
|
||||
} else if mode == .off {
|
||||
self.output.activeFilter = nil
|
||||
}
|
||||
// if mode == .on {
|
||||
// self.output.faceLandmarks = true
|
||||
// //self.output.activeFilter = self.filter
|
||||
// } else if mode == .off {
|
||||
// self.output.faceLandmarks = false
|
||||
// //self.output.activeFilter = nil
|
||||
// }
|
||||
}
|
||||
|
||||
func setZoomLevel(_ zoomLevel: CGFloat) {
|
||||
|
||||
Reference in New Issue
Block a user