twonly-app-dependencies/camera_avfoundation/darwin/Tests/Mocks/MockAssetWriterInputPixelBufferAdaptor.swift
2026-10-07 22:18:23 +02:00

17 lines
642 B
Swift

// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import AVFoundation
@testable import camera_avfoundation
/// Mock implementation of `AssetWriterInputPixelBufferAdaptor` protocol which allows injecting a custom
/// implementation.
final class MockAssetWriterInputPixelBufferAdaptor: NSObject, AssetWriterInputPixelBufferAdaptor {
var appendStub: ((CVPixelBuffer, CMTime) -> Bool)?
func append(_ pixelBuffer: CVPixelBuffer, withPresentationTime presentationTime: CMTime) -> Bool {
appendStub?(pixelBuffer, presentationTime) ?? true
}
}