https://github.com/fromkk/applelogsampler
https://github.com/fromkk/applelogsampler
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fromkk/applelogsampler
- Owner: fromkk
- Created: 2024-03-28T11:21:53.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-28T23:57:10.000Z (about 2 years ago)
- Last Synced: 2025-02-03T14:27:17.003Z (over 1 year ago)
- Language: Swift
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AppleLog Sampler
This is sample app for capture with `.appleLog` color mode.
## How
1. Set `automaticallyConfiguresCaptureDeviceForWideColor` of AVCaptureSession to `false` (this might be the most important part)
2. Search for a format in `formats` of `AVCaptureDevice` that contains `.appleLog` in `supportedColorSpaces` and set it as `activeFormat`
3. Set `activeColorSpace = .appleLog` on `AVCaptureDevice`
```swift
private func isAppleLogAvailable(for device: AVCaptureDevice) -> Bool {
device.formats.first(where: {
$0.supportedColorSpaces.contains(.appleLog)
}) != nil
}
private func configureAppleLogIfNeeded(for device: AVCaptureDevice) throws {
guard isAppleLogAvailable(for: device) else {
return
}
try device.lockForConfiguration()
defer {
device.unlockForConfiguration()
}
/// set up for .appleLog
if let format = device.formats.first(where: {
$0.supportedColorSpaces.contains(.appleLog)
}) {
device.activeFormat = format
device.activeColorSpace = .appleLog
}
}
```