feat: Split videoHdr
and photoHdr
into two settings (#2161)
* feat: Split `videoHdr` and `photoHdr` into two settings * fix: Rename all `hdr` * fix: Fix HDR on Android * Update CameraDeviceDetails.kt * Update CameraDeviceDetails.kt * fix: Correctly configure `pixelFormat` AFTER `format` * Update CameraSession+Configuration.swift * fix: Also after format changed
This commit is contained in:
@@ -100,7 +100,7 @@ extension CameraSession {
|
||||
}
|
||||
|
||||
// Video Output + Frame Processor
|
||||
if case let .enabled(video) = configuration.video {
|
||||
if case .enabled = configuration.video {
|
||||
ReactLogger.log(level: .info, message: "Adding Video Data output...")
|
||||
|
||||
// 1. Add
|
||||
@@ -113,11 +113,6 @@ extension CameraSession {
|
||||
// 2. Configure
|
||||
videoOutput.setSampleBufferDelegate(self, queue: CameraQueues.videoQueue)
|
||||
videoOutput.alwaysDiscardsLateVideoFrames = true
|
||||
let pixelFormatType = try video.getPixelFormat(for: videoOutput)
|
||||
videoOutput.videoSettings = [
|
||||
String(kCVPixelBufferPixelFormatTypeKey): pixelFormatType,
|
||||
]
|
||||
|
||||
self.videoOutput = videoOutput
|
||||
}
|
||||
|
||||
@@ -210,6 +205,21 @@ extension CameraSession {
|
||||
ReactLogger.log(level: .info, message: "Successfully configured Format!")
|
||||
}
|
||||
|
||||
func configurePixelFormat(configuration: CameraConfiguration) throws {
|
||||
guard case let .enabled(video) = configuration.video,
|
||||
let videoOutput else {
|
||||
// Video is not enabled
|
||||
return
|
||||
}
|
||||
|
||||
// Configure the VideoOutput Settings to use the given Pixel Format.
|
||||
// We need to run this after device.activeFormat has been set, otherwise the VideoOutput can't stream the given Pixel Format.
|
||||
let pixelFormatType = try video.getPixelFormat(for: videoOutput)
|
||||
videoOutput.videoSettings = [
|
||||
String(kCVPixelBufferPixelFormatTypeKey): pixelFormatType,
|
||||
]
|
||||
}
|
||||
|
||||
// pragma MARK: Side-Props
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user