Skip to content

Commit

Permalink
fix: bad merge in casparcg device, causing issues with channel 1 (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian authored Sep 28, 2023
1 parent 0f5523d commit e259f5c
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,19 +495,15 @@ export class CasparCGDevice extends DeviceWithState<State, DeviceOptionsCasparCG
_.has(foundMapping.options, 'layer')
) {
const mapping = foundMapping as Mapping<SomeMappingCasparCG>
mapping.options.channel = mapping.options.channel || 0
mapping.options.layer = mapping.options.layer || 0
mapping.options.channel = Number(mapping.options.channel) || 1
mapping.options.layer = Number(mapping.options.layer) || 0

// create a channel in state if necessary, or reuse existing channel
const channel = caspar.channels[mapping.options.channel] || { channelNo: mapping.options.channel, layers: {} }
channel.channelNo = Number(mapping.options.channel) || 1
channel.channelNo = mapping.options.channel
channel.fps = this.initOptions ? this.initOptions.fps || 25 : 25
caspar.channels[channel.channelNo] = channel

// @todo: check if we need to get fps.
channel.fps = this.initOptions ? this.initOptions.fps || 25 : 25
caspar.channels[mapping.options.channel] = channel

let foregroundObj: ResolvedTimelineObjectInstanceExtended | undefined = timelineState.layers[layerName]
let backgroundObj = _.last(
_.filter(timelineState.layers, (obj) => {
Expand Down Expand Up @@ -830,14 +826,14 @@ export class CasparCGDevice extends DeviceWithState<State, DeviceOptionsCasparCG
}
}

private _changeTrackedStateFromCommand(command: AMCPCommand, response: Response, time: number) {
private _changeTrackedStateFromCommand(command: AMCPCommand, response: Response, time: number): void {
// Ensure this is for a channel and layer
if (!('channel' in command.params) || command.params.channel === undefined) return
if (!('layer' in command.params) || command.params.layer === undefined) return

if (
response.responseCode < 300 && // TODO - maybe we accept every code except 404?
response.command.match(/Loadbg|Play|Load|Clear|Stop|Resume/i) &&
'channel' in command.params &&
command.params.channel !== undefined &&
'layer' in command.params &&
command.params.layer !== undefined
response.command.match(/Loadbg|Play|Load|Clear|Stop|Resume/i)
) {
const currentExpectedState = this.getState(time)
if (currentExpectedState) {
Expand Down

0 comments on commit e259f5c

Please sign in to comment.