forked from flutter/packages
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMockCaptureDeviceFormat.swift
31 lines (24 loc) · 1.05 KB
/
MockCaptureDeviceFormat.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// A mock implementation of `FLTCaptureDeviceFormat` that allows mocking the class
/// properties.
final class MockCaptureDeviceFormat: NSObject, FLTCaptureDeviceFormat {
/// The format associated with the capture device.
var format: AVCaptureDevice.Format {
preconditionFailure("Attempted to access unimplemented property: format")
}
var _formatDescription: CMVideoFormatDescription?
/// The format description for the capture device.
var formatDescription: CMFormatDescription {
_formatDescription!
}
/// The array of frame rate ranges supported by the video format.
var videoSupportedFrameRateRanges: [FLTFrameRateRange] = []
override init() {
super.init()
CMVideoFormatDescriptionCreate(
allocator: kCFAllocatorDefault, codecType: kCVPixelFormatType_32BGRA, width: 1920,
height: 1080, extensions: nil, formatDescriptionOut: &_formatDescription)
}
}