Skip to content

Commit ce40710

Browse files
committed
Move fields unused in FLTCam to DefaultCamera
1 parent a114ac2 commit ce40710

File tree

2 files changed

+24
-20
lines changed
  • packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources

2 files changed

+24
-20
lines changed

packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/DefaultCamera.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import CoreMotion
1010
#endif
1111

1212
final class DefaultCamera: FLTCam, Camera {
13+
var dartAPI: FCPCameraEventApi?
14+
var onFrameAvailable: (() -> Void)?
15+
1316
override var videoFormat: FourCharCode {
1417
didSet {
1518
captureVideoOutput.videoSettings = [
@@ -18,6 +21,8 @@ final class DefaultCamera: FLTCam, Camera {
1821
}
1922
}
2023

24+
private(set) var isPreviewPaused = false
25+
2126
override var deviceOrientation: UIDeviceOrientation {
2227
get { super.deviceOrientation }
2328
set {
@@ -42,11 +47,30 @@ final class DefaultCamera: FLTCam, Camera {
4247
/// Videos are written to disk by `videoAdaptor` on an internal queue managed by AVFoundation.
4348
private let photoIOQueue = DispatchQueue(label: "io.flutter.camera.photoIOQueue")
4449

50+
private var videoWriter: FLTAssetWriter?
51+
private var videoWriterInput: FLTAssetWriterInput?
52+
private var audioWriterInput: FLTAssetWriterInput?
53+
private var videoAdaptor: FLTAssetWriterInputPixelBufferAdaptor?
54+
55+
private var imageStreamHandler: FLTImageStreamHandler?
56+
4557
/// Tracks the latest pixel buffer sent from AVFoundation's sample buffer delegate callback.
4658
/// Used to deliver the latest pixel buffer to the flutter engine via the `copyPixelBuffer` API.
4759
private var latestPixelBuffer: CVPixelBuffer?
60+
61+
private var videoRecordingPath: String?
62+
private var isRecordingPaused = false
63+
private var isFirstVideoSample = false
64+
private var videoIsDisconnected = false
65+
private var audioIsDisconnected = false
66+
private var isAudioSetup = false
4867
private var lastVideoSampleTime = CMTime.zero
4968
private var lastAudioSampleTime = CMTime.zero
69+
private var videoTimeOffset = CMTime.zero
70+
private var audioTimeOffset = CMTime.zero
71+
72+
/// Number of frames currently pending processing.
73+
private var streamingPendingFramesCount = 0
5074

5175
/// Maximum number of frames pending processing.
5276
/// To limit memory consumption, limit the number of frames pending processing.

packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/include/camera_avfoundation/FLTCam.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,19 @@ NS_ASSUME_NONNULL_BEGIN
2323
// captureDevice is assignable for the Swift DefaultCamera subclass
2424
@property(strong, nonatomic) NSObject<FLTCaptureDevice> *captureDevice;
2525
@property(readonly, nonatomic) CGSize previewSize;
26-
@property(assign, nonatomic) BOOL isPreviewPaused;
27-
@property(nonatomic, copy, nullable) void (^onFrameAvailable)(void);
28-
/// The API instance used to communicate with the Dart side of the plugin. Once initially set, this
29-
/// should only ever be accessed on the main thread.
30-
@property(nonatomic, nullable) FCPCameraEventApi *dartAPI;
3126
// Format used for video and image streaming.
3227
@property(assign, nonatomic) FourCharCode videoFormat;
3328
@property(assign, nonatomic) FCPPlatformImageFileFormat fileFormat;
3429

3530
// Properties exposed for the Swift DefaultCamera subclass
36-
@property(nonatomic, nullable) FLTImageStreamHandler *imageStreamHandler;
37-
/// Number of frames currently pending processing.
38-
@property(assign, nonatomic) int streamingPendingFramesCount;
39-
@property(assign, nonatomic) BOOL isFirstVideoSample;
4031
@property(assign, nonatomic) BOOL isRecording;
41-
@property(assign, nonatomic) BOOL isRecordingPaused;
42-
@property(strong, nonatomic, nullable) NSObject<FLTAssetWriter> *videoWriter;
43-
@property(assign, nonatomic) BOOL videoIsDisconnected;
44-
@property(assign, nonatomic) BOOL audioIsDisconnected;
45-
@property(assign, nonatomic) CMTime videoTimeOffset;
46-
@property(assign, nonatomic) CMTime audioTimeOffset;
47-
@property(strong, nonatomic, nullable) NSObject<FLTAssetWriterInput> *videoWriterInput;
48-
@property(strong, nonatomic, nullable) NSObject<FLTAssetWriterInput> *audioWriterInput;
49-
@property(nullable) NSObject<FLTAssetWriterInputPixelBufferAdaptor> *videoAdaptor;
5032
@property(readonly, nonatomic) NSObject<FLTCaptureSession> *videoCaptureSession;
5133
@property(readonly, nonatomic) NSObject<FLTCaptureSession> *audioCaptureSession;
5234
@property(readonly, nonatomic) NSObject<FLTDeviceOrientationProviding> *deviceOrientationProvider;
5335
@property(assign, nonatomic) UIDeviceOrientation lockedCaptureOrientation;
5436
@property(assign, nonatomic) UIDeviceOrientation deviceOrientation;
5537
@property(assign, nonatomic) FCPPlatformFlashMode flashMode;
5638
@property(nonatomic) CMMotionManager *motionManager;
57-
@property(strong, nonatomic, nullable) NSString *videoRecordingPath;
5839
@property(nonatomic, copy) CaptureDeviceFactory captureDeviceFactory;
5940
@property(strong, nonatomic) NSObject<FLTCaptureInput> *captureVideoInput;
6041
@property(readonly, nonatomic) NSObject<FLTCaptureDeviceInputFactory> *captureDeviceInputFactory;
@@ -64,7 +45,6 @@ NS_ASSUME_NONNULL_BEGIN
6445
@property(readonly, nonatomic) FLTCamMediaSettingsAVWrapper *mediaSettingsAVWrapper;
6546
@property(readonly, nonatomic) FCPPlatformMediaSettings *mediaSettings;
6647
@property(nonatomic, copy) InputPixelBufferAdaptorFactory inputPixelBufferAdaptorFactory;
67-
@property(assign, nonatomic) BOOL isAudioSetup;
6848
/// A wrapper for AVCaptureDevice creation to allow for dependency injection in tests.
6949
@property(nonatomic, copy) AudioCaptureDeviceFactory audioCaptureDeviceFactory;
7050

0 commit comments

Comments
 (0)