1
1
import {
2
- Commands as AtemCommands , VideoState , Enums
2
+ Commands as AtemCommands , VideoState , Enums , AtemStateUtil
3
3
} from 'atem-connection'
4
4
import { State as StateObject } from '..'
5
5
import { diffObject , getAllKeysNumber } from '../util'
6
6
import { Defaults } from '../defaults'
7
7
8
+ type SuperSourceCombinedProperties = VideoState . SuperSource . SuperSourceProperties & VideoState . SuperSource . SuperSourceBorder
9
+
8
10
export function resolveSuperSourceState ( oldState : StateObject , newState : StateObject , version : Enums . ProtocolVersion ) : Array < AtemCommands . ISerializableCommand > {
9
11
const commands : Array < AtemCommands . ISerializableCommand > = [ ]
10
12
@@ -29,8 +31,8 @@ export function resolveSuperSourceBoxState (oldState: StateObject, newState: Sta
29
31
continue
30
32
}
31
33
32
- const newSSrc = newState . video . getSuperSource ( ssrc , true )
33
- const oldSSrc = oldState . video . getSuperSource ( ssrc , true )
34
+ const newSSrc = AtemStateUtil . getSuperSource ( newState , ssrc , true )
35
+ const oldSSrc = AtemStateUtil . getSuperSource ( oldState , ssrc , true )
34
36
for ( const index in newSSrc . boxes ) {
35
37
const props = diffObject ( oldSSrc . boxes [ index ] || Defaults . Video . SuperSourceBox , newSSrc . boxes [ index ] || Defaults . Video . SuperSourceBox )
36
38
const command = new AtemCommands . SuperSourceBoxParametersCommand ( ssrc , Number ( index ) )
@@ -47,14 +49,14 @@ export function resolveSuperSourcePropertiesState (oldState: StateObject, newSta
47
49
const commands : Array < AtemCommands . ISerializableCommand > = [ ]
48
50
49
51
if ( ! newState . video . superSources [ 0 ] && ! oldState . video . superSources [ 0 ] ) return commands
50
- const newSSrc = newState . video . getSuperSource ( 0 , true )
51
- const oldSSrc = oldState . video . getSuperSource ( 0 , true )
52
+ const newSSrc = AtemStateUtil . getSuperSource ( newState , 0 , true )
53
+ const oldSSrc = AtemStateUtil . getSuperSource ( oldState , 0 , true )
52
54
53
- const newSsProperties : Partial < VideoState . SuperSourceProperties & VideoState . SuperSourceBorder > = {
55
+ const newSsProperties : Partial < SuperSourceCombinedProperties > = {
54
56
...newSSrc . properties ,
55
57
...newSSrc . border
56
58
}
57
- const oldSsProperties : Partial < VideoState . SuperSourceProperties & VideoState . SuperSourceBorder > = {
59
+ const oldSsProperties : Partial < SuperSourceCombinedProperties > = {
58
60
...oldSSrc . properties ,
59
61
...oldSSrc . border
60
62
}
@@ -72,8 +74,8 @@ export function resolveSuperSourcePropertiesV8State (oldState: StateObject, newS
72
74
const commands : Array < AtemCommands . ISerializableCommand > = [ ]
73
75
74
76
for ( const ssrc of getAllKeysNumber ( oldState . video . superSources , newState . video . superSources ) . sort ( ) ) {
75
- const newSSrc = newState . video . getSuperSource ( ssrc , true )
76
- const oldSSrc = oldState . video . getSuperSource ( ssrc , true )
77
+ const newSSrc = AtemStateUtil . getSuperSource ( newState , ssrc , true )
78
+ const oldSSrc = AtemStateUtil . getSuperSource ( oldState , ssrc , true )
77
79
78
80
const props = diffObject ( oldSSrc . properties || Defaults . Video . SuperSourceProperties , newSSrc . properties || Defaults . Video . SuperSourceProperties )
79
81
const command = new AtemCommands . SuperSourcePropertiesV8Command ( ssrc )
@@ -89,8 +91,8 @@ export function resolveSuperSourceBorderV8State (oldState: StateObject, newState
89
91
const commands : Array < AtemCommands . ISerializableCommand > = [ ]
90
92
91
93
for ( const ssrc of getAllKeysNumber ( oldState . video . superSources , newState . video . superSources ) . sort ( ) ) {
92
- const newSSrc = newState . video . getSuperSource ( ssrc , true )
93
- const oldSSrc = oldState . video . getSuperSource ( ssrc , true )
94
+ const newSSrc = AtemStateUtil . getSuperSource ( newState , ssrc , true )
95
+ const oldSSrc = AtemStateUtil . getSuperSource ( oldState , ssrc , true )
94
96
95
97
const props = diffObject ( oldSSrc . border || Defaults . Video . SuperSourceBorder , newSSrc . border || Defaults . Video . SuperSourceBorder )
96
98
const command = new AtemCommands . SuperSourceBorderCommand ( ssrc )
0 commit comments