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

25 lines
728 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 `AssetWriterInput` protocol which allows injecting a custom
/// implementation.
final class MockAssetWriterInput: NSObject, AssetWriterInput {
var appendStub: ((CMSampleBuffer) -> Bool)?
var avInput: AVAssetWriterInput {
preconditionFailure("Attempted to access unimplemented property: avInput")
}
var expectsMediaDataInRealTime = false
var isReadyForMoreMediaData = false
func append(_ sampleBuffer: CMSampleBuffer) -> Bool {
return appendStub?(sampleBuffer) ?? false
}
}