From d78387a4c5afc9cc367909d212a075a6d29ea28e Mon Sep 17 00:00:00 2001 From: levs42 Date: Mon, 12 Feb 2024 16:54:36 -0800 Subject: [PATCH] Add an option to show video preview without video effects on non-macos platforms --- Sources/IO/IOVideoMixer.swift | 2 +- Sources/IO/IOVideoMixerSettings.swift | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/IO/IOVideoMixer.swift b/Sources/IO/IOVideoMixer.swift index 90099fdbe..f6dc5ec69 100644 --- a/Sources/IO/IOVideoMixer.swift +++ b/Sources/IO/IOVideoMixer.swift @@ -107,7 +107,7 @@ final class IOVideoMixer { #if os(macOS) pixelBufferPool?.createPixelBuffer(&imageBuffer) #else - if buffer.width != Int(extent.width) || buffer.height != Int(extent.height) { + if settings.effectsBuffer || buffer.width != Int(extent.width) || buffer.height != Int(extent.height) { pixelBufferPool?.createPixelBuffer(&imageBuffer) } #endif diff --git a/Sources/IO/IOVideoMixerSettings.swift b/Sources/IO/IOVideoMixerSettings.swift index c9e7df12c..300e98580 100644 --- a/Sources/IO/IOVideoMixerSettings.swift +++ b/Sources/IO/IOVideoMixerSettings.swift @@ -36,6 +36,8 @@ public struct IOVideoMixerSettings: Codable { public let direction: ImageTransform /// Specifies the main channel number. public var channel: UInt8 = 0 + /// Specifies if effects are always rendered to a new buffer. + public var effectsBuffer: Bool = false /// Create a new IOVideoMixerSettings. public init(mode: Mode, cornerRadius: CGFloat, regionOfInterest: CGRect, direction: ImageTransform) {