]>
Commit | Line | Data |
---|---|---|
1 | import Foundation | |
2 | ||
3 | struct CaptureSessionConfiguration { | |
4 | let frameRate: Int | |
5 | let outputFormats: OutputFormatSetting | |
6 | let backendFormat: OutputFormatSetting | |
7 | let backend: URL? | |
8 | let shouldKeepLocalFiles: Bool | |
9 | ||
10 | init( | |
11 | frameRate: Int? = nil, | |
12 | outputFormats: OutputFormatSetting? = nil, | |
13 | backendFormat: OutputFormatSetting? = nil, | |
14 | backend: URL? = nil, | |
15 | shouldKeepLocalFiles: Bool? = nil | |
16 | ) { | |
17 | self.frameRate = frameRate ?? CapturaSettings.frameRate | |
18 | self.outputFormats = outputFormats ?? CapturaSettings.outputFormats | |
19 | self.backendFormat = backendFormat ?? CapturaSettings.backendFormat | |
20 | self.backend = backend ?? CapturaSettings.backend | |
21 | self.shouldKeepLocalFiles = shouldKeepLocalFiles ?? CapturaSettings.shouldKeepLocalFiles | |
22 | } | |
23 | ||
24 | var shouldSaveMp4: Bool { | |
25 | outputFormats.shouldSaveMp4() || (shouldUseBackend && shouldUploadMp4) | |
26 | } | |
27 | ||
28 | var shouldSaveGif: Bool { | |
29 | outputFormats.shouldSaveGif() || (shouldUseBackend && shouldUploadGif) | |
30 | } | |
31 | ||
32 | var shouldUploadGif: Bool { | |
33 | backendFormat.shouldSaveGif() | |
34 | } | |
35 | ||
36 | var shouldUploadMp4: Bool { | |
37 | backendFormat.shouldSaveMp4() | |
38 | } | |
39 | ||
40 | var shouldUseBackend: Bool { | |
41 | backend != nil | |
42 | } | |
43 | } |